/**
 * haoxz 导航系统 - 后台样式
 * 版本: 1.0
 */

/* ==================== 全局重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #f3f4f6;
    font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
    color: #333;
}

/* ==================== 后台布局 ==================== */
.admin-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.logo a {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
    text-decoration: none;
}

.logo a:hover {
    color: #5a67d8;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-name {
    color: #333;
    font-size: 14px;
}

.logout-btn {
    color: #ef4444;
    text-decoration: none;
    font-size: 14px;
}

.logout-btn:hover {
    color: #dc2626;
}

.admin-sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 240px;
    background: #fff;
    box-shadow: 1px 0 4px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    z-index: 99;
}

.admin-main {
    margin-left: 240px;
    margin-top: 60px;
    padding: 20px;
    min-height: calc(100vh - 60px);
    width: calc(100% - 240px);
}

.admin-content {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
}

.page-title {
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

/* ==================== 导航菜单 ==================== */
.nav-menu {
    list-style: none;
    padding: 15px 0;
}

.nav-item {
    margin: 2px 15px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    color: #555;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-link:hover {
    background: #f3f4f6;
    color: #667eea;
}

.nav-link.active {
    background: #667eea;
    color: #fff;
}

.nav-icon {
    font-size: 18px;
}

.nav-divider {
    padding: 10px 20px;
    font-size: 12px;
    color: #999;
    margin-top: 10px;
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-info h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.stat-info .number {
    font-size: 32px;
    font-weight: bold;
    color: #333;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    font-size: 24px;
    color: #fff;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.stat-icon.green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-icon.red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* ==================== 面板 ==================== */
.panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    font-weight: bold;
    font-size: 16px;
}

.panel-body {
    padding: 15px 20px;
}

/* ==================== 仪表盘两列布局 ==================== */
.row-2cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    overflow: hidden;
}

.row-2cols .panel {
    min-width: 0;
    overflow: hidden;
}

.row-2cols .panel-body {
    overflow-x: auto;
}

/* 仪表盘表格 */
.dashboard-table {
    width: 100%;
    font-size: 13px;
    table-layout: fixed;
}

.dashboard-table th,
.dashboard-table td {
    padding: 10px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-table th:first-child,
.dashboard-table td:first-child {
    width: 35%;
}

.dashboard-table th:nth-child(2),
.dashboard-table td:nth-child(2) {
    width: 15%;
    text-align: center;
}

.dashboard-table th:nth-child(3),
.dashboard-table td:nth-child(3) {
    width: 20%;
    text-align: center;
}

.dashboard-table th:last-child,
.dashboard-table td:last-child {
    width: 30%;
    text-align: center;
}

/* 反馈表格 */
.feedback-table th:first-child,
.feedback-table td:first-child {
    width: 20%;
    text-align: center;
}

.feedback-table th:nth-child(2),
.feedback-table td:nth-child(2) {
    width: 55%;
    white-space: normal;
    word-break: break-all;
}

.feedback-table th:last-child,
.feedback-table td:last-child {
    width: 25%;
}

.dashboard-table .badge {
    font-size: 11px;
    padding: 2px 6px;
}

/* ==================== 日志表格 ==================== */
.log-table {
    width: 100%;
    border-collapse: collapse;
}

.log-table th,
.log-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
}

.log-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #333;
}

.log-table th:first-child,
.log-table td:first-child {
    width: 70px;
    text-align: center;
}

.log-table th:nth-child(2),
.log-table td:nth-child(2) {
    width: auto;
}

.log-table th:nth-child(3),
.log-table td:nth-child(3) {
    width: 120px;
    text-align: center;
}

.log-table th:last-child,
.log-table td:last-child {
    width: 150px;
    text-align: center;
}

.log-content {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-table tbody tr:hover {
    background: #f9fafb;
}

/* ==================== 搜索栏 ==================== */
.search-bar {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-bar .form-control {
    width: 220px;
}

.search-form {
    margin-bottom: 20px;
}

.search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.search-row .form-control {
    width: 160px;
}

.search-row .form-control[placeholder*="名称"],
.search-row .form-control[placeholder*="网址"] {
    width: 200px;
}

/* ==================== 表格 ==================== */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.table th,
.table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    line-height: 1.5;
    white-space: nowrap;
}

.table th {
    background: #f9fafb;
    font-weight: 600;
    color: #333;
}

.table tr:hover {
    background: #f9fafb;
}

.table th:first-child,
.table td:first-child {
    width: 50px;
    text-align: center;
}

.table th:last-child,
.table td:last-child {
    width: 200px;
    text-align: center;
}

.table td:last-child .btn,
.table td:last-child a {
    margin: 0 2px;
}

/* ==================== 链接样式 ==================== */
a {
    text-decoration: none;
    color: #333;
}

a:hover {
    color: #667eea;
}

.site-name-link {
    display: inline-block;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    color: #333;
    font-weight: 500;
}

.site-name-link:hover {
    color: #667eea;
}

.site-url-link {
    display: inline-block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    color: #666;
    font-size: 12px;
}

.site-url-link:hover {
    color: #667eea;
}

.category-name-link {
    color: #333;
    cursor: pointer;
}

.category-name-link:hover {
    color: #667eea;
}

/* ==================== 状态徽章 ==================== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.badge-success {
    background: #d1fae5;
    color: #10b981;
}

.badge-warning {
    background: #fef3c7;
    color: #d97706;
}

.badge-danger {
    background: #fee2e2;
    color: #ef4444;
}

.badge-info {
    background: #dbeafe;
    color: #3b82f6;
}

/* ==================== 按钮 ==================== */
.btn {
    display: inline-block;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: #fff;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-success {
    background: #10b981;
    color: #fff;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-secondary {
    background: #6b7280;
    color: #fff;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.page-title .btn {
    margin-top: -4px;
}

/* ==================== 表单 ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group label .required {
    color: #ef4444;
    margin-left: 4px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-control:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #333;
    min-width: 36px;
    text-align: center;
}

.pagination a:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.pagination .active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.pagination .disabled {
    color: #999;
    cursor: not-allowed;
    background: #f5f5f5;
}

.pagination .page-info {
    margin-left: 10px;
    color: #666;
    font-size: 13px;
    border: none;
}

.pagination .page-dots {
    border: none;
    background: none;
}

/* ==================== 提示消息 ==================== */
.alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 16px 24px;
    border-radius: 8px;
    z-index: 10000;
    min-width: 300px;
    max-width: 500px;
    text-align: center;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: fadeInOut 3s ease forwards;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    85% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
        visibility: hidden;
    }
}

.alert-success {
    background: #d1fae5;
    color: #10b981;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: #fee2e2;
    color: #ef4444;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #3b82f6;
    border: 1px solid #bfdbfe;
}

/* ==================== 登录页面 ==================== */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    width: 400px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 30px;
    text-align: center;
}

.login-header h2 {
    font-size: 24px;
    margin-bottom: 5px;
}

.login-header p {
    opacity: 0.9;
    font-size: 13px;
}

.login-body-inner {
    padding: 30px;
}

.captcha-row {
    display: flex;
    gap: 10px;
}

.captcha-row input {
    flex: 1;
}

.captcha-row img {
    height: 46px;
    border-radius: 8px;
    cursor: pointer;
}

.login-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
}

/* ==================== 新闻设置样式 ==================== */
.current-source {
    background: #f0fdf4;
    border-left: 3px solid #10b981;
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 6px;
}

.preview-news-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.preview-news-list li {
    padding: 8px 0;
    border-bottom: 1px dashed #e5e7eb;
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-news-list li:last-child {
    border-bottom: none;
}

.preview-news-list .news-source {
    font-size: 12px;
    color: #999;
    min-width: 70px;
}

.preview-news-list .news-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-news-list .news-title a {
    color: #333;
    text-decoration: none;
}

.preview-news-list .news-title a:hover {
    color: #667eea;
}

.preview-news-list .news-time {
    font-size: 12px;
    color: #999;
    min-width: 80px;
    text-align: right;
}

.source-table td:first-child,
.source-table th:first-child {
    width: 50px;
    text-align: center;
}

/* ==================== 辅助类 ==================== */
.text-center {
    text-align: center;
}

.text-muted {
    color: #999;
}

.clearfix::after {
    content: '';
    display: table;
    clear: both;
}

.float-right {
    float: right;
}

/* ==================== 响应式 ==================== */
@media (max-width: 1200px) {
    .table {
        min-width: 900px;
    }
}

@media (max-width: 992px) {
    .admin-sidebar {
        width: 200px;
    }
    
    .admin-main {
        margin-left: 200px;
        width: calc(100% - 200px);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .row-2cols {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .dashboard-table th,
    .dashboard-table td {
        padding: 8px 6px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        width: 60px;
    }
    
    .admin-main {
        margin-left: 60px;
        width: calc(100% - 60px);
        padding: 15px;
    }
    
    .nav-link span:last-child {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-info .number {
        font-size: 24px;
    }
    
    .row-2cols {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .search-row,
    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-row .form-control,
    .search-bar .form-control,
    .search-row .btn,
    .search-bar .btn {
        width: 100%;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .pagination a,
    .pagination span {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px 4px;
        font-size: 12px;
    }
    
    .table td:last-child .btn,
    .table td:last-child a {
        display: inline-block;
        margin: 2px;
    }
    
    .dashboard-table th,
    .dashboard-table td {
        padding: 6px 4px;
        font-size: 11px;
    }
    
    .feedback-table th:nth-child(2),
    .feedback-table td:nth-child(2) {
        max-width: 120px;
    }
}