/* =====================================================================
   MainLayout.css — Sidebar, Topbar, Nav styles
   External file เพื่อหลีกเลี่ยง Razor parser issues กับ @media / @keyframes
   ===================================================================== */

/* ═══════════════════════════════════════════════════════════════════════
   SIDEBAR — Dark Redesign + Search + Thin Teal Scrollbar
   ═══════════════════════════════════════════════════════════════════════ */

.cfiq-sidebar {
    width: 228px;
    min-width: 228px;
    height: 100vh;
    background: #0f1f17;
    border-right: none;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* ── Main content ────────────────────────────────────────────────────── */
.cfiq-main {
    flex-grow: 1;
    min-height: 100vh;
    margin-left: 228px;
    min-width: 0;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Logo area ───────────────────────────────────────────────────────── */
.sb-logo-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 14px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.sb-logo-box {
    width: 32px;
    height: 32px;
    background: rgba(93,202,165,0.15);
    border: 1px solid rgba(93,202,165,0.3);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #5DCAA5;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}
.sb-brand-name { font-size: 15px; font-weight: 800; color: #fff; line-height: 1; }
.sb-brand-sub  { font-size: 10px; color: rgba(255,255,255,0.35); margin-top: 1px; }

/* ── Search bar ──────────────────────────────────────────────────────── */
.sb-search-wrap {
    position: relative;
    padding: 10px 10px 6px;
    flex-shrink: 0;
}
.sb-search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-25%);
    color: rgba(255,255,255,0.3);
    pointer-events: none;
    display: flex;
    align-items: center;
}
.sb-search-input {
    width: 100%;
    padding: 7px 28px 7px 32px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 12px;
    color: rgba(255,255,255,0.85);
    font-family: 'Sarabun', sans-serif;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, background 0.15s;
}
.sb-search-input::placeholder { color: rgba(255,255,255,0.3); }
.sb-search-input:focus {
    border-color: rgba(93,202,165,0.5);
    background: rgba(255,255,255,0.1);
}
.sb-search-clear {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-25%);
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    cursor: pointer;
    font-size: 11px;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.12s;
}
.sb-search-clear:hover { color: rgba(255,255,255,0.7); }

/* ── Nav list (scrollable + thin teal scrollbar) ─────────────────────── */
.sb-nav-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overscroll-behavior: contain;
    /* Thin teal scrollbar — Firefox */
    scrollbar-width: thin;
    scrollbar-color: rgba(93,202,165,0.4) transparent;
}
/* Thin teal scrollbar — Chrome/Safari */
.sb-nav-list::-webkit-scrollbar        { width: 3px; }
.sb-nav-list::-webkit-scrollbar-track  { background: transparent; }
.sb-nav-list::-webkit-scrollbar-thumb  { background: rgba(93,202,165,0.35); border-radius: 3px; }
.sb-nav-list::-webkit-scrollbar-thumb:hover { background: rgba(93,202,165,0.65); }

/* Section labels & dividers */
.sb-section-label {
    font-size: 9.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.28);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 4px 10px 3px;
    margin-top: 2px;
}
.sb-section-divider {
    height: 1px;
    background: rgba(255,255,255,0.07);
    margin: 4px 10px;
}
.sb-no-result {
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    text-align: center;
    padding: 20px 10px;
}

/* Nav link */
.sb-nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 8px;
    border-radius: 7px;
    font-size: 13px;
    color: rgba(255,255,255,0.58);
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    cursor: pointer;
    font-family: 'Sarabun', sans-serif;
    white-space: nowrap;
    min-height: 36px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.sb-nav-link:hover {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.9);
    text-decoration: none;
}
.sb-nav-link.sb-active {
    background: rgba(93,202,165,0.14);
    color: #5DCAA5;
    font-weight: 600;
}
.sb-icon-wrap {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    transition: background 0.12s;
}
.sb-nav-link.sb-active .sb-icon-wrap {
    background: rgba(93,202,165,0.18);
}
.sb-link-text { font-size: 13px; }

/* ── Footer ──────────────────────────────────────────────────────────── */
.sb-footer {
    flex-shrink: 0;
    padding: 8px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

/* Plan row */
.sb-plan-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: rgba(93,202,165,0.08);
    border: 1px solid rgba(93,202,165,0.2);
    border-radius: 7px;
}
.sb-plan-name  { font-size: 11px; font-weight: 700; color: #5DCAA5; }
.sb-trial-days { font-size: 10px; color: rgba(255,255,255,0.35); }

/* User card */
.sb-user-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    margin-bottom: 6px;
}
.sb-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #5DCAA5;
    color: #0f1f17;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sb-user-role { font-size: 10px; color: rgba(255,255,255,0.35); margin-top: 1px; }
.sb-user-menu-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    cursor: pointer;
    padding: 4px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.12s, background 0.12s;
}
.sb-user-menu-btn:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.08); }

/* Logout button */
.sb-logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px;
    background: rgba(255,255,255,0.04);
    border: none;
    border-radius: 7px;
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    cursor: pointer;
    font-family: 'Sarabun', sans-serif;
    transition: background 0.12s, color 0.12s;
}
.sb-logout-btn:hover {
    background: rgba(239,68,68,0.12);
    color: #fca5a5;
}

/* ── Mobile (max 1099px) ─────────────────────────────────────────────── */
@media (max-width: 1099.98px) {
    .cfiq-sidebar {
        transform: translateX(-100%);
        box-shadow: none;
        pointer-events: none;
    }
    .cfiq-sidebar.cfiq-sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.4);
        pointer-events: auto;
    }
    .cfiq-main {
        margin-left: 0 !important;
    }
    .cfiq-topbar { display: flex !important; }
}

/* ── Top bar ─────────────────────────────────────────────────────────── */
.cfiq-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    background: #fff;
    border-bottom: 1px solid #e8edf2;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    flex-shrink: 0;
}

/* ── Overlay ─────────────────────────────────────────────────────────── */
.cfiq-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1039;
    animation: cfiq-fadeIn 0.2s ease;
    touch-action: manipulation;
}
@keyframes cfiq-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.cfiq-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #475569;
    transition: background 0.15s;
    padding: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.cfiq-hamburger:hover { background: #f4f6fb; }

.cfiq-topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #0f6e56;
    color: white;
    font-size: 13px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    margin-left: auto;
}

.cfiq-close-btn {
    background: rgba(255,255,255,0.08);
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 16px;
    color: rgba(255,255,255,0.5);
    transition: color 0.12s, background 0.12s;
}
.cfiq-close-btn:hover { color: #fff; background: rgba(255,255,255,0.15); }

/* ── Banners ─────────────────────────────────────────────────────────── */
.cfiq-banner { border-bottom: 1px solid transparent; font-family: 'Sarabun', sans-serif; flex-wrap: wrap; gap: 8px; }
.cfiq-banner-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.cfiq-banner-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.cfiq-banner-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.cfiq-banner-btn         { background: #0f6e56; color: white !important; border: none; border-radius: 6px; font-size: 12px; font-weight: 600; padding: 4px 14px; white-space: nowrap; }
.cfiq-banner-btn:hover   { background: #0a5741; }
.cfiq-banner-btn-outline { background: transparent; color: #1e40af !important; border: 1px solid #93c5fd; border-radius: 6px; font-size: 12px; font-weight: 600; padding: 4px 14px; white-space: nowrap; }
.cfiq-banner-btn-outline:hover { background: #dbeafe; }

/* ── Plan badges (backward compat) ──────────────────────────────────── */
.cfiq-plan-badge   { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 100px; letter-spacing: 0.3px; }
.plan-free         { background: #f1f5f9; color: #475569; }
.plan-starter      { background: #f0fdf4; color: #15803d; }
.plan-business     { background: #e0f5ef; color: #0f6e56; }
.plan-professional { background: #ede9fe; color: #6d28d9; }
.plan-enterprise   { background: #fef3c7; color: #92400e; }

/* ── Legacy nav classes (ไม่ได้ใช้แล้ว แต่คงไว้เผื่อ page อื่น ref) ── */
.cfiq-nav-list { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.cfiq-nav      { color: #64748b; font-size: 13px; font-weight: 500; text-decoration: none; display: flex; align-items: center; gap: 8px; transition: all 0.15s; min-height: 44px; }
.cfiq-nav:hover  { background: #f0faf8 !important; color: #0f6e56 !important; }
.cfiq-active     { background: #e1f5ee !important; color: #0f6e56 !important; font-weight: 600; }
.cfiq-section-label { font-size: 10px; font-weight: 700; color: #b0bec5; letter-spacing: 0.8px; text-transform: uppercase; }
.nav-icon { font-size: 14px; }

/* ─ Reconcile dot indicator (Transactions table) ──────────────────── */
.recon-dot {
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: help;
}
.recon-dot:hover {
    transform: scale(1.6);
}
.recon-confirmed {
    box-shadow: 0 0 0 2px rgba(15,110,86,0.2);
}
.recon-matched {
    box-shadow: 0 0 0 2px rgba(245,158,11,0.2);
}

/* =====================================================================
   Version Badge (Sidebar Footer)
   ===================================================================== */
.sb-version {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.4) !important;
    font-size: 10.5px;
    font-weight: 500;
    text-decoration: none !important;
    letter-spacing: 0.2px;
    transition: all .15s ease;
    cursor: pointer;
}
.sb-version:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.75) !important;
}
.sb-version-num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}
.sb-version-pre {
    background: rgba(251, 191, 36, 0.18);
    color: #fbbf24;
    font-size: 8.5px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.6px;
    line-height: 1;
    text-transform: uppercase;
}
