:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --bg-main: #020617;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    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;
    background-image: radial-gradient(circle at top right, #1e1b4b, transparent),
        radial-gradient(circle at bottom left, #0f172a, transparent);
    min-height: 100vh;
    padding: 0;
    /* Removed body padding for full-width header */
}

.app-layout {
    display: flex;
    flex-direction: column;
    /* Fixed: Stack header and content vertically */
    min-height: 100vh;
}

/* Header Styles */
.top-header {
    max-width: 1200px;
    width: 95%;
    /* Responsive width */
    margin: 1.5rem auto;
    /* Floating centered header */
    position: relative;
    /* Scrolls away with the page */
    z-index: 1000;
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    transition: all 0.3s ease;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 1.25rem;
    /* Reduced font size */
    font-weight: 600;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-nav ul {
    display: flex;
    list-style: none;
    gap: 1rem;
}

.nav-link {
    display: block;
    padding: 0.6rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: 0.3s;
    font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.active {
    background: var(--glass-border);
    color: var(--text-main);
}

.nav-link.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.menu-toggle-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
}

.menu-toggle-btn span {
    width: 24px;
    height: 2px;
    background: var(--text-main);
    transition: 0.3s;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 70px);
    align-items: center;
    /* Center children horizontally */
}

.content-section {
    display: none;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    margin-bottom: 3rem;
    text-align: center;
    /* Centered dashboard text */
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
}

header p {
    color: var(--text-muted);
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Auth Placeholders */
.profile-placeholder {
    text-align: center;
    padding: 2rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 600;
    margin: 0 auto 1.5rem;
}

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

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

.form-group input {
    width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-main);
}

.form-divider {
    margin: 2rem 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Footer Styles */
.global-footer {
    margin-top: auto;
    padding: 3rem;
    border-radius: 1.5rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.footer-info h3 {
    margin-bottom: 1rem;
}

.footer-info p {
    color: var(--text-muted);
}

.footer-links h4 {
    margin-bottom: 1rem;
}

.footer-links a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.footer-links a:hover {
    color: var(--primary);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
    margin-bottom: 2rem;
}

.upload-section {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

#dropZone {
    border: 2px dashed var(--glass-border);
    border-radius: 0.75rem;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    position: relative;
}

#dropZone:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

#dropZone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-input-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.file-input-content span {
    color: var(--text-muted);
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background: var(--glass-border);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

#results {
    margin-top: 4rem;
    /* Added spacing between upload box and results */
}

.hidden {
    display: none;
}

#loading {
    text-align: center;
    margin-top: 1rem;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    margin: 0 auto 0.5rem;
}

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

.stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    text-align: center;
}

.stat-item .label {
    display: block;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.stat-item .value {
    font-size: 1.5rem;
    font-weight: 600;
}

.table-wrapper {
    overflow-x: auto;
    padding: 1rem;
}

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

th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 400;
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

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

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

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Authentication States */
.app-layout.auth-hidden {
    display: none;
}

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-main);
    background-image: radial-gradient(circle at top right, #1e1b4b, transparent),
        radial-gradient(circle at bottom left, #0f172a, transparent);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 3rem;
    text-align: center;
}

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

.login-header h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

/* Profile Card Enhancements */
.profile-card {
    max-width: 600px;
    margin: 0 auto;
}

.profile-header {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 600;
    color: white;
}

.profile-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.logout-btn {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.profile-edit-section {
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    animation: fadeIn 0.3s ease;
}

@media (max-width: 768px) {
    .menu-toggle-btn {
        display: flex;
    }

    .header-nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--bg-main);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--glass-border);
        padding: 1rem 2rem;
        transform: translateY(-200%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
    }

    .header-nav.active {
        transform: translateY(0);
    }

    .header-nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }

    .nav-link {
        padding: 0.75rem 1rem;
    }

    .main-content {
        padding-top: 5rem;
    }
}

@media (max-width: 640px) {
    header h1 {
        font-size: 2rem;
    }

    .stats {
        flex-direction: column;
        gap: 1.5rem;
    }
}

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.page-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.page-btn:hover:not(:disabled) {
    background: var(--glass-border);
    border-color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

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