@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --secondary: #F59E0B;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --background: #0A192F; /* Navy background for the whole container */
    --content-bg: #F9FAFB; /* Light background for the main content area */
    --sidebar-bg: #0A192F;
    --card-bg: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --sidebar-text: #94A3B8;
    --sidebar-active: #FFFFFF;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
    --border-radius-lg: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
}

/* Auth Layout */
.auth-container {
    display: flex;
    min-height: 100vh;
}

.auth-image {
    flex: 1;
    background-size: cover;
    background-position: center;
    position: relative;
    display: none;
}

@media (min-width: 992px) {
    .auth-image {
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 60px;
        color: white;
    }
}

.auth-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(10, 25, 47, 0.9) 0%, rgba(10, 25, 47, 0.6) 100%);
    z-index: 1;
}

.auth-image-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
}

.auth-image-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #ffffff;
}

.auth-image-content p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.auth-form-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: white;
}

.auth-form-wrapper {
    width: 100%;
    max-width: 550px;
}

.auth-header {
    margin-bottom: 2rem;
}

.auth-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 35, 102, 0.1);
}

.password-wrapper {
    position: relative;
    display: block;
}

.password-wrapper .form-control {
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: var(--primary);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-block;
    width: 100%;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
    border-radius: 6px;
    background: white;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-sm:hover {
    background: #F9FAFB;
    border-color: var(--text-muted);
    transform: none;
    box-shadow: none;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.alert-danger {
    background-color: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
}

.alert-success {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: var(--background);
}

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 32px 16px;
    height: 100vh;
    position: sticky;
    top: 0;
}

.sidebar-header {
    padding: 10px 16px 40px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header i {
    color: white;
    font-size: 1.8rem;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    color: white;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-menu {
    flex: 1;
    list-style: none;
}

.nav-item {
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: white;
    background: var(--primary);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.main-content {
    flex: 1;
    padding: 48px;
    background: var(--content-bg);
    border-top-left-radius: 40px;
    margin-top: 10px;
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    min-height: 100vh;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card.sf { border-top: 4px solid var(--success); }
.stat-card.pos { border-top: 4px solid var(--primary); }
.stat-card.review { border-top: 4px solid var(--danger); }
.stat-card.final { border-top: 4px solid #8B5CF6; }

.stat-title {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 32px;
}

.card-header {
    padding: 20px 24px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-main);
}

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

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

th {
    text-align: left;
    padding: 20px 25px;
    background-color: #F8FAFC;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #E2E8F0;
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.95rem;
}

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

tr:hover td {
    background-color: #F9FAFB;
}

.badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    display: inline-block;
}

.bg-green { background-color: #ECFDF5; color: #065F46; }
.bg-amber { background-color: #FFFBEB; color: #92400E; }
.bg-blue { background-color: #EFF6FF; color: #1E40AF; }
.bg-red { background-color: #FEF2F2; color: #991B1B; }
.bg-purple { background-color: #F5F3FF; color: #5B21B6; }
.bg-gray { background-color: #F9FAFB; color: #374151; }

/* Upload Area */
.upload-zone {
    border: 2px dashed #ccc;
    border-radius: var(--border-radius);
    padding: 60px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-zone:hover {
    border-color: var(--primary);
    background-color: rgba(0, 35, 102, 0.02);
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Folder scanning */
.directory-scan-body {
    padding: 24px;
}

.search-wording-field {
    margin-bottom: 22px;
}

.search-wording-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-main);
    font-weight: 700;
}

.search-wording-field textarea {
    min-height: 116px;
    resize: vertical;
    line-height: 1.5;
}

.field-help {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

#termCount {
    flex: 0 0 auto;
}

.directory-scan-card .card-header p {
    margin-top: 4px;
    font-size: 0.9rem;
}

.directory-picker {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 24px;
    border: 2px dashed #cbd5e1;
    border-radius: var(--border-radius);
    background: #f8fafc;
}

.directory-picker-icon {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #eef2ff;
    color: var(--primary);
    font-size: 1.4rem;
}

.directory-picker-copy {
    flex: 1;
    min-width: 0;
}

.directory-picker-copy h3 {
    color: var(--text-main);
    font-size: 1rem;
}

.directory-picker-copy p,
.directory-scan-note {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.directory-button {
    width: auto;
    white-space: nowrap;
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 1px solid #c7d2fe;
}

.btn-secondary:hover {
    background: #eef2ff;
}

.btn-excel {
    background: #047857;
    color: white;
    text-decoration: none;
}

.btn-excel:hover {
    background: #065f46;
    color: white;
}

.results-export-help {
    margin-top: 3px;
    font-size: 0.84rem;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.directory-scan-note {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.directory-scan-note i {
    color: var(--success);
}

.directory-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    margin-top: 22px;
}

.scan-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.active-search-terms {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: -8px 0 18px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.active-search-terms strong {
    color: var(--text-main);
}

.search-term-chip {
    padding: 4px 10px;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 600;
}

.matched-wording {
    max-width: 220px;
    margin-top: 5px;
    color: #047857;
    font-size: 0.78rem;
    line-height: 1.3;
}

.scan-summary-item {
    padding: 20px;
    border: 1px solid var(--border-color);
    border-left: 4px solid #94a3b8;
    border-radius: var(--border-radius);
    background: white;
    box-shadow: var(--shadow-sm);
}

.scan-summary-item.matched { border-left-color: var(--success); }
.scan-summary-item.warning { border-left-color: var(--warning); }

.scan-summary-item span {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.scan-summary-item strong {
    display: block;
    margin-top: 4px;
    font-size: 1.75rem;
    color: var(--text-main);
}

/* DataTables Premium Styling */
.dataTables_wrapper .dataTables_length, 
.dataTables_wrapper .dataTables_filter, 
.dataTables_wrapper .dataTables_info, 
.dataTables_wrapper .dataTables_processing, 
.dataTables_wrapper .dataTables_paginate {
    color: var(--text-muted) !important;
    font-size: 0.9rem;
    padding: 15px 25px;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    margin-left: 10px;
    outline: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-light) !important;
    color: white !important;
    border: none !important;
}

table.dataTable {
    border-collapse: collapse !important;
    margin-bottom: 20px !important;
}

table.dataTable thead th {
    border-bottom: 1px solid #e2e8f0 !important;
}

/* Empty State */
.empty-state {
    padding: 80px 40px;
    text-align: center;
    color: var(--text-muted);
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px dashed #cbd5e1;
}

.empty-state i {
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    color: var(--primary);
    margin-bottom: 10px;
}

/* Mobile Responsiveness */
@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .mobile-toggle {
        display: block !important;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--primary);
        cursor: pointer;
        margin-right: 15px;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .directory-picker {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .directory-picker-copy {
        width: calc(100% - 70px);
    }

    .directory-button {
        width: 100%;
    }

    .directory-actions {
        align-items: stretch;
        flex-direction: column;
    }


    .field-help {
        flex-direction: column;
        gap: 4px;
    }
}
