/* School TK/TC Management Software — blue and white admin theme */

:root {
    --tc-blue-900: #0a2a66;
    --tc-blue-800: #0d3a8a;
    --tc-blue-700: #1249b0;
    --tc-blue-600: #1a5bd6;
    --tc-blue-100: #e3ecfb;
    --tc-blue-50: #f3f7fd;
    --tc-ink: #16233b;
    --tc-muted: #5b6a82;
    --tc-border: #dbe3ef;
    --tc-sidebar-w: 248px;

    --bs-primary: #1a5bd6;
    --bs-primary-rgb: 26, 91, 214;
    --bs-link-color: #1249b0;
    --bs-link-color-rgb: 18, 73, 176;
    --bs-link-hover-color: #0d3a8a;
    --bs-body-color: var(--tc-ink);
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans Devanagari", Arial, sans-serif;
    --bs-border-color: var(--tc-border);
}

body {
    background: var(--tc-blue-50);
    min-height: 100vh;
}

.btn-primary {
    --bs-btn-bg: var(--tc-blue-600);
    --bs-btn-border-color: var(--tc-blue-600);
    --bs-btn-hover-bg: var(--tc-blue-700);
    --bs-btn-hover-border-color: var(--tc-blue-700);
    --bs-btn-active-bg: var(--tc-blue-800);
    --bs-btn-active-border-color: var(--tc-blue-800);
    --bs-btn-disabled-bg: var(--tc-blue-600);
    --bs-btn-disabled-border-color: var(--tc-blue-600);
}

.btn-outline-primary {
    --bs-btn-color: var(--tc-blue-700);
    --bs-btn-border-color: var(--tc-blue-600);
    --bs-btn-hover-bg: var(--tc-blue-600);
    --bs-btn-hover-border-color: var(--tc-blue-600);
    --bs-btn-active-bg: var(--tc-blue-700);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: #7ea6ec;
    box-shadow: 0 0 0 .2rem rgba(26, 91, 214, .18);
}

.form-check-input:checked {
    background-color: var(--tc-blue-600);
    border-color: var(--tc-blue-600);
}

/* ---------- Shell ---------- */

.app-sidebar {
    width: var(--tc-sidebar-w);
    --bs-offcanvas-bg: var(--tc-blue-900);
    --bs-offcanvas-color: #dfe8f8;
    background: var(--tc-blue-900);
    color: #dfe8f8;
}

@media (min-width: 992px) {
    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        visibility: visible !important;
        transform: none !important;
        /* Bootstrap makes .offcanvas-lg transparent at this width */
        background-color: var(--tc-blue-900) !important;
        border-right: 0;
        z-index: 1030;
    }

    .app-main {
        margin-left: var(--tc-sidebar-w);
    }
}

.app-brand {
    display: flex;
    gap: .7rem;
    align-items: center;
    padding: 1.1rem 1.1rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    color: #fff;
    text-decoration: none;
}

.app-brand:hover {
    color: #fff;
}

.app-brand-mark {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: #fff;
    color: var(--tc-blue-800);
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: .02em;
    font-size: .95rem;
}

.app-brand-mark.has-logo {
    padding: 3px;
    overflow: hidden;
}

.app-brand-mark.has-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.app-brand-name {
    font-weight: 700;
    line-height: 1.15;
    font-size: .95rem;
}

.app-brand-sub {
    font-size: .72rem;
    color: #a9bde3;
    line-height: 1.25;
    display: block;
    margin-top: .1rem;
}

.app-nav {
    padding: .75rem .6rem;
}

.app-nav-heading {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #8aa3d1;
    padding: .9rem .75rem .35rem;
}

.app-nav .nav-link {
    color: #d6e2f7;
    border-radius: 8px;
    padding: .55rem .75rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    font-size: .93rem;
}

.app-nav .nav-link i {
    font-size: 1.05rem;
    opacity: .9;
}

.app-nav .nav-link:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.app-nav .nav-link.active {
    background: #fff;
    color: var(--tc-blue-800);
    font-weight: 600;
}

/* Laptop screens (768 px high): keep the whole menu visible without scrolling. */
@media (min-width: 992px) and (max-height: 880px) {
    .app-nav { padding: .3rem .6rem; }
    .app-nav-heading { padding: .45rem .75rem .15rem; }
    .app-nav .nav-link { padding: .25rem .75rem; font-size: .9rem; }
}

.app-sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, .1);
    padding: .8rem 1.1rem;
    font-size: .75rem;
    color: #8aa3d1;
}

.app-topbar {
    background: #fff;
    border-bottom: 1px solid var(--tc-border);
    position: sticky;
    top: 0;
    z-index: 1020;
    min-height: 60px;
}

.app-topbar h1 {
    font-size: 1.15rem;
    font-weight: 650;
    margin: 0;
}

.app-user-btn {
    border: 1px solid var(--tc-border);
    background: #fff;
    border-radius: 999px;
    padding: .25rem .75rem .25rem .3rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--tc-ink);
}

.app-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--tc-blue-100);
    color: var(--tc-blue-800);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .8rem;
}

.app-content {
    padding: 1.5rem;
    max-width: 1400px;
}

@media (max-width: 575.98px) {
    .app-content {
        padding: 1rem .75rem;
    }
}

/* ---------- Cards and tables ---------- */

.card {
    border-color: var(--tc-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 35, 75, .04);
}

.card-header {
    background: #fff;
    border-bottom-color: var(--tc-border);
    font-weight: 600;
    padding: .85rem 1.1rem;
}

.stat-card {
    height: 100%;
}

.stat-card .card-body {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 11px;
    background: var(--tc-blue-100);
    color: var(--tc-blue-700);
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    flex: 0 0 auto;
}

.stat-icon.is-green { background: #e2f5ea; color: #15803d; }
.stat-icon.is-amber { background: #fdf1dc; color: #b45309; }
.stat-icon.is-red { background: #fde4e4; color: #b91c1c; }

.stat-label {
    color: var(--tc-muted);
    font-size: .82rem;
    margin-bottom: .1rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.stat-value.is-text {
    font-size: 1.25rem;
}

.table {
    --bs-table-hover-bg: var(--tc-blue-50);
    margin-bottom: 0;
}

.table thead th {
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--tc-muted);
    font-weight: 600;
    background: #f8fafe;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

.badge-status {
    font-weight: 600;
    font-size: .75rem;
    border-radius: 999px;
    padding: .35em .7em;
}

.badge-active { background: #e2f5ea; color: #166534; }
.badge-locked { background: #fdf1dc; color: #92400e; }
.badge-disabled { background: #eceff4; color: #475569; }
.badge-change { background: var(--tc-blue-100); color: var(--tc-blue-800); }
.badge-issued { background: #e2f5ea; color: #166534; }
.badge-cancelled { background: #fde4e4; color: #991b1b; }
.badge-draft { background: #eceff4; color: #475569; }

.empty-state {
    text-align: center;
    color: var(--tc-muted);
    padding: 2.5rem 1rem;
}

.empty-state i {
    font-size: 2rem;
    color: #9fb4d8;
    display: block;
    margin-bottom: .5rem;
}

.form-section-title {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--tc-muted);
    font-weight: 600;
    margin: 0 0 .75rem;
}

.form-label {
    font-weight: 500;
    font-size: .9rem;
}

.required::after {
    content: " *";
    color: #b91c1c;
}

.perm-module {
    border: 1px solid var(--tc-border);
    border-radius: 10px;
    padding: .9rem 1rem;
    background: #fff;
    height: 100%;
}

.perm-module h3 {
    font-size: .92rem;
    font-weight: 650;
    margin-bottom: .6rem;
}

/* ---------- Sign-in and setup ---------- */

.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(1200px 500px at 50% -10%, #2a6ae0 0%, transparent 70%),
        linear-gradient(180deg, var(--tc-blue-900) 0%, var(--tc-blue-800) 45%, var(--tc-blue-50) 45%);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 1rem;
}

.auth-wrap {
    width: 100%;
    max-width: 440px;
}

.auth-wrap.is-wide {
    max-width: 560px;
}

.auth-college {
    text-align: center;
    color: #fff;
    margin-bottom: 1.5rem;
}

.auth-college-logo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    margin: 0 auto .75rem;
    color: var(--tc-blue-800);
    font-weight: 800;
    font-size: 1.2rem;
    overflow: hidden;
}

.auth-college-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-college h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: .02em;
    margin-bottom: .2rem;
}

.auth-college p {
    font-size: .82rem;
    color: #c8d7f3;
    margin: 0;
}

.auth-card {
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(10, 42, 102, .18);
    border: 0;
}

.auth-card .card-body {
    padding: 1.75rem;
}

.auth-card h2 {
    font-size: 1.2rem;
    font-weight: 650;
}

.auth-footer {
    text-align: center;
    font-size: .75rem;
    color: var(--tc-muted);
    margin-top: 1.25rem;
}

.password-toggle {
    border-color: var(--bs-border-color);
    background: #fff;
    color: var(--tc-muted);
}

/* ---------- Print: never print the app chrome ---------- */

@media print {
    .app-sidebar,
    .app-topbar,
    .no-print {
        display: none !important;
    }

    .app-main {
        margin-left: 0 !important;
    }

    body {
        background: #fff;
    }
}

/* ---------- College profile ---------- */

.image-tile {
    border: 1px dashed var(--tc-border);
    border-radius: 10px;
    background: #fff;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: .5rem;
}

.image-tile img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-tile.is-empty {
    color: var(--tc-muted);
    font-size: .85rem;
    background: var(--tc-blue-50);
}

.profile-dl dt {
    font-weight: 500;
    color: var(--tc-muted);
    margin-bottom: .6rem;
}

.profile-dl dd {
    margin-bottom: .6rem;
}

.badge-current { background: #e2f5ea; color: #166534; }

/* ---------- TC ---------- */

.tc-summary p {
    margin-bottom: .7rem;
    line-height: 1.7;
}

.tc-blank {
    color: #b0b9c8;
    letter-spacing: .05em;
}

.tc-frame-wrap {
    background: #e6ebf2;
    border: 1px solid var(--tc-border);
    border-radius: 12px;
    overflow: hidden;
}

.tc-frame {
    display: block;
    width: 100%;
    height: calc(297mm + 14mm);
    border: 0;
}

/* ---------- Import / reports ---------- */

.import-steps { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; list-style: none; padding: 0; margin: 0; }
.import-steps li { display: flex; align-items: center; gap: .5rem; color: var(--tc-muted); font-size: .9rem; }
.import-steps li span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #e3e8f0; font-weight: 600; font-size: .8rem; }
.import-steps li.current { color: var(--tc-ink); font-weight: 600; }
.import-steps li.current span { background: var(--tc-blue-600); color: #fff; }
.import-steps li.done span { background: #d6f0df; color: #166534; }
.report-card:hover { border-color: #9db8ea; box-shadow: 0 2px 10px rgba(18, 73, 176, .1); }
.report-table td, .report-table th { white-space: nowrap; }
