/* =========================================================
   public/assets/css/style.css
   สไตล์ส่วนกลางของระบบ — typography, navbar, sidebar, dashboard
   ========================================================= */

* { font-family: 'Sarabun', system-ui, -apple-system, 'Segoe UI', sans-serif; }

body { background: #f4f6f9; }

/* ---------- Guest pages (login) ---------- */
.guest-body {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
}
.guest-body .card { border-radius: 12px; }

/* ---------- App layout (after login) ---------- */
.app-navbar {
    z-index: 1040;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #6366f1 100%) !important;
    background-attachment: fixed !important;
    background-size: 100vw 100vh !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
}
.app-navbar .navbar-brand,
.app-navbar .navbar-brand-text { color: #fff; }
.app-navbar .navbar-brand-text {
    font-size: 1rem; font-weight: 600;
    max-width: 60vw;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.app-wrapper { padding-top: 56px; min-height: 100vh; display: flex; }

.app-sidebar {
    width: 240px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #6366f1 100%) !important;
    background-attachment: fixed !important;
    background-size: 100vw 100vh !important;
    --bs-offcanvas-bg: transparent;
    --bs-offcanvas-color: #e2e8f0;
    --bs-offcanvas-border-width: 0;
    border-right: 0 !important;
    padding-top: 1rem;     /* mobile offcanvas เริ่มจาก 0 → ใส่ padding บนบ้าง */
    color: #e2e8f0;
}
.app-sidebar .offcanvas-header {
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.app-sidebar .offcanvas-header .btn-close {
    filter: invert(1) brightness(2);
}

@media (min-width: 992px) {
    .app-sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        padding-top: calc(56px + 1rem);   /* เผื่อพื้นที่ใต้ navbar (navbar สูง 56px) */
        overflow-y: auto;
        z-index: 1030;                    /* ต่ำกว่า navbar (1040) เพื่อให้ navbar ทับ */
    }
    .app-content { margin-left: 240px; flex: 1; min-width: 0; }
}
@media (max-width: 991.98px) {
    .app-sidebar.offcanvas { width: 260px; }
    .app-content { flex: 1; min-width: 0; }
}

/* scrollbar ของ sidebar เข้ากับโทนเข้ม */
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.sidebar-menu .nav-link {
    color: #cbd5e1; padding: .65rem 1.25rem; border-radius: 0;
    display: flex; align-items: center; gap: .6rem;
    border-left: 3px solid transparent;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.sidebar-menu .nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; color: #94a3b8; }
.sidebar-menu .nav-link:hover {
    background: rgba(255,255,255,.06); color: #fff;
}
.sidebar-menu .nav-link:hover i { color: #93c5fd; }
.sidebar-menu .nav-link.active {
    background: linear-gradient(90deg, rgba(59,130,246,.25), rgba(59,130,246,.05));
    color: #fff; font-weight: 600;
    border-left-color: #60a5fa;
    box-shadow: inset 0 0 0 1px rgba(96,165,250,.15);
}
.sidebar-menu .nav-link.active i { color: #93c5fd; }
.sidebar-heading {
    padding: .75rem 1.25rem .35rem; font-size: .72rem; font-weight: 600;
    color: #64748b; text-transform: uppercase; letter-spacing: .08em;
    border-top: 1px solid rgba(255,255,255,.06); margin-top: .5rem;
}

.app-footer { margin-top: 2rem; }

/* ---------- Dashboard cards ---------- */
.dashboard-card {
    transition: transform .15s ease, box-shadow .15s ease;
    color: inherit;
}
.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.08);
}
