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

:root {
    /* Color Palette */
    --primary: #003366;
    --primary-light: #00509d;
    --primary-dark: #002244;
    --accent: #00a8e8;
    --bg-main: #f4f7f6;
    --bg-sidebar: #ffffff;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --white: #ffffff;
    --error: #d63031;
    --success: #27ae60;
    --warning: #f1c40f;
    --border: #dfe6e9;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    
    /* Transitions */
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Layout --- */

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

/* --- Auth Section --- */

#auth-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    z-index: 1000;
    transition: var(--transition);
}

.auth-card {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: fadeInScale 0.5s ease-out;
}

.auth-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    object-fit: contain;
}

.auth-card h2 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.auth-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

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

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

.form-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(0, 80, 157, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1rem;
}

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.credentials-hint {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Dashboard Section --- */

#dashboard-section {
    display: none; /* Hidden by default */
    width: 100%;
    flex: 1;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    width: 32px;
    height: 32px;
}

.sidebar-title {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

.sidebar-menu {
    flex: 1;
    padding: 1.5rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    gap: 1rem;
    border-left: 4px solid transparent;
}

.nav-item:hover {
    background-color: rgba(0, 51, 102, 0.05);
    color: var(--primary);
}

.nav-item.active {
    color: var(--primary);
    background-color: rgba(0, 51, 102, 0.08);
    border-left-color: var(--primary);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

/* --- Main Content --- */

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    height: 70px;
    background-color: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-shadow: var(--shadow-sm);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.content-body {
    padding: 2rem;
    flex: 1;
}

.view-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.view-section.active {
    display: block;
}

/* --- Components --- */

.card {
    background: var(--white);
    border-radius: 0.8rem;
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 0.8rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    border-left: 4px solid var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0.5rem 0;
}

/* --- Audit Section --- */

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 1rem;
    padding: 3rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background-color: #fafbfc;
}

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

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

.file-info {
    margin-top: 1.5rem;
    display: none;
    text-align: left;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
}

.progress-container {
    margin-top: 1.5rem;
    display: none;
}

.progress-bar {
    height: 8px;
    background-color: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

.result-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success { background: rgba(39, 174, 96, 0.1); color: var(--success); }
.badge-error { background: rgba(214, 48, 49, 0.1); color: var(--error); }
.badge-warning { background: rgba(241, 196, 15, 0.1); color: var(--warning); }

/* --- Table --- */

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

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

th {
    text-align: left;
    padding: 1rem;
    background-color: #f8f9fa;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

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

/* --- Utilities --- */

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    background: var(--white);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    z-index: 3000;
    animation: slideUp 0.3s ease-out;
    border-left: 4px solid var(--primary);
}

/* --- Animations --- */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none; /* In a real app we'd add a mobile menu toggle */
    }
}
