/*
 | School ERP — custom admin styling layered on top of Bootstrap 5 (CDN).
 | Loaded statically (no build step) for shared-hosting friendliness.
 */

/*
 | Brand colours live in brand.css (fallbacks) and are overridden at runtime by
 | brand_palette_css() from app/helpers.php. Only layout metrics and the sidebar
 | skin are defined here, both derived from the brand palette.
 */
:root {
    --sidebar-w: 260px;
    --sidebar-bg: var(--brand-darker, #1E0431);
    --sidebar-bg-2: var(--brand-dark, #2C0646);
    --sidebar-link: rgba(255, 255, 255, .72);
    --sidebar-link-active: #ffffff;
    --sidebar-section: rgba(255, 255, 255, .38);
    --sidebar-hover-bg: rgba(255, 255, 255, .08);
    --sidebar-active-bg: var(--accent-safe, #AE5B0F);
    --sidebar-active-shadow: rgba(var(--accent-rgb, 210, 110, 18), .38);
    --sidebar-border: rgba(255, 255, 255, .08);
    --topbar-h: 60px;
}

/* Light sidebar option (Settings → Theme → Sidebar Theme). */
[data-sidebar="light"] {
    --sidebar-bg: #ffffff;
    --sidebar-bg-2: var(--brand-tint, #F0EBF3);
    --sidebar-link: #4a4458;
    --sidebar-link-active: #ffffff;
    --sidebar-section: #8a8296;
    --sidebar-hover-bg: rgba(var(--brand-rgb, 67, 9, 108), .07);
    --sidebar-active-bg: var(--brand, #43096C);
    --sidebar-active-shadow: rgba(var(--brand-rgb, 67, 9, 108), .3);
    --sidebar-border: rgba(0, 0, 0, .08);
}

body {
    background: #f4f6fb;
    font-size: 0.925rem;
}

/* ---------- Layout shell ---------- */
.app-wrapper { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
    color: var(--sidebar-link);
    position: fixed;
    inset: 0 auto 0 0;
    overflow-y: auto;
    z-index: 1040;
    transition: transform .25s ease;
}
.app-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    transition: margin .25s ease;
}

.app-sidebar .brand {
    /* Stacked so the full school name shows instead of truncating beside the logo. */
    min-height: var(--topbar-h);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .7rem 1rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: .2px;
    text-align: center;
    text-decoration: none;
    border-bottom: 1px solid var(--sidebar-border);
}
.app-sidebar .brand .brand-name {
    font-size: .9rem;
    line-height: 1.15;
    white-space: normal;      /* allow the name to wrap to two lines */
    max-width: 100%;
}
.app-sidebar .brand { color: var(--sidebar-link-active); }
[data-sidebar="light"] .app-sidebar .brand { color: var(--brand); }
.app-sidebar .brand img { height: 44px; width: auto; max-width: 150px; object-fit: contain; border-radius: 8px; background:#fff; padding: 3px; }

.sidebar-nav { padding: .75rem .6rem 4rem; }
.sidebar-nav .nav-section {
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .08em;
    color: var(--sidebar-section);
    padding: 1rem .8rem .35rem;
}
.sidebar-nav .nav-link {
    color: var(--sidebar-link);
    border-radius: .5rem;
    padding: .6rem .8rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    font-weight: 500;
    margin-bottom: 2px;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-link-active); }
[data-sidebar="light"] .sidebar-nav .nav-link:hover { color: var(--brand); }
.sidebar-nav .nav-link.active { background: var(--sidebar-active-bg); color: #fff; box-shadow: 0 6px 16px var(--sidebar-active-shadow); }
.sidebar-nav .nav-link .chevron { margin-left: auto; transition: transform .2s; font-size: .8rem; }
.sidebar-nav .nav-link[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.sidebar-nav .submenu { list-style: none; padding-left: 2.5rem; margin: 0 0 .25rem; }
.sidebar-nav .submenu .nav-link { padding: .42rem .8rem; font-size: .875rem; }

/* ---------- Topbar ---------- */
.app-topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e7ebf3;
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1.1rem;
}
.app-topbar .badge-session { font-weight: 600; }

/* ---------- Cards ---------- */
.card { border: 1px solid #e9edf5; border-radius: .8rem; box-shadow: 0 2px 8px rgba(18,38,63,.04); }
.card .card-header { background: #fff; border-bottom: 1px solid #eef1f7; font-weight: 600; }

.stat-card { border-radius: .8rem; overflow: hidden; }
.stat-card .icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: .7rem; font-size: 1.5rem; }

/* ---------- Tables ---------- */
table.dataTable thead th { white-space: nowrap; font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; color: #6b7a99; }
.table > :not(caption) > * > * { padding: .65rem .75rem; }

/* ---------- Misc ---------- */
.required::after { content: " *"; color: #dc3545; }
.page-title { font-weight: 700; margin: 0; }
.breadcrumb { margin: 0; font-size: .82rem; }
.select2-container { width: 100% !important; }
.form-label { font-weight: 600; font-size: .85rem; color: #3b4a66; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.show { transform: translateX(0); }
    .app-content { margin-left: 0; }
}

/* ---------- Auth ---------- */
.auth-wrapper { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-darker, #1E0431), var(--brand, #43096C) 55%, var(--accent-dark, #934D0D)); padding: 1.5rem; }
.auth-card { width: 100%; max-width: 420px; border-radius: 1rem; }
.auth-card .brand-logo { height: 60px; width: auto; max-width: 220px; object-fit: contain; }
