/* Simple & Elegant Sports Crawler Dashboard */

:root {
    --bg-primary: #fafbfc;
    --bg-secondary: #ffffff;
    --text-primary: #24292f;
    --text-secondary: #57606a;
    --text-muted: #8b949e;
    --accent: #2563eb;
    --accent-light: #dbeafe;
    --success: #16a34a;
    --danger: #dc2626;
    --border: #d1d9e0;
    --border-light: #e8edf2;
    --shadow: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 4px rgba(0,0,0,0.06);
    --radius: 6px;
    --sidebar-width: 220px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.app {
    display: flex;
    min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.logo span {
    font-size: 15px;
    font-weight: 600;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 12px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-item i {
    width: 18px;
    font-size: 14px;
}

.nav-item:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px 0;
    border-top: 1px solid var(--border-light);
}

.scheduler-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f0fdf4;
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--success);
}

/* ========== MAIN CONTENT ========== */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
}

.view {
    display: none;
    max-width: 1400px;
}

.view.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}

.header-content h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.header-content h1 i {
    color: var(--accent);
    font-size: 20px;
}

.header-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

/* ========== BUTTONS ========== */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn i {
    font-size: 13px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-success:hover {
    background: #15803d;
    border-color: #15803d;
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: white;
}

.btn-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-lg {
    padding: 10px 20px;
    font-size: 14px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== STATS GRID ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.sites-card .stat-icon {
    background: var(--accent-light);
    color: var(--accent);
}

.articles-card .stat-icon {
    background: #fce7f3;
    color: #ec4899;
}

.status-card .stat-icon {
    background: #dcfce7;
    color: var(--success);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-footer {
    margin-top: 8px;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.stat-trend i {
    color: var(--success);
    font-size: 11px;
}

/* ========== RECENT ARTICLES ========== */
.recent-articles-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header h2 i {
    color: var(--accent);
    font-size: 15px;
}

.view-all-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.view-all-link:hover {
    text-decoration: underline;
}

.articles-grid {
    display: grid;
    gap: 10px;
}

.article-card {
    padding: 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    transition: all 0.15s;
}

.article-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-md);
}

.article-card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    margin-bottom: 8px;
}

.article-card-title:hover {
    color: var(--accent);
}

.article-card-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    background: var(--accent-light);
    color: var(--accent);
}

/* ========== SITES GRID ========== */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.site-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

.site-card.inactive {
    opacity: 0.6;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.site-name {
    font-size: 16px;
    font-weight: 600;
}

.site-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.site-badge.active {
    background: #dcfce7;
    color: #15803d;
}

.site-badge.inactive {
    background: #fee2e2;
    color: #dc2626;
}

.site-domain {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 10px;
}

.site-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding: 8px 10px;
    background: var(--bg-primary);
    border-radius: 4px;
}

.site-actions {
    display: flex;
    gap: 8px;
}

.site-actions .btn {
    flex: 1;
    justify-content: center;
    font-size: 12px;
    padding: 7px 12px;
}

/* ========== ARTICLES TABLE ========== */
.articles-table-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.table-wrapper {
    overflow-x: auto;
}

.articles-table {
    width: 100%;
    border-collapse: collapse;
}

.articles-table th,
.articles-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
}

.articles-table th {
    background: var(--bg-primary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.articles-table th i {
    margin-right: 4px;
    color: var(--accent);
}

.articles-table td {
    border-bottom: 1px solid var(--border-light);
}

.articles-table tr:last-child td {
    border-bottom: none;
}

.articles-table tbody tr:hover {
    background: var(--bg-primary);
}

.article-title a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
}

.article-title a:hover {
    color: var(--accent);
}

.filters {
    display: flex;
    gap: 10px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: var(--radius);
}

.filter-group i {
    color: var(--accent);
    font-size: 12px;
}

.filter-group select {
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    outline: none;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.page-info {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}

/* ========== CRAWL VIEW ========== */
.crawl-container {
    display: grid;
    gap: 16px;
}

.crawl-controls-card,
.crawl-status-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.crawl-controls-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.crawl-controls-card h3 i {
    color: var(--accent);
}

.crawl-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-group label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.option-group label i {
    color: var(--accent);
}

.option-group select {
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    outline: none;
}

.option-group select:focus {
    border-color: var(--accent);
}

.crawl-buttons {
    display: flex;
    gap: 12px;
}

.crawl-buttons .btn {
    flex: 1;
    justify-content: center;
}

.status-header {
    margin-bottom: 16px;
}

.status-indicator-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-indicator.running {
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-indicator-wrapper span {
    font-size: 14px;
    font-weight: 500;
}

.progress-section {
    margin-bottom: 16px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.progress-bar-container {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s;
}

.progress-stats {
    display: flex;
    gap: 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
}

.stat-item i {
    color: var(--success);
}

.crawl-log-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.crawl-log-section h4 i {
    color: var(--accent);
}

.crawl-log {
    max-height: 180px;
    overflow-y: auto;
    background: #f6f8fa;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px;
    font-family: 'Consolas', monospace;
    font-size: 12px;
}

.log-entry {
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.log-entry.error {
    color: var(--danger);
}

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header h2 i {
    color: var(--accent);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group label i {
    color: var(--accent);
    font-size: 12px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-size: 13px;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main {
        margin-left: 0;
        padding: 16px;
        padding-top: 60px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .sites-grid {
        grid-template-columns: 1fr;
    }
    
    .crawl-options {
        grid-template-columns: 1fr;
    }
    
    .crawl-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .main {
        padding: 12px;
    }
    
    .stat-value {
        font-size: 24px;
    }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========== UTILITIES ========== */
.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}
