/* ============================================================
   ROYAL TOURISM NETWORK – Light Theme Stylesheet
   ============================================================ */

/* ── Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    background: #f1f5f9;
    color: #1e293b;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
}

/* ── Auth pages ────────────────────────────────────────────── */
.auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #e0f2fe 0%, #f0fdf4 50%, #fef9c3 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-wrapper { width: 100%; display: flex; justify-content: center; }

.auth-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 36px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 40px rgba(0,0,0,.10);
}

.auth-logo { text-align: center; margin-bottom: 28px; }

/* Auth form – override dark inputs */
.auth-card .form-label.text-light   { color: #374151 !important; }
.auth-card .text-secondary          { color: #6b7280 !important; }
.auth-card h4.text-white            { color: #1e293b !important; }
.auth-card small.text-warning       { color: #b45309 !important; }
.auth-card small.text-danger        { color: #dc2626 !important; }
.auth-card i.text-warning           { color: #f59e0b !important; }
.auth-card i.text-danger            { color: #ef4444 !important; }
.auth-card .form-control.bg-dark {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}
.auth-card .form-control.bg-dark::placeholder { color: #94a3b8; }
.auth-card .form-control.bg-dark:focus {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245,158,11,.18) !important;
    background: #ffffff !important;
}
.auth-card .input-group-text.bg-dark {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #64748b !important;
}
.auth-card .btn-outline-secondary { border-color: #cbd5e1; color: #64748b; }

/* ── App Layout ─────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar  (stays dark for contrast) ─────────────────────── */
.sidebar {
    width: 230px;
    min-width: 230px;
    background: #1e293b;
    border-right: 1px solid #334155;
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: hidden;
}

.logo {
    width: 100%;
}
.logo img {
    width: 100px;
    margin: 10px 0px;
    border-radius: 5px;
}


.sidebar-brand { padding-bottom: 12px; border-bottom: 1px solid #334155; }

.sidebar .text-white    { color: #f1f5f9 !important; }
.sidebar .text-warning  { color: #fbbf24 !important; }
.sidebar .text-secondary{ color: #94a3b8 !important; }
.sidebar .text-danger   { color: #f87171 !important; }
.sidebar .border-secondary { border-color: #334155 !important; }

.sidebar .nav-link {
    color: #94a3b8;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    transition: .15s;
}
.sidebar .nav-link:hover  { background: #334155; color: #f1f5f9; }
.sidebar .nav-link.active { background: #f59e0b; color: #1e293b; font-weight: 600; }
.sidebar .nav-link.text-danger:hover { background: rgba(239,68,68,.15); color: #f87171; }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 24px;
    overflow-x: hidden;
    background: #f1f5f9;
}

.topbar {
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

/* Topbar text fix */
.topbar h5,
.topbar h5.text-white { color: #1e293b !important; }
.topbar .text-secondary { color: #64748b !important; }

@media (max-width: 768px) {
    .topbar {
        margin-left: 35px;
    }
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.stat-card {
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

.stat-card--green  { background: linear-gradient(135deg,#d1fae5,#a7f3d0); border-color:#6ee7b7; }
.stat-card--blue   { background: linear-gradient(135deg,#dbeafe,#bfdbfe); border-color:#93c5fd; }
.stat-card--orange { background: linear-gradient(135deg,#ffedd5,#fed7aa); border-color:#fdba74; }
.stat-card--purple { background: linear-gradient(135deg,#ede9fe,#ddd6fe); border-color:#c4b5fd; }
.stat-card--red    { background: linear-gradient(135deg,#fee2e2,#fecaca); border-color:#fca5a5; }
.stat-card--warning{ background: linear-gradient(135deg,#fef3c7,#fde68a); border-color:#fcd34d; }

.stat-card .stat-icon {
    font-size: 2rem;
    opacity: .2;
    position: absolute;
    top: 16px;
    right: 16px;
    color: #0f172a;
}
.stat-card .stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 6px;
    font-weight: 600;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; }

.stat-card--green  .stat-value, .stat-card--green  .stat-label  { color: #065f46 !important; }
.stat-card--blue   .stat-value, .stat-card--blue   .stat-label  { color: #1e3a8a !important; }
.stat-card--orange .stat-value, .stat-card--orange .stat-label  { color: #7c2d12 !important; }
.stat-card--purple .stat-value, .stat-card--purple .stat-label  { color: #4c1d95 !important; }
.stat-card--red    .stat-value, .stat-card--red    .stat-label  { color: #7f1d1d !important; }
.stat-card--warning .stat-value,.stat-card--warning .stat-label { color: #78350f !important; }

/* ── RTN Card ───────────────────────────────────────────────── */
.rtn-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.rtn-card-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.rtn-card-body { padding: 20px; }


/* ── Tables – light override ─────────────────────────────────── */
.table-dark {
    --bs-table-bg: #ffffff;
    --bs-table-color: #1e293b;
    --bs-table-border-color: #e2e8f0;
    --bs-table-hover-bg: #f0f9ff;
    --bs-table-striped-bg: #f8fafc;
    color: #1e293b !important;
    background: #ffffff;
}

.table-dark thead th {
    background: #f1f5f9 !important;
    color: #475569 !important;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-color: #e2e8f0 !important;
}

.table-dark td, .table-dark th {
    border-color: #e2e8f0 !important;
    vertical-align: middle;
    color: #1e293b !important;
    background: transparent;
}

.table-dark tbody tr:hover { background: #f0f9ff !important; }

/* Coloured text inside tables – light-friendly */
.table-dark .text-warning   { color: #b45309 !important; }
.table-dark .text-success   { color: #15803d !important; }
.table-dark .text-danger    { color: #dc2626 !important; }
.table-dark .text-info      { color: #0369a1 !important; }
.table-dark .text-secondary { color: #64748b !important; }
.table-dark .text-white     { color: #0f172a !important; }
.table-dark .text-light     { color: #374151 !important; }
.table-dark .fw-bold        { color: #0f172a !important; }
.table-dark code            { color: #b45309 !important; background: #fef3c7; padding: 1px 5px; border-radius: 4px; }

/* table-warning override for total rows */
.table-warning { --bs-table-bg: #fef3c7 !important; color: #78350f !important; }
.table-warning td, .table-warning th { color: #78350f !important; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-control.bg-dark, .form-select.bg-dark {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}
.form-control.bg-dark:focus, .form-select.bg-dark:focus {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245,158,11,.18) !important;
    background: #ffffff !important;
}
.form-control.bg-dark::placeholder { color: #94a3b8; }
.form-label.text-light   { color: #374151 !important; }
.form-label.text-secondary { color: #64748b !important; }
.input-group-text.bg-dark {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #64748b !important;
}

/* ── Pagination ─────────────────────────────────────────────── */
.page-link { background: #ffffff; border-color: #e2e8f0; color: #475569; }
.page-link:hover { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.page-item.active .page-link { background: #f59e0b; border-color: #f59e0b; color: #fff; }

/* ── Badges / Buttons ───────────────────────────────────────── */
.btn-warning        { color: #fff; background-color: #f59e0b; border-color: #f59e0b; }
.btn-warning:hover  { background-color: #d97706; border-color: #d97706; color: #fff; }
.btn-xs { font-size: 11px; padding: 2px 6px; border-radius: 4px; }

/* ── Tooltip ────────────────────────────────────────────────── */
.rtn-tooltip {
    position: fixed;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    min-width: 150px;
    color: #1e293b;
}

.rtn-tooltip .text-warning { color: #b45309 !important; }
.rtn-tooltip .text-light   { color: #374151 !important; }
.rtn-tooltip .text-secondary { color: #64748b !important; }
.rtn-tooltip .text-info    { color: #0369a1 !important; }

/* ── Progress ───────────────────────────────────────────────── */
.progress { background: #e2e8f0; }
.progress-bar.bg-warning { background-color: #f59e0b !important; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert { border-radius: 10px; }
.alert-success { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.alert-info    { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.alert .btn-close { filter: none; }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-content.bg-dark {
    background: #ffffff !important;
    color: #1e293b;
    border-color: #e2e8f0;
}
.modal-content.bg-dark .modal-header  { border-color: #e2e8f0 !important; }
.modal-content.bg-dark .modal-footer  { border-color: #e2e8f0 !important; }
.modal-content.bg-dark .modal-title.text-white { color: #1e293b !important; }
.modal-content.bg-dark .text-secondary { color: #64748b !important; }
.modal-content.bg-dark .form-control.bg-dark {
    background: #f8fafc !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}
.modal-content.bg-dark textarea { color: #1e293b !important; }
.modal-content.bg-dark .btn-close-white { filter: invert(1); }

/* ── Global text class overrides for light bg ───────────────── */
/* (Only apply outside sidebar) */
.main-content .text-white,
.auth-card    .text-white,
.rtn-card     .text-white  { color: #1e293b !important; }

.main-content .text-light  { color: #374151 !important; }
.main-content .border-secondary { border-color: #e2e8f0 !important; }

/* ── Tree viewer ────────────────────────────────────────────── */
#tree-container { background: #f8fafc !important; border-radius: 8px; }

.tree-node-box {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.07);
}
.tree-node-box:hover   { border-color: #f59e0b !important; background: #fffbeb !important; }
.tree-node-box.active-node   { border-color: #22c55e !important; }
.tree-node-box.inactive-node { border-color: #ef4444 !important; opacity: .8; }
.node-username  { color: #b45309   !important; }
.node-name      { color: #475569   !important; }
.node-counts    { color: #0369a1   !important; }
.plan-badge     { background: #7c3aed !important; color: #fff !important; }
.empty-slot     { background: #f8fafc !important; border-color: #cbd5e1 !important; color: #94a3b8 !important; }
.tree-connector::before { background: #cbd5e1 !important; }
.tree-children::before  { background: #cbd5e1 !important; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -230px;
        z-index: 1050;
        transition: left .3s;
    }
    .sidebar.open { left: 0; }
    .main-content { padding: 16px; }
    .stat-value   { font-size: 1.4rem !important; }
}
