/* =========================================================================
   Academic Calendar – application styles (Bootstrap 5.3 theme layer)
   ========================================================================= */
:root {
    --app-topbar-h: 60px;
    --app-sidebar-w: 270px;
    --app-sidebar-bg: #0f1d33;
    --app-sidebar-bg-2: #13284a;
    --app-sidebar-fg: #b8c4d6;
    --app-accent: #2f6fed;
    --bs-primary: #2f6fed;
    --bs-primary-rgb: 47, 111, 237;
    --bs-link-color: #2459c8;
    --bs-link-color-rgb: 36, 89, 200;
    --bs-body-bg: #f3f5f9;
    --bs-border-radius: .5rem;
}

body.app { background: var(--bs-body-bg); padding-top: var(--app-topbar-h); }

.btn-primary { --bs-btn-bg: var(--app-accent); --bs-btn-border-color: var(--app-accent); --bs-btn-hover-bg: #2459c8; --bs-btn-hover-border-color: #2459c8; --bs-btn-active-bg: #1e4aa6; }
.text-primary { color: var(--app-accent) !important; }

/* ---------- top bar ---------- */
.app-topbar { height: var(--app-topbar-h); z-index: 1040; }
.brand-badge { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #2f6fed, #6a4cf5); color: #fff; }
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.avatar-lg { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(255,255,255,.25); }
.avatar-empty { display: inline-grid; place-items: center; background: rgba(255,255,255,.1); color: #fff; font-size: 2rem; }

/* ---------- shell ---------- */
.app-shell { display: flex; min-height: calc(100vh - var(--app-topbar-h)); }
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.app-main > .container-fluid { flex: 1 0 auto; }
.app-narrow { max-width: 1100px; }

/* ---------- sidebar ---------- */
.app-sidebar { background: linear-gradient(180deg, var(--app-sidebar-bg), var(--app-sidebar-bg-2)); color: var(--app-sidebar-fg); }
.app-sidebar .offcanvas-header { color: #fff; border-color: rgba(255,255,255,.1) !important; }
@media (min-width: 992px) {
    .app-sidebar { position: sticky; top: var(--app-topbar-h); height: calc(100vh - var(--app-topbar-h)); width: var(--app-sidebar-w); flex: 0 0 var(--app-sidebar-w); overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
}
@media (max-width: 991.98px) {
    .app-sidebar { --bs-offcanvas-width: 290px; }
}
.sidebar-user { border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-nav .nav-header { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: #6f86a8; padding: 1.1rem 1.25rem .35rem; }
.sidebar-nav .nav-link { display: flex; align-items: center; gap: .65rem; color: var(--app-sidebar-fg); padding: .5rem 1.25rem; font-size: .9rem; border-left: 3px solid transparent; transition: background .15s, color .15s; }
.sidebar-nav .nav-link:hover, .sidebar-nav .nav-link:focus { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-nav .nav-link.active { color: #fff; background: rgba(47,111,237,.25); border-left-color: #5b8cff; }
.sidebar-nav .nav-link .fa-fw { opacity: .85; }
.sidebar-nav .caret { font-size: .7rem; transition: transform .2s; }
.sidebar-nav .nav-group:not(.collapsed) .caret { transform: rotate(180deg); }
.sidebar-nav .sub-nav { background: rgba(0,0,0,.15); }
.sidebar-nav .sub-nav .nav-link { padding: .4rem 1.25rem .4rem 3.1rem; font-size: .85rem; }

/* ---------- content ---------- */
.page-title { font-weight: 650; color: #1b2a41; }
.breadcrumb { --bs-breadcrumb-divider: '›'; }
.card { border-radius: .75rem; }
.card-header:first-child { border-radius: .75rem .75rem 0 0; }
.form-label { font-weight: 500; font-size: .9rem; margin-bottom: .3rem; }
.form-label .req { color: #dc3545; margin-left: 2px; }
.form-text { font-size: .8rem; }
.app-footer { margin-top: auto; }
.back-to-top { position: fixed; right: 1rem; bottom: 1rem; display: none; z-index: 1030; border-radius: 50%; width: 38px; height: 38px; }
.back-to-top.show { display: inline-block; }

/* stat tiles on dashboard */
.stat-tile { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem; border-radius: .9rem; color: #fff; text-decoration: none; min-height: 104px; box-shadow: 0 4px 14px rgba(15,29,51,.12); transition: transform .15s, box-shadow .15s; }
.stat-tile:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15,29,51,.18); }
.stat-tile .icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.18); font-size: 1.4rem; flex: 0 0 52px; }
.stat-tile .value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.stat-tile .label { font-size: .85rem; opacity: .92; }
.bg-grad-1 { background: linear-gradient(135deg, #2f6fed, #5b8cff); }
.bg-grad-2 { background: linear-gradient(135deg, #e5484d, #ff7a7d); }
.bg-grad-3 { background: linear-gradient(135deg, #f08c00, #ffb347); }
.bg-grad-4 { background: linear-gradient(135deg, #12a150, #3fd48a); }
.bg-grad-5 { background: linear-gradient(135deg, #6a4cf5, #9b85ff); }
.bg-grad-6 { background: linear-gradient(135deg, #0b8fac, #36c6e0); }

/* tables */
.table-app { font-size: .875rem; }
.table-app thead th { background: #eef2f8; color: #34465f; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.table-app td { vertical-align: middle; }
.table-app td.text-wrap-cell { min-width: 220px; white-space: normal; }
.doc-link { display: inline-flex; align-items: center; gap: .25rem; text-decoration: none; margin-right: .35rem; font-size: 1.05rem; }
.actions { white-space: nowrap; }
.actions .btn { --bs-btn-padding-y: .2rem; --bs-btn-padding-x: .45rem; --bs-btn-font-size: .8rem; }
div.dt-container .dt-buttons .btn { --bs-btn-padding-y: .25rem; --bs-btn-font-size: .8rem; }
div.dt-container { font-size: .875rem; }

/* profile view */
.profile-photo { width: 150px; height: 180px; object-fit: cover; border-radius: .6rem; border: 3px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.kv { display: grid; grid-template-columns: minmax(140px, 38%) 1fr; gap: .35rem 1rem; font-size: .92rem; }
.kv dt { color: #5d6b82; font-weight: 500; }
.kv dd { margin: 0; color: #1b2a41; word-break: break-word; }
@media (max-width: 575.98px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: .5rem; } }

/* login */
.auth-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 10% 10%, #dfe8ff 0%, transparent 60%), radial-gradient(900px 500px at 90% 90%, #ece4ff 0%, transparent 60%), #f3f5f9; padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; border-radius: 1rem; }

/* printable documents (CV, CAS, salary…) */
.doc-sheet { background: #fff; max-width: 1000px; margin: 0 auto; padding: 2rem; border-radius: .75rem; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.doc-sheet h2, .doc-sheet h3 { color: #1b2a41; }
.doc-sheet table { width: 100%; }
.doc-sheet .table th { background: #f2f5fa; }

@media print {
    body.app { padding-top: 0; background: #fff; }
    .app-topbar, .app-sidebar, .app-footer, .back-to-top, .no-print, .breadcrumb, .alert, .dt-buttons, .dt-search, .dt-length, .dt-paging, .dt-info { display: none !important; }
    .app-main > .container-fluid { padding: 0 !important; max-width: none; }
    .card, .doc-sheet { box-shadow: none !important; border: 0 !important; padding: 0 !important; }
    a[href]::after { content: none !important; }
    .actions, th.no-export, td.no-export { display: none !important; }
}

/* ===================== Academic calendar specific ===================== */
.sidebar-user { border-bottom: 1px solid rgba(255,255,255,.08); }
.step-card { display: flex; gap: .9rem; align-items: flex-start; padding: 1rem 1.1rem; border-radius: .9rem; background: #fff; border: 1px solid #e6eaf1; text-decoration: none; color: inherit; height: 100%; transition: border-color .15s, box-shadow .15s, transform .15s; }
.step-card:hover { border-color: #b9cbf5; box-shadow: 0 6px 18px rgba(15,29,51,.08); transform: translateY(-1px); color: inherit; }
.step-card .num { flex: 0 0 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #e8efff; color: #2459c8; }
.step-card.done .num { background: #d9f5e5; color: #12814a; }
.step-card .t { font-weight: 600; color: #1b2a41; }
.step-card .d { font-size: .82rem; color: #5d6b82; }
.hero { border-radius: 1rem; overflow: hidden; background: linear-gradient(135deg, #0f1d33, #2f6fed); color: #fff; }
.hero .carousel-item img { height: 260px; object-fit: cover; opacity: .9; }
@media (max-width: 575.98px) { .hero .carousel-item img { height: 170px; } }

/* day-wise planner */
.planner-wrap { max-height: 72vh; overflow: auto; border: 1px solid #e6eaf1; border-radius: .6rem; background: #fff; }
.planner { font-size: .84rem; margin: 0; }
.planner thead th { position: sticky; top: 0; z-index: 3; background: #e9e3ff; color: #2d2350; white-space: nowrap; }
.planner td { vertical-align: middle; padding: .25rem .4rem; }
.planner tr.is-holiday td { background: #fff0f6; }
.planner tr.is-month-start td { border-top: 3px solid #b9a8f5; }
.planner select.yn { width: 4.2rem; font-weight: 700; padding-right: 1.4rem; }
.planner select.yn.v-Y { color: #1f55c6; }
.planner select.yn.v-N { color: #d63340; }
.planner select.ht { min-width: 12rem; }
.planner input.ev { min-width: 18rem; }
.planner .sun { color: #d63340; font-weight: 600; }
.planner-totals { position: sticky; bottom: 0; z-index: 4; }

/* month grids */
.month-grid { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 3px; }
.month-grid th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #5d6b82; text-align: center; padding: .25rem 0; }
.month-grid td { text-align: center; padding: .35rem 0; border-radius: .4rem; background: #f6f8fc; font-weight: 500; }
.month-grid td.empty { background: transparent; }
.month-grid td.sun, .month-grid th.sun { color: #d63340; }
.month-grid td.hol { background: #ffe3ee; color: #b4123d; font-weight: 700; }
.month-grid td.evt { box-shadow: inset 0 -3px 0 #2f6fed; }
.month-grid td.today { background: #2f6fed; color: #fff; }
.month-grid.big td { padding: 1rem 0; font-size: 1.35rem; }
.month-card { background: #fff; border: 1px solid #e6eaf1; border-radius: .8rem; padding: .8rem; height: 100%; }
.month-card h3 { font-size: 1rem; text-align: center; margin-bottom: .5rem; color: #1b2a41; }
.legend-dot { display: inline-block; width: .8rem; height: .8rem; border-radius: .2rem; vertical-align: -1px; margin-right: .25rem; }

/* printable academic calendar */
.cal-doc { background: #fff; max-width: 1000px; margin: 0 auto; padding: 2rem; border-radius: .75rem; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.cal-cover { text-align: center; padding: 3rem 1rem; }
.cal-cover .logo { width: 120px; height: 120px; object-fit: contain; }
.cal-cover .gate { max-width: 100%; max-height: 360px; border-radius: .5rem; }
.cal-month h2 { color: #127a3a; font-weight: 700; text-align: center; font-size: 1.35rem; }
.cal-table { font-size: .86rem; }
.cal-table th { background: #e3f6fb !important; text-align: center; vertical-align: middle; }
.cal-table td { vertical-align: middle; }
.cal-table tr.hol td { background: #ffe6f6 !important; }
.cal-sign { text-align: right; color: #1e7bd6; font-weight: 600; }
.page-break { break-after: page; page-break-after: always; }

@media print {
    @page { size: A4 portrait; margin: 12mm; }
    .cal-doc { box-shadow: none; padding: 0; max-width: none; }
    .cal-table, .month-grid { font-size: 10.5pt; }
    .planner-wrap { max-height: none; overflow: visible; border: 0; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.cal-doc .month-grid td.today:not(.hol) { background: #f6f8fc; color: inherit; }
.cal-doc .month-grid td.today.hol { background: #ffe3ee; color: #b4123d; }
.sidebar-nav .nav-logout { color: #ff9b9b; }
.sidebar-nav .nav-logout:hover { color: #fff; background: rgba(229,72,77,.25); }
