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

:root {
    --bs-body-font-family: 'Nunito', 'Pretendard Variable', Pretendard, sans-serif;

    /* Premium Light Mode Palette - Refined Emerald */
    --platform-bg: #f8fafc;
    --platform-surface: #ffffff;
    --platform-primary: #059669;
    --platform-primary-soft: #f0fdf4;
    --platform-border: #e2e8f0;
    --platform-text-main: #4b5563;
    --platform-text-muted: #94a3b8;
    --platform-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.06);
    --platform-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* --- Style 14: Deep Emerald Flow --- */
    --platform-sidebar-bg: linear-gradient(180deg, #065f46 0%, #065f46 40%, rgba(255, 255, 255, 0.95) 100%);
    --platform-header-bg: linear-gradient(90deg, #065f46 0%, #065f46 20%, #ffffff 100%);
    --platform-sidebar-text: rgba(255, 255, 255, 0.9);
    --platform-sidebar-active-bg: rgba(255, 255, 255, 0.12);
    --platform-sidebar-active-text: #ffffff;
    --platform-gradient-emerald: linear-gradient(135deg, #064e3b 0%, #059669 100%);
}

body {
    font-family: var(--bs-body-font-family);
    font-size: 0.95rem;
    letter-spacing: normal;
    font-weight: 400;
    background: #edf2ed;
    color: var(--platform-text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

[data-bs-theme="dark"] {
    --platform-bg: #0f172a;
    --platform-surface: #1e293b;
    --platform-primary: #10b981;
    --platform-primary-soft: rgba(16, 185, 129, 0.1);
    --platform-border: #334155;
    --platform-text-main: #f1f5f9;
    --platform-text-muted: #cbd5e1;

    --platform-sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    --platform-header-bg: linear-gradient(90deg, #0f172a 0%, #1e293b 40%, #0f172a 100%);
    --platform-sidebar-text: rgba(248, 250, 252, 0.8);
    --platform-sidebar-active-bg: rgba(248, 250, 252, 0.1);
}

[data-bs-theme="dark"] body {
    background: #0f172a;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700 !important;
    color: var(--platform-text-main) !important;
}

/* Sidebar Styling */
#sidebarMenu {
    min-height: 100vh;
    background: var(--platform-sidebar-bg) !important;
    border-right: 1px solid var(--platform-border) !important;
    z-index: 1000;
    transition: transform 0.4s ease;
}

.sidebar .nav-link {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--platform-sidebar-text);
    padding: 0.7rem 0.8rem;
    border-radius: 0.75rem;
    margin: 0.2rem 0.8rem 0.2rem 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    word-break: keep-all;
    line-height: 1.4;
}

.sidebar .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    color: #ffffff !important;
    background-color: var(--platform-sidebar-active-bg) !important;
    font-weight: 600;
}

.sidebar .nav-link i,
.sidebar .nav-link .bi {
    margin-right: 10px;
    font-size: 1.1rem;
}

/* Sidebar Toggle Label */
/* Sidebar Toggle Label */
.sidebar-label-trigger {
    position: absolute;
    right: -24px;
    top: 68px;
    width: 24px;
    height: 38px;
    background: #065f46;
    border: none;
    border-radius: 0 8px 8px 0;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1100;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 0;
    text-decoration: none;
}

[data-bs-theme="dark"] .sidebar-label-trigger {
    background: rgba(132, 204, 22, 0.25);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(132, 204, 22, 0.4);
    color: #d9f99d;
}

@media (max-width: 767.98px) {
    .sidebar-label-trigger {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .sidebar-label-trigger {
        display: none;
    }
}

.sidebar-collapsed #sidebarMenu {
    transform: translateX(-100%);
}



.sidebar-collapsed .sidebar-label-trigger i {
    transform: rotate(180deg);
}

/* Main Content */
.main-content-island {
    background-color: #ffffff;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    margin: 1.5rem;
    padding: 2rem;
    min-height: calc(100vh - 120px);
}

[data-bs-theme="dark"] .main-content-island {
    background-color: #1e293b;
}

main {
    transition: margin-left 0.4s ease;
}

.sidebar-collapsed main {
    margin-left: 0 !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
}

@media (min-width: 992px) {
    .sidebar {
        width: 200px !important;
        flex: 0 0 200px !important;
        max-width: 200px !important;
    }

    main {
        width: calc(100% - 200px) !important;
        flex: 0 0 calc(100% - 200px) !important;
        max-width: calc(100% - 200px) !important;
    }
}

/* Cards & Buttons */
.card-header-theme {
    background: var(--platform-gradient-emerald) !important;
    color: #ffffff !important;
    padding: 1.5rem;
}

.card-header-theme h1,
.card-header-theme h2,
.card-header-theme h3 {
    color: #ffffff !important;
}

.btn-primary {
    background: var(--platform-gradient-emerald);
    border: none;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

/* Navbar */
.navbar {
    background: var(--platform-header-bg) !important;
    height: 64px;
}

.navbar-brand {
    color: #ffffff !important;
    font-weight: 700;
}

/* Header Text/Icons when crossing to white area */
.navbar .nav-link {
    color: #ffffff !important;
}

#navbarContent .nav-link,
#navbarContent .nav-link i,
#navbarContent .nav-link .bi {
    color: var(--platform-text-main) !important;
    /* Right side text/icons in white area */
}

/* But if top-level links are forced */
.navbar .bi,
.navbar i {
    color: #ffffff !important;
}

/* Override for right side specifically */
#navbarContent .bi,
#navbarContent i {
    color: var(--platform-text-main) !important;
}

/* Footer */
.footer {
    background-color: #ffffff;
    border-top: 1px solid var(--platform-border);
    padding: 2rem 0;
    transition: margin-left 0.4s ease;
}

[data-bs-theme="dark"] .footer {
    background-color: #1e293b;
}

.sidebar-collapsed .footer {
    margin-left: 0 !important;
}

/* Hero Buttons (Modern Card Style) */
.hero-btn {
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 130px;
    height: 105px;
    padding: 1.25rem !important;
    gap: 0.5rem;
    background: #ffffff !important;
    border: 1px solid var(--platform-border) !important;
    border-radius: 1.25rem !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03) !important;
    text-decoration: none !important;
}

.hero-btn:hover {
    transform: translateY(-5px);
    border-color: #065f46 !important;
    box-shadow: 0 10px 20px rgba(6, 95, 70, 0.08) !important;
}

.hero-btn i,
.hero-btn .bi {
    font-size: 1.8rem !important;
    color: #065f46 !important;
    margin: 0 !important;
}

.hero-btn span {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--platform-text-main) !important;
}

[data-bs-theme="dark"] .hero-btn {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .hero-btn:hover {
    background: #334155 !important;
    border-color: #34d399 !important;
}

[data-bs-theme="dark"] .hero-btn i,
[data-bs-theme="dark"] .hero-btn .bi {
    color: #34d399 !important;
}

/* Specific accent for Admin button */
.hero-btn-admin:hover {
    border-color: #f59e0b !important;
    box-shadow: 0 10px 20px rgba(245, 158, 11, 0.1) !important;
}

/* Analysis Mode Cards */
.analysis-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--platform-border) !important;
    background: #ffffff !important;
    border-radius: 1.25rem !important;
    overflow: hidden;
}

.analysis-card:hover {
    transform: translateY(-5px);
    border-color: var(--platform-primary) !important;
    box-shadow: 0 10px 20px rgba(5, 150, 105, 0.1) !important;
}

.analysis-card.active {
    border-color: var(--platform-primary) !important;
    background: var(--platform-primary-soft) !important;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1) inset !important;
}

[data-bs-theme="dark"] .analysis-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .analysis-card .fw-bold {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .analysis-card .text-muted {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .analysis-card.active {
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: var(--platform-primary) !important;
}

[data-bs-theme="dark"] .analysis-card.active .fw-bold {
    color: var(--platform-primary) !important;
}

/* Premium Loading Overlay */
#loadingIndicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

[data-bs-theme="dark"] #loadingIndicator {
    background: rgba(15, 23, 42, 0.95);
}

.scanner-box {
    width: 200px;
    height: 150px;
    border: 2px solid var(--platform-primary);
    border-radius: 1rem;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.scanner-line {
    width: 100%;
    height: 2px;
    background: var(--platform-primary);
    position: absolute;
    top: 0;
    box-shadow: 0 0 15px var(--platform-primary);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% {
        top: 0;
    }

    50% {
        top: 100%;
    }

    100% {
        top: 0;
    }
}

.processing-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--platform-primary);
    letter-spacing: 1px;
}

/* Typography Adjustments for Softer Feel */
.fw-bold {
    font-weight: 700 !important;
}

strong,
b {
    font-weight: 700;
}

/* --- Global Premium Table Themes --- */
.table-emerald {
    color: #1b5e20 !important;
    border-top: 1px solid #198754;
}

.table-emerald th {
    background: #e8f5e9 !important;
    color: #1b5e20 !important;
    font-weight: 700 !important;
    padding: 1rem 0.5rem !important;
    border-bottom: 2px solid #198754 !important;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table-hover tbody tr {
    transition: all 0.2s ease;
    --bs-table-hover-bg: rgba(69, 133, 86, 0.03);
    --bs-table-hover-color: #1e293b;
}

.table-hover tbody tr:hover {
    background-color: rgba(69, 133, 86, 0.03) !important;
    transform: scale(1.002);
    box-shadow: 0 2px 8px rgba(34, 139, 34, 0.06);
}

.table-hover tbody tr:hover>td,
.table-hover tbody tr:hover>th {
    background-color: rgba(69, 133, 86, 0.03) !important;
    color: #1e293b !important;
}

.table-sm td,
.table-sm th {
    padding: 0.6rem 1rem !important;
}

/* --- Dynamic Table Header Theme (Light/Dark) --- */
.premium-header {
    background-color: #e8f5e9 !important;
    color: #1b5e20 !important;
    border-bottom: 2px solid #198754 !important;
    white-space: nowrap !important;
    text-align: center !important;
    vertical-align: middle !important;
    font-weight: 700 !important;
}

[data-bs-theme="dark"] .premium-header {
    background-color: #15803d !important;
    color: #e2e8f0 !important;
    border-bottom: 2px solid #166534 !important;
}

/* Table Hover Text Visibility Fix for Dark Mode */
[data-bs-theme="dark"] .table-hover tbody tr:hover>td,
[data-bs-theme="dark"] .table-hover tbody tr:hover>th {
    color: #e2e8f0 !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Markdown Dark Mode Support */
[data-bs-theme="dark"] .markdown-body {
    color-scheme: dark;
    --color-canvas-default: transparent;
    --color-fg-default: #e6edf3;
    --color-border-default: #30363d;
    --color-canvas-subtle: #161b22;
    color: #e6edf3 !important;
    background-color: transparent !important;
}

[data-bs-theme="dark"] .markdown-body p,
[data-bs-theme="dark"] .markdown-body span,
[data-bs-theme="dark"] .markdown-body div,
[data-bs-theme="dark"] .markdown-body h1,
[data-bs-theme="dark"] .markdown-body h2,
[data-bs-theme="dark"] .markdown-body h3,
[data-bs-theme="dark"] .markdown-body h4,
[data-bs-theme="dark"] .markdown-body h5,
[data-bs-theme="dark"] .markdown-body h6,
[data-bs-theme="dark"] .markdown-body strong,
[data-bs-theme="dark"] .markdown-body b,
[data-bs-theme="dark"] .markdown-body em,
[data-bs-theme="dark"] .markdown-body ul,
[data-bs-theme="dark"] .markdown-body ol,
[data-bs-theme="dark"] .markdown-body li,
[data-bs-theme="dark"] .markdown-body table,
[data-bs-theme="dark"] .markdown-body th,
[data-bs-theme="dark"] .markdown-body td {
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .markdown-body table,
[data-bs-theme="dark"] .markdown-body thead,
[data-bs-theme="dark"] .markdown-body tbody,
[data-bs-theme="dark"] .markdown-body th,
[data-bs-theme="dark"] .markdown-body td,
[data-bs-theme="dark"] .markdown-body tr {
    background-color: transparent !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

/* --- Gold Theme for Admin Pages (Vibrant Gold) --- */
body.theme-gold {
    /* Gold Theme Variables */
    --platform-primary: #b38f1d;
    --platform-primary-soft: #fffdf5;
    --platform-border: #ffd700;
}

/* Force Header Style on Admin Pages */
body.theme-gold .navbar {
    background: linear-gradient(90deg, #b8860b 0%, #daa520 100%) !important;
    border-bottom: 3px solid #ffe66d !important;
}

body.theme-gold .navbar .navbar-brand {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    font-weight: 800;
}

/* Force Sidebar Style on Admin Pages - EXPLICIT GRADIENT */
body.theme-gold #sidebarMenu {
    background: linear-gradient(180deg, #b8860b 0%, #8b6508 100%) !important;
    border-right: 3px solid #b8860b !important;
}

body.theme-gold .sidebar .nav-link {
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 600;
}

body.theme-gold .sidebar .nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
}

body.theme-gold .sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%) !important;
    color: #ffffff !important;
    border-left: 5px solid #fff !important;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Sidebar Toggle Button in Gold Theme */
body.theme-gold .sidebar-label-trigger {
    background: #b8860b !important;
    color: #ffffff !important;
    border: 1px solid #ecc94b !important;
}

/* Dark Mode Overrides for Gold Theme - Keep Gold Backgrounds */
[data-bs-theme="dark"] body.theme-gold #sidebarMenu {
    background: linear-gradient(180deg, #8b6508 0%, #5c4305 100%) !important;
    border-right: 3px solid #b8860b !important;
}

[data-bs-theme="dark"] body.theme-gold .navbar {
    background: linear-gradient(90deg, #8b6508 0%, #b8860b 100%) !important;
}