/* ============================================================
   XenosHMS — Sales Report Analyzer
   Stylesheet
   ============================================================ */

/* ===== BASE ===== */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f1f5f9;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== TABS ===== */
.tab-btn {
    padding: 8px 18px;
    border-bottom: 2px solid transparent;
    font-size: 13.5px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.tab-btn:hover {
    color: #1e40af;
    background: #eff6ff;
    border-radius: 6px 6px 0 0;
}
.tab-btn.active {
    color: #1e40af;
    border-bottom-color: #2563eb;
    font-weight: 600;
}

/* ===== TOP NAV — icon-only with hover tooltip (desktop header) =====
   Colorful rounded badge per tab: soft-tinted background + colored icon by
   default, solid fill + white icon when active, lift+glow on hover. Each
   tab's palette is set via CSS variables on its own #tab-btn-* id so the
   badge/hover/active rules below stay written once and just read var(). */
#tab-btn-dashboard      { --tab-soft: #eff6ff; --tab-solid: #2563eb; --tab-color: #2563eb; }
#tab-btn-frontdesk      { --tab-soft: #fff1f2; --tab-solid: #e11d48; --tab-color: #e11d48; }
#tab-btn-housekeeping   { --tab-soft: #fdf4ff; --tab-solid: #c026d3; --tab-color: #c026d3; }
#tab-btn-pos            { --tab-soft: #fffbeb; --tab-solid: #d97706; --tab-color: #d97706; }
#tab-btn-logistic       { --tab-soft: #ecfeff; --tab-solid: #0891b2; --tab-color: #0891b2; }
#tab-btn-accounting     { --tab-soft: #ecfdf5; --tab-solid: #059669; --tab-color: #059669; }
#tab-btn-website        { --tab-soft: #f5f3ff; --tab-solid: #7c3aed; --tab-color: #7c3aed; }
#tab-btn-booking-engine { --tab-soft: #f0fdfa; --tab-solid: #0d9488; --tab-color: #0d9488; }
#tab-btn-crm            { --tab-soft: #fff7ed; --tab-solid: #ea580c; --tab-color: #ea580c; }
#tab-btn-budgeting      { --tab-soft: #eef2ff; --tab-solid: #4f46e5; --tab-color: #4f46e5; }

#topbar-tabs .tab-btn {
    position: relative;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 4px 10px 6px;
    --tab-soft: #f1f5f9;
    --tab-solid: #475569;
    --tab-color: #475569;
}
#topbar-tabs .tab-btn > i:first-child {
    width: 36px;
    height: 36px;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--tab-soft);
    color: var(--tab-color);
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
#topbar-tabs .tab-btn:hover > i:first-child {
    transform: translateY(-2px) scale(1.07);
    box-shadow: 0 8px 16px -6px color-mix(in srgb, var(--tab-solid) 55%, transparent);
}
#topbar-tabs .tab-btn.active > i:first-child {
    background: var(--tab-solid);
    color: #fff;
    box-shadow: 0 6px 14px -4px color-mix(in srgb, var(--tab-solid) 60%, transparent);
}
#topbar-tabs .tab-btn:hover {
    background: transparent; /* override generic .tab-btn:hover pill-strip, badge itself carries the hover feedback now */
}
#topbar-tabs .tab-btn.active {
    border-bottom-color: transparent; /* badge fill already communicates the active state */
}
#topbar-tabs .tab-btn .tab-label {
    display: none;
}
#topbar-tabs .tab-btn .ph-caret-down {
    position: absolute;
    bottom: 3px;
    right: 2px;
    font-size: 8px;
    color: #94a3b8;
}
#topbar-tabs .tab-btn::after {
    content: attr(data-tip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    background: #1e293b;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 9px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 50;
}
#topbar-tabs .tab-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(6px);
}

/* ===== EXCEL TABLE ===== */
.excel-wrap {
    overflow: auto;
    flex: 1;
}
.excel-table {
    border-collapse: collapse;
    font-size: 12.5px;
    min-width: max-content;
    width: 100%;
}

/* Table header */
.excel-table thead th {
    background: #c6d0e2;
    border: 1px solid #94a3b8;
    padding: 8px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: sticky;
    top: 0;
    z-index: 10;
}
.excel-table thead th:hover { background: #b0bed6; }
.excel-table thead th.sort-asc::after  { content: ' ▲'; font-size: 9px; color: #1d4ed8; }
.excel-table thead th.sort-desc::after { content: ' ▼'; font-size: 9px; color: #1d4ed8; }
.excel-table thead th.sorted { background: #a8b9d0; }

/* Table body */
.excel-table tbody td {
    border: 1px solid #e2e8f0;
    padding: 6px 14px;
    color: #1f2937;
    white-space: nowrap;
}
.excel-table tbody tr:nth-child(even) td { background: #f8fafc; }
.excel-table tbody tr:nth-child(odd)  td { background: #ffffff; }
.excel-table tbody tr:hover td { background: #dbeafe !important; }

/* Row number column */
.excel-table .rn {
    background: #e8ecf4 !important;
    color: #94a3b8;
    text-align: center !important;
    font-size: 11px;
    border-right: 2px solid #94a3b8 !important;
    min-width: 44px;
    position: sticky;
    left: 0;
    z-index: 5;
}
.excel-table thead th.rn {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 20;
    cursor: default;
    text-align: center;
}
.excel-table tbody tr:hover .rn { background: #bfdbfe !important; }

/* Total (footer) row */
.excel-table tfoot td {
    border: 1px solid #d1d5db;
    padding: 7px 14px;
    background: #fefce8 !important;
    font-weight: 700;
    border-top: 2px solid #ca8a04 !important;
    color: #1c1917;
    white-space: nowrap;
}
.excel-table tfoot td.rn { background: #fef9c3 !important; }
.excel-table tfoot {
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* Column alignment helpers */
.col-right  { text-align: right !important; }
.col-center { text-align: center !important; }
.col-mono   { font-variant-numeric: tabular-nums; }

/* ===== SOURCE BADGES ===== */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 500;
}

/* ===== PAGINATION ===== */
.pg-btn {
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.1s;
    padding: 0 8px;
}
.pg-btn:hover:not(:disabled) {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}
.pg-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
    font-weight: 600;
}
.pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== BANK FILTER ===== */
.bank-filter-btn {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.bank-filter-btn:hover { background: #e2e8f0; color: #334155; }
.bank-filter-btn.active { background: #2563eb; color: white; font-weight: 600; }

.rekon-filter-btn {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.rekon-filter-btn:hover { background: #e2e8f0; color: #334155; }
.rekon-filter-btn.active { background: #7c3aed; color: white; font-weight: 600; }

.coa-filter-btn {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.coa-filter-btn:hover  { background: #e2e8f0; color: #334155; }
.coa-filter-btn.active { background: #f59e0b; color: white; font-weight: 600; border-color: transparent; }

.journal-status-btn {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.journal-status-btn:hover  { background: #e2e8f0; color: #334155; }
.journal-status-btn.active { background: #4f46e5; color: white; font-weight: 600; border-color: transparent; }

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

/* Mobile nav sidebar — slide-in animation */
#mob-nav-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
}
#mob-nav-sidebar.open { transform: translateX(0); }

/* Mobile nav item base */
.mob-nav-btn {
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s;
}
.mob-nav-btn.mob-nav-active {
    border-left-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}
.mob-nav-btn.mob-nav-active i { color: #2563eb; }

/* Mobile nav — module icon rail (left column) */
.mob-rail-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 11px 2px;
    border-left: 3px solid transparent;
    color: #64748b;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mob-rail-btn i { font-size: 20px; }
.mob-rail-btn:hover { background: #f1f5f9; }
.mob-rail-btn.active {
    border-left-color: #2563eb;
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

/* NOTE: style.css defines `.hidden { display:none !important }` which overrides
   Tailwind's responsive prefixes (md:flex etc.) — all responsive visibility
   is controlled here via explicit media queries instead of Tailwind responsive classes. */

@media (max-width: 767px) {
    /* Remove company-strip left-padding on mobile */
    #main-screen { padding-left: 0 !important; }
    #company-vertical-strip { display: none !important; }

    /* Hide desktop tab bar — replaced by hamburger + slide-in sidebar */
    #topbar-tabs { display: none !important; }

    /* Hide user name/caret in topbar on mobile (show avatar only) */
    .topbar-usr-details,
    .topbar-usr-caret { display: none !important; }

    /* Hide desktop-only company chip */
    #company-name-chip-wrap { display: none !important; }

    /* Topbar (mobile): logo + "XenosHMS" branding diganti nama company penyewa saja —
       logo XenosHMS-nya sendiri pindah ke header sidebar nav mobile (lihat #mob-nav-logo-box). */
    #topbar-logo-box, #topbar-brand-text { display: none !important; }
    #topbar-tenant-name { display: block !important; }

    /* Sidebar panels: switch to vertical stacking */
    #table-view-pendapatan,
    #panel-rekon { flex-direction: column !important; }

    /* Period sidebar becomes a collapsible header strip */
    .mob-sidebar {
        width: 100% !important;
        max-height: 52px;
        overflow: hidden;
        border-right: none !important;
        border-bottom: 1px solid #e2e8f0;
        transition: max-height 0.3s ease;
        flex-shrink: 0 !important;
    }
    .mob-sidebar.open { max-height: 280px; }

    /* Bank panel: stack list above detail */
    #bank-two-col { flex-direction: column !important; gap: 1rem !important; }
    #bank-two-col .w-64 { width: 100% !important; }
    #bank-stmt-list { max-height: 180px !important; }

    /* Show period-sidebar caret only on mobile */
    .mob-caret { display: inline-flex !important; }

    /* Rekon filter bar: allow wrapping */
    #rekon-content > div.px-5 { flex-wrap: wrap; gap: 0.5rem; }

    /* Dashboard stat cards: tighter padding */
    #panel-dashboard .grid > .bg-white { padding: 0.75rem !important; }
    #panel-dashboard .grid > .bg-white h2 { font-size: 1rem !important; }
}

@media (min-width: 768px) {
    /* Show desktop tab bar */
    #topbar-tabs { display: flex !important; }

    /* Profile: icon only in topbar — name & role show inside the dropdown on click */
    .topbar-usr-details { display: none !important; }
    .topbar-usr-caret   { display: inline !important; }

    /* Hide mobile nav elements on desktop */
    #mob-nav-sidebar,
    #mob-nav-backdrop,
    #mob-nav-open { display: none !important; }

    /* Hide period-sidebar carets on desktop */
    .mob-caret { display: none !important; }

    /* Restore company-strip left padding on desktop */
    #main-screen { padding-left: 18px; }
}

/* Website CMS live preview panel — default hidden (site publiknya desktop-first,
   380px kolom preview tidak muat di layar admin sempit), baru ditampilkan >=1024px. */
#website-preview-panel { display: none; }
@media (min-width: 1024px) {
    #website-preview-panel { display: flex !important; }
}

/* ===== PRINT ===== */
@media print {
    body { background: white; }
    #upload-screen, .no-print { display: none !important; }
    #main-screen { display: block !important; }
    #panel-dashboard { display: none !important; }
    #panel-table { display: block !important; padding: 0 !important; }
    #table-controls { display: none !important; }
    #pagination-bar { display: none !important; }
    .excel-wrap { overflow: visible; }
    .excel-table { font-size: 10px; }
    .excel-table thead th,
    .excel-table tbody td,
    .excel-table tfoot  td { padding: 3px 6px; font-size: 10px; }
}
