/*
 * TruongHoc Professional App UI v1.4.0
 * Scope: themes/truonghoc only. Never edit themes/default.
 */
:root {
    --th-primary: #1f5fae;
    --th-primary-dark: #15477f;
    --th-accent: #0d9488;
    --th-bg: #f3f6fa;
    --th-surface: #ffffff;
    --th-surface-soft: #f8fafc;
    --th-border: #e3e9f1;
    --th-text: #1f2937;
    --th-muted: #6b7280;
    --th-sidebar: #17324d;
    --th-sidebar-2: #10283f;
    --th-danger: #c0392b;
    --th-warning: #b7791f;
    --th-success: #237a57;
    --th-radius: 12px;
    --th-shadow: 0 8px 28px rgba(31, 41, 55, .08);
}

html, body { min-height: 100%; }
body.th-school-app {
    margin: 0 !important;
    background: var(--th-bg) !important;
    color: var(--th-text);
    font-family: "Segoe UI", Roboto, Arial, sans-serif !important;
    font-size: 14px;
    line-height: 1.55;
}

/* Remove legacy Default-theme chrome only while TruongHoc app is active. */
body.th-school-app .th-legacy-hidden { display: none !important; }
body.th-school-app > .wraper,
body.th-school-app > .wrapper,
body.th-school-app #body,
body.th-school-app #container,
body.th-school-app .body-bg,
body.th-school-app .site-body {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
}
body.th-school-app .container,
body.th-school-app .container-fluid {
    max-width: none;
}
body.th-school-app .th-app .container,
body.th-school-app .th-app .container-fluid {
    width: auto !important;
    padding-left: 0;
    padding-right: 0;
}

/* App shell */
.th-app {
    position: relative;
    display: flex;
    min-height: 100vh;
    background: var(--th-bg);
}
.th-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: 268px;
    overflow-y: auto;
    overflow-x: hidden;
    color: #fff;
    background: linear-gradient(180deg, var(--th-sidebar) 0%, var(--th-sidebar-2) 100%);
    box-shadow: 6px 0 22px rgba(15, 23, 42, .08);
}
.th-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,.09);
}
.th-brand-mark {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    border-radius: 11px;
    background: rgba(255,255,255,.14);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
    font-size: 21px;
    font-weight: 800;
}
.th-brand-text { min-width: 0; }
.th-brand-title {
    display: block;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .15px;
    line-height: 1.25;
}
.th-brand-subtitle {
    display: block;
    margin-top: 2px;
    color: rgba(255,255,255,.68);
    font-size: 11px;
    line-height: 1.25;
}
.th-nav { padding: 12px 10px 24px; }
.th-nav-group { margin: 9px 0 4px; }
.th-nav-label {
    padding: 8px 11px 5px;
    color: rgba(255,255,255,.48);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .9px;
}
.th-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    margin: 3px 0;
    padding: 9px 11px;
    border-radius: 9px;
    color: rgba(255,255,255,.83) !important;
    text-decoration: none !important;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}
.th-nav a:hover,
.th-nav a:focus {
    color: #fff !important;
    background: rgba(255,255,255,.09);
    transform: translateX(1px);
}
.th-nav a.is-active {
    color: #fff !important;
    background: rgba(255,255,255,.15);
    box-shadow: inset 3px 0 0 #64d8cb;
}
.th-nav-icon {
    width: 24px;
    text-align: center;
    opacity: .9;
    font-size: 16px;
}
.th-nav-text { min-width: 0; flex: 1; }

.th-main {
    width: calc(100% - 268px);
    min-height: 100vh;
    margin-left: 268px;
}
.th-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    min-height: 64px;
    align-items: center;
    gap: 14px;
    padding: 8px 24px;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--th-border);
    box-shadow: 0 2px 8px rgba(15,23,42,.035);
}
.th-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--th-border);
    border-radius: 9px;
    background: #fff;
    color: var(--th-primary-dark);
    font-size: 21px;
    line-height: 1;
}
.th-topbar-title {
    min-width: 0;
    flex: 1;
}
.th-topbar-title strong {
    display: block;
    overflow: hidden;
    color: #18324b;
    font-size: 17px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.th-topbar-title small {
    display: block;
    margin-top: 2px;
    color: var(--th-muted);
    font-size: 12px;
}
.th-user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: 330px;
    padding: 6px 10px 6px 7px;
    border: 1px solid var(--th-border);
    border-radius: 999px;
    background: #fff;
}
.th-avatar {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    border-radius: 50%;
    color: #fff;
    background: var(--th-primary);
    font-weight: 700;
}
.th-user-meta { min-width: 0; }
.th-user-meta strong,
.th-user-meta small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.th-user-meta strong { font-size: 12px; color: var(--th-text); }
.th-user-meta small { color: var(--th-muted); font-size: 10px; }

.th-content {
    padding: 24px;
}
.th-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 18px;
}
.th-page-head h1 {
    margin: 0;
    color: #18324b;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
}
.th-page-head p {
    margin: 5px 0 0;
    color: var(--th-muted);
    font-size: 13px;
}

/* Dashboard */
.th-dashboard-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 18px;
    padding: 22px 24px;
    border: 1px solid #d9e7f6;
    border-radius: var(--th-radius);
    background: linear-gradient(135deg, #ffffff 0%, #eef6ff 100%);
    box-shadow: var(--th-shadow);
}
.th-dashboard-hero:after {
    content: "";
    position: absolute;
    right: -55px;
    top: -70px;
    width: 210px;
    height: 210px;
    border-radius: 50%;
    background: rgba(31,95,174,.06);
}
.th-dashboard-hero h2 { margin: 0 0 5px; color: #15395d; font-size: 23px; }
.th-dashboard-hero p { margin: 0; color: #567088; }
.th-scope-line { margin-top: 10px !important; font-size: 12px; }
.th-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.th-kpi-card {
    padding: 17px 18px;
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    background: var(--th-surface);
    box-shadow: 0 4px 16px rgba(15,23,42,.04);
}
.th-kpi-label { color: var(--th-muted); font-size: 12px; font-weight: 600; }
.th-kpi-value { margin-top: 4px; color: #173a5d; font-size: 27px; font-weight: 750; line-height: 1.15; }
.th-kpi-note { margin-top: 4px; color: #8793a2; font-size: 11px; }
.th-section-card {
    margin-bottom: 18px;
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    background: var(--th-surface);
    box-shadow: 0 4px 18px rgba(15,23,42,.04);
}
.th-section-title {
    padding: 15px 18px 11px;
    color: #18324b;
    font-size: 14px;
    font-weight: 700;
    border-bottom: 1px solid var(--th-border);
}
.th-section-body { padding: 16px 18px; }
.th-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.th-feature-card {
    position: relative;
    display: block;
    min-height: 94px;
    padding: 14px 14px 13px 48px;
    border: 1px solid var(--th-border);
    border-radius: 10px;
    background: #fff;
    color: var(--th-text) !important;
    text-decoration: none !important;
    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.th-feature-card:hover {
    transform: translateY(-1px);
    border-color: #bfd4ea;
    box-shadow: 0 7px 18px rgba(31,95,174,.08);
}
.th-feature-icon {
    position: absolute;
    left: 14px;
    top: 15px;
    display: flex;
    width: 25px;
    height: 25px;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: var(--th-primary);
    background: #eef6ff;
    font-size: 14px;
    font-weight: 800;
}
.th-feature-card strong { display: block; margin-bottom: 3px; color: #193a5b; font-size: 13px; }
.th-feature-card small { color: var(--th-muted); line-height: 1.4; }

/* Normalize old module markup into application UI */
.th-module-panel.panel {
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}
.th-module-panel > .panel-heading { display: none; }
.th-module-panel > .panel-body { padding: 0; }
.th-content .panel:not(.th-module-panel),
.th-content .well,
.th-content .jumbotron,
.th-content .list-group,
.th-content .table-responsive {
    border-radius: 10px;
}
.th-content .panel {
    border-color: var(--th-border);
    box-shadow: 0 3px 14px rgba(15,23,42,.035);
}
.th-content .panel-heading {
    border-color: var(--th-border);
    background: #f8fafc;
    color: #1f3c59;
}
.th-content .panel-primary > .panel-heading {
    background: var(--th-primary);
    border-color: var(--th-primary);
    color: #fff;
}
.th-content .well {
    border-color: var(--th-border);
    background: #fff;
    box-shadow: none;
}
.th-content .jumbotron { background: #f4f8fc; }
.th-content .list-group-item { border-color: var(--th-border); }
.th-content a.list-group-item:hover { background: #f4f8fc; }
.th-content .table {
    margin-bottom: 0;
    background: #fff;
}
.th-content .table > thead > tr > th {
    border-bottom: 1px solid #dfe6ee;
    color: #4a5f73;
    background: #f7f9fc;
    font-size: 12px;
    font-weight: 700;
    vertical-align: middle;
}
.th-content .table > tbody > tr > td { border-top-color: #edf1f5; vertical-align: middle; }
.th-content .table-striped > tbody > tr:nth-of-type(odd) { background-color: #fbfcfe; }
.th-content .form-control {
    height: 38px;
    border-color: #d8e0e9;
    border-radius: 8px;
    box-shadow: none;
}
.th-content textarea.form-control { height: auto; min-height: 92px; }
.th-content .form-control:focus {
    border-color: #8db7df;
    box-shadow: 0 0 0 3px rgba(31,95,174,.08);
}
.th-content .btn {
    border-radius: 8px;
    font-weight: 600;
}
.th-content .btn-primary { background: var(--th-primary); border-color: var(--th-primary); }
.th-content .btn-primary:hover { background: var(--th-primary-dark); border-color: var(--th-primary-dark); }
.th-content .alert { border-radius: 9px; }
.th-content label { color: #43566a; font-size: 12px; font-weight: 650; }

/* Public portal */
.th-public-portal {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}
.th-public-hero {
    padding: 28px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #174f89, #1f6ab4);
    box-shadow: var(--th-shadow);
}
.th-public-hero h1 { margin: 0 0 8px; font-size: 27px; }
.th-public-hero p { margin: 0; color: rgba(255,255,255,.82); }

/* Keep old theme utility elements from leaking into the application. */
body.th-school-app .breadcrumbs-wrap,
body.th-school-app #breadcrumbs,
body.th-school-app .breadcrumb-wrap,
body.th-school-app .site-search,
body.th-school-app #search,
body.th-school-app .search-form,
body.th-school-app .panel.menu,
body.th-school-app .left-sidebar-legacy,
body.th-school-app .right-sidebar-legacy {
    display: none !important;
}

.th-app-overlay { display: none; }

@media (max-width: 1100px) {
    .th-kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .th-feature-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 900px) {
    .th-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    body.th-sidebar-open .th-sidebar { transform: translateX(0); }
    .th-main { width: 100%; margin-left: 0; }
    .th-menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .th-app-overlay {
        position: fixed;
        inset: 0;
        z-index: 1035;
        background: rgba(15,23,42,.42);
    }
    body.th-sidebar-open .th-app-overlay { display: block; }
}
@media (max-width: 640px) {
    .th-content { padding: 14px; }
    .th-topbar { padding: 7px 12px; }
    .th-user-chip { display: none; }
    .th-page-head h1 { font-size: 20px; }
    .th-kpi-grid, .th-feature-grid { grid-template-columns: 1fr; }
    .th-dashboard-hero { padding: 18px; }
}

@media print {
    .th-sidebar, .th-topbar, .th-app-overlay { display: none !important; }
    .th-main { width: 100% !important; margin: 0 !important; }
    .th-content { padding: 0 !important; }
    body.th-school-app { background: #fff !important; }
}
