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

/* =========================
   RESET / BASE
========================= */

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

html,
body {
    min-height: 100%;
    font-family: 'Inter', sans-serif;
    color: #f8fafc;
}

body {
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(52, 152, 219, 0.16), transparent 30%),
        linear-gradient(135deg, #08111f 0%, #101827 45%, #050816 100%);

    overflow-x: hidden;
}

a {
    color: #22c55e;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.good {
    color: #22c55e;
}

.bad {
    color: #ef4444;
}


/* =========================
   BACKGROUND
========================= */

.background {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: -1;
}

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.18;
}

.glow-1 {
    width: 520px;
    height: 520px;
    background: #22c55e;
    top: -180px;
    left: -120px;
}

.glow-2 {
    width: 520px;
    height: 520px;
    background: #3498db;
    right: -140px;
    top: 120px;
}

.grid-overlay {
    position: absolute;
    inset: 0;

    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);

    background-size: 42px 42px;

    mask-image:
        radial-gradient(circle at center, black 20%, transparent 90%);
}


/* =========================
   BUTTONS
========================= */

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 18px;

    padding: 1rem 1.2rem;

    font-size: 1rem;
    font-weight: 700;

    color: white;
    cursor: pointer;
    text-decoration: none;

    background:
        linear-gradient(135deg, #22c55e, #3498db);

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}

button:hover,
.btn:hover {
    transform: translateY(-2px);
    text-decoration: none;

    box-shadow:
        0 18px 40px rgba(34, 197, 94, 0.22);
}

.btn-primary {
    background: linear-gradient(
        135deg,
        rgba(35, 90, 75, 0.95) 0%,
        rgba(28, 55, 95, 0.95) 100%
    );

    border: 1px solid rgba(48, 220, 130, 0.55);

    color: #f3f7ff;

    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.25),
        0 0 14px rgba(60, 120, 180, 0.10);

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);

    border-color: rgba(120, 190, 255, 0.24);

    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.32),
        0 0 18px rgba(70, 140, 220, 0.16);
}


.btn-secondary {
    background:
        rgba(15, 23, 42, 0.72);

    border:
        1px solid rgba(148, 163, 184, 0.18);

    color: #f8fafc;
}

.btn-danger {
    background: linear-gradient(
        135deg,
        rgba(120, 35, 55, 0.95),
        rgba(75, 20, 35, 0.95)
    );

    border: 1px solid rgba(255, 110, 140, 0.28);

    color: #fff;

    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.22),
        0 0 12px rgba(255, 80, 120, 0.08);
}


/* =========================
   SHARED CARDS
========================= */

.section-card {
    padding: 2rem;

    border-radius: 32px;

    background:
        rgba(15, 23, 42, 0.74);

    backdrop-filter: blur(18px);

    border:
        1px solid rgba(148, 163, 184, 0.16);

    box-shadow:
        0 25px 80px rgba(0,0,0,0.35);
}

.section-card h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}


/* =========================
   LOGO / BRAND
========================= */

.brand img {
    height: 150px;
    width: auto;
    display: block;

    filter:
        drop-shadow(0 0 10px rgba(0, 180, 255, 0.35))
        drop-shadow(0 0 24px rgba(0, 140, 255, 0.18));

    transition: transform 0.25s ease;
}

.brand img:hover {
    transform: scale(1.03);
}

.brand-logo {
    margin-bottom: 2rem;
}

.brand-logo img {
    width: 420px;
    max-width: 100%;
    height: auto;
    display: block;

    filter:
        drop-shadow(0 0 18px rgba(0, 180, 255, 0.25))
        drop-shadow(0 0 36px rgba(0, 120, 255, 0.15));
}


/* =========================
   PUBLIC LAYOUT
========================= */

.public-layout {
    min-height: 100vh;

    display: grid;
    grid-template-columns: 1fr 500px;

    align-items: center;

    padding: 4rem;
    gap: 4rem;
}

.brand-panel {
    max-width: 680px;
}

.brand-badge {
    display: inline-flex;

    align-items: center;
    gap: 0.5rem;

    padding: 0.7rem 1rem;

    border-radius: 999px;

    background:
        rgba(15, 23, 42, 0.68);

    border:
        1px solid rgba(148, 163, 184, 0.14);

    margin-bottom: 2rem;

    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.brand-panel h1 {
    font-size: 4.4rem;
    line-height: 1.02;

    font-weight: 900;

    margin-bottom: 1.5rem;

    letter-spacing: -0.04em;
}

.brand-panel p {
    max-width: 560px;

    font-size: 1.15rem;
    line-height: 1.7;

    color: #94a3b8;
}

.auth-panel {
    width: 100%;
}

.auth-text {
    color: #94a3b8;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.auth-footer {
    margin-top: 1.2rem;
    color: #94a3b8;
}

.success-icon,
.error-icon {
    width: 72px;
    height: 72px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 auto 1.5rem;

    border-radius: 22px;

    font-size: 2rem;
}

.success-icon {
    background:
        linear-gradient(135deg, rgba(34, 197, 94, 0.22), rgba(52, 152, 219, 0.18));

    border:
        1px solid rgba(34, 197, 94, 0.25);
}

.error-icon {
    background:
        linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(249, 115, 22, 0.18));

    border:
        1px solid rgba(239, 68, 68, 0.25);
}

.auth-button-link {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 100%;

    margin-top: 1rem;

    padding: 1rem 1.2rem;

    border-radius: 18px;

    background:
        linear-gradient(135deg, #22c55e, #3498db);

    color: white;
    text-decoration: none;
    font-weight: 700;

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.auth-button-link:hover {
    transform: translateY(-2px);

    text-decoration: none;

    box-shadow:
        0 18px 40px rgba(34, 197, 94, 0.22);
}


/* =========================
   APP LAYOUT
========================= */

.app-page {
    min-height: 100vh;
}

.app-layout {
    min-height: 100vh;

    display: grid;
    grid-template-columns: 240px 1fr;
}

.app-shell {
    width: min(1350px, calc(100% - 3rem));
    margin: 0 auto;
    padding: 2rem 0;
    overflow-x: hidden;
}

.app-layout .app-shell {
    width: min(1350px, calc(100% - 3rem));
    margin: 0 auto;
    padding: 2rem 0;
}


/* =========================
   SIDEBAR
========================= */

.sidebar {
    position: sticky;
    top: 0;

    height: 100vh;

    display: flex;
    flex-direction: column;

    padding: 1.4rem;

    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.18), transparent 36%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(5, 8, 22, 0.98));

    border-right:
        1px solid rgba(148, 163, 184, 0.16);

    box-shadow:
        18px 0 50px rgba(0, 0, 0, 0.25),
        inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;

    padding: 0.85rem 0.9rem;
    margin-bottom: 1.2rem;

    border-radius: 18px;

    background:
        linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(52, 152, 219, 0.12));

    border:
        1px solid rgba(34, 197, 94, 0.24);

    color: #f8fafc;
    font-weight: 800;
    text-decoration: none;
}

.sidebar-brand-icon {
    font-size: 1.25rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;

    padding: 0.8rem 0.9rem;

    border-radius: 16px;

    background:
        rgba(15, 23, 42, 0.45);

    border:
        1px solid rgba(148, 163, 184, 0.08);

    color: #cbd5e1;
    font-weight: 700;
    text-decoration: none;

    transition:
        transform 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.nav-link:hover {
    transform: translateX(2px);

    background:
        rgba(34, 197, 94, 0.10);

    border-color:
        rgba(34, 197, 94, 0.25);

    box-shadow:
        0 0 18px rgba(34, 197, 94, 0.08);

    text-decoration: none;
}

.nav-link.active {
    color: #f8fafc;

    background:
        linear-gradient(135deg, rgba(34, 197, 94, 0.20), rgba(52, 152, 219, 0.14));

    border-color:
        rgba(34, 197, 94, 0.35);

    box-shadow:
        0 0 18px rgba(34, 197, 94, 0.12);
}

.nav-link.active:hover {
    transform: none;
}

.sidebar-logout {
    margin-top: auto;
}

.logout-button {
    width: 100%;

    background:
        linear-gradient(135deg, rgba(239, 68, 68, 0.85), rgba(190, 18, 60, 0.85));

    border:
        1px solid rgba(248, 113, 113, 0.32);
}


/* =========================
   IMPORT PAGE
========================= */

.import-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 2rem;
}

.import-info h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.import-info p {
    color: #94a3b8;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.import-list {
    list-style: none;
    display: grid;
    gap: 0.8rem;
}

.import-list li {
    padding: 0.9rem 1rem;

    border-radius: 16px;

    background:
        rgba(15, 23, 42, 0.55);

    border:
        1px solid rgba(148, 163, 184, 0.10);

    color: #cbd5e1;
}

.import-card {
    padding: 1.5rem;

    border-radius: 24px;

    background:
        rgba(15, 23, 42, 0.65);

    border:
        1px solid rgba(148, 163, 184, 0.14);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 0.4rem;
}

.upload-subtitle {
    color: #94a3b8;
    font-size: 0.92rem;
}

.alert-success {
    margin-bottom: 1rem;

    padding: 1rem 1.1rem;

    border-radius: 16px;

    background:
        rgba(34, 197, 94, 0.12);

    border:
        1px solid rgba(34, 197, 94, 0.22);

    color: #4ade80;

    font-weight: 700;
}


/* =========================
   ANALYTICS PAGE
========================= */

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
}

.mini-list {
    display: grid;
    gap: 0.65rem;
    margin-top: 1rem;
}

.mini-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0.85rem 1rem;

    border-radius: 16px;

    background:
        rgba(15, 23, 42, 0.55);

    border:
        1px solid rgba(148, 163, 184, 0.10);
}

.mini-list-row span {
    color: #cbd5e1;
    font-weight: 700;
}

.mini-list-row strong {
    color: #22c55e;
    font-size: 1.1rem;
}


/* =========================
   SETTINGS PAGE
========================= */

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
}

.settings-list {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 1rem;

    padding: 1rem 1.1rem;

    border-radius: 18px;

    background:
        rgba(15, 23, 42, 0.55);

    border:
        1px solid rgba(148, 163, 184, 0.10);
}

.settings-label {
    color: #94a3b8;
    font-size: 0.82rem;
    margin-bottom: 0.25rem;
}

.settings-value {
    color: #f8fafc;
    font-weight: 700;
}

.settings-row button {
    background: linear-gradient(
        135deg,
        rgba(35, 90, 75, 0.95) 0%,
        rgba(28, 55, 95, 0.95) 100%
    );

    border: 1px solid rgba(58, 197, 160, 0.35);
}


/* =========================
   ERROR PAGES
========================= */

.error-page {
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--text-main, #f8fafc);
}

body.error-page .error-shell {
    min-height: 100vh;
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 2rem;

    position: relative;
    z-index: 10;
}

body.error-page .error-card {
    width: 100%;
    max-width: 560px;

    padding: 3rem 2.5rem;

    text-align: center;

    background:
        rgba(15, 23, 42, 0.78);

    border:
        1px solid rgba(255, 255, 255, 0.16);

    border-radius: 28px;

    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.42);

    backdrop-filter: blur(22px);
}

body.error-page .error-badge {
    width: 72px;
    height: 72px;

    margin: 0 auto 1.4rem;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 24px;

    font-size: 2rem;
    color: #ffffff;

    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(14, 165, 233, 0.25));

    border:
        1px solid rgba(255, 255, 255, 0.16);
}

body.error-page .error-code {
    font-size: clamp(4rem, 12vw, 7.5rem);
    line-height: 0.9;

    font-weight: 800;

    letter-spacing: -0.08em;

    margin-bottom: 1rem;

    background:
        linear-gradient(135deg, #ffffff, #93c5fd, #a78bfa);

    -webkit-background-clip: text;
    background-clip: text;

    color: transparent;
}

body.error-page .error-title {
    font-size: 1.65rem;
    font-weight: 700;

    margin-bottom: 0.8rem;

    color: #ffffff;
}

body.error-page .error-text {
    max-width: 420px;

    margin: 0 auto 2rem;

    color:
        rgba(226, 232, 240, 0.82);

    line-height: 1.7;
}

body.error-page .error-actions {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

body.error-page .error-actions .btn {
    min-width: 150px;

    padding: 0.8rem 1.1rem;

    border-radius: 999px;

    font-weight: 700;
    text-decoration: none;
}

body.error-page .error-actions .btn-primary {
    color: #ffffff;

    background:
        linear-gradient(135deg, #22c55e, #16a34a);

    box-shadow:
        0 12px 30px rgba(34, 197, 94, 0.22);
}

body.error-page .error-actions .btn-secondary {
    color: #dbeafe;

    background:
        rgba(255, 255, 255, 0.08);

    border:
        1px solid rgba(255, 255, 255, 0.16);
}

body.error-page .error-actions .btn:hover {
    transform: translateY(-1px);
}


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1100px) {
    .public-layout {
        grid-template-columns: 1fr;
        padding: 2rem;
    }

    .brand-panel {
        display: none;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1000px) {
    .import-layout,
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
        flex-direction: column;
    }

    .sidebar-nav {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .sidebar-logout {
        margin-top: 1rem;
    }
}

@media (max-width: 640px) {
    body.error-page .error-card {
        padding: 2.2rem 1.4rem;
        border-radius: 22px;
    }

    body.error-page .error-actions {
        flex-direction: column;
    }

    body.error-page .error-actions .btn {
        width: 100%;
    }
}

.login-hero {
    margin-bottom: 1.4rem;
}

.login-brand-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.login-brand-row h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1;
}

.login-brand-row p {
    margin: 0.3rem 0 0;
}

.login-mini-logo {
    width: 80px;
    height: 80px;
    margin-top: 20px;
    object-fit: contain;
    flex-shrink: 0;

    filter:
        drop-shadow(0 0 6px rgba(56, 189, 248, 0.55))
        drop-shadow(0 0 14px rgba(34, 197, 94, 0.28));
}

.sidebar-logo-link {
    display: block;
    width: 100%;
    padding: 0.4rem 0.6rem 1.2rem;
    margin-bottom: 1.1rem;

    cursor: pointer;
    text-decoration: none;
    background: transparent;
    border: none;
}

.sidebar-logo-link:hover {
    background: transparent;
    transform: none;
}

.sidebar-logo {
    display: block;
    width: 100%;
    max-width: 170px;
    height: auto;
    margin: 0 auto;

    object-fit: contain;

    filter:
        drop-shadow(0 0 10px rgba(56, 189, 248, 0.35))
        drop-shadow(0 0 22px rgba(34, 197, 94, 0.14));
}

.sidebar-logo-divider {
    height: 1px;
    width: 82%;
    margin: 0 auto 1.3rem;

    background: linear-gradient(
        90deg,
        transparent,
        rgba(56, 189, 248, 0.7),
        rgba(34, 197, 94, 0.35),
        transparent
    );

    box-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
}

@media (max-width: 700px) {
    .sidebar-logout {
        display: flex;
        justify-content: center;
    }

    .logout-button {
        width: 280px;
        max-width: 100%;
        padding: 0.85rem 1rem;
    }
}

.upload-dropzone.drag-active {
    border-color: rgba(56, 189, 248, 0.9);

    background:
        linear-gradient(
            135deg,
            rgba(56, 189, 248, 0.12),
            rgba(34, 197, 94, 0.08)
        );

    box-shadow:
        0 0 20px rgba(56, 189, 248, 0.25),
        inset 0 0 20px rgba(56, 189, 248, 0.08);
}

.mapping-top-row {
    display: flex;
    align-items: end;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.mapping-sheet-select {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mapping-sheet-select select {
    width: fit-content;
    min-width: 260px;
    padding-right: 3rem;
}

.mapping-meta {
    margin-bottom: 0.2rem;
    opacity: 0.8;
}