/* Variables */
:root {
    --tib-primary: #075985;
    --tib-primary-dark: #063d60;
    --tib-primary-light: #e8f3fa;
    --tib-background: #f4f7fa;
    --tib-surface: #ffffff;
    --tib-text: #173348;
    --tib-muted: #586c7d;
    --tib-line: #dce6ee;
    --tib-shadow: 0 8px 28px rgba(12, 55, 83, .06);
    --bs-primary-rgb: 7, 89, 133;
    --bs-link-color: var(--tib-primary);
    --bs-link-hover-color: var(--tib-primary-dark);
}
/* Typography */
html { font-size: 16px; min-height: 100%; }
body { font-family: Roboto, Arial, Helvetica, sans-serif; color: var(--tib-text); background: var(--tib-background); min-height: 100vh; display: flex; flex-direction: column; margin: 0; line-height: 1.6; }
h1, h2, h3, h4 { color: var(--tib-text); font-weight: 700; line-height: 1.25; letter-spacing: -.025em; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.75rem, 3vw, 2.65rem); }
h2 { font-size: clamp(1.4rem, 2vw, 1.85rem); }
a { color: var(--tib-primary); text-underline-offset: .2em; }
.text-muted, .text-secondary { color: var(--tib-muted) !important; }
.text-preline { white-space: pre-line; overflow-wrap: anywhere; }
.eyebrow { display: block; color: var(--tib-primary); text-transform: uppercase; letter-spacing: .13em; font-size: .72rem; font-weight: 700; margin-bottom: .6rem; }
:focus-visible { outline: 3px solid #1983bc; outline-offset: 4px; }
.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 1100; }
.skip-link:focus { top: 1rem; background: white; padding: .75rem; }
/* Layout */
.app-content { min-width: 0; width: 100%; padding: 2.5rem clamp(1.25rem, 3vw, 3.5rem) 3.5rem; }
.public-content { flex: 1; max-width: 1500px; }
.app-shell { display: grid; grid-template-columns: 245px minmax(0, 1fr); flex: 1; }
.app-footer { padding: 1.25rem; color: var(--tib-muted); background: white; border-top: 1px solid var(--tib-line); font-size: .85rem; }
.footer-note { float: right; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; margin-bottom: 2rem; }
.page-heading h1 { margin-bottom: .5rem; }
.page-heading p, .section-heading p { color: var(--tib-muted); margin-bottom: 0; }
.section-heading { margin-bottom: 1.5rem; }
.welcome-panel { background: var(--tib-primary-light); border: 1px solid var(--tib-line); border-radius: 1.2rem; padding: 2rem; }
.empty-state { background: white; padding: 2.5rem; border: 1px dashed #bdcfdd; border-radius: 1rem; text-align: center; }
.empty-state p { color: var(--tib-muted); }
.error-state { max-width: 650px; margin: 5vh auto; padding: 3rem; text-align: center; background: white; border-radius: 1rem; box-shadow: var(--tib-shadow); }
.error-code { color: var(--tib-primary); font-size: 4rem; font-weight: 800; }
/* Navbar */
.app-header { position: sticky; top: 0; z-index: 1030; box-shadow: 0 3px 18px rgba(6, 61, 96, .13); }
.app-header .navbar { min-height: 82px; background: var(--tib-primary-dark); }
.navbar-brand { display: flex; align-items: center; gap: 1rem; font-weight: 700; font-size: 1.05rem; margin-right: 2rem; }
.tib-logo { object-fit: contain; height: auto; max-width: 100%; }
.navbar-logo { height: 46px; width: auto; max-width: 225px; background: white; border-radius: 4px; padding: 4px; }
.app-header .nav-link { color: #e1edf5; border-radius: .5rem; padding: .65rem .8rem !important; font-size: .9rem; }
.app-header .nav-link:hover, .app-header .nav-link:focus-visible, .app-header .nav-link.active { background: rgba(255,255,255,.12); color: white; }
.auth-nav { gap: .75rem; font-size: .85rem; }
.auth-nav .nav-item:first-child { max-width: 240px; overflow-wrap: anywhere; }
.account-name { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.navbar .btn { white-space: nowrap; font-size: .85rem; }
.navbar .btn-outline-light { border-color: #b8d0df; }
.navbar .btn-primary { background: white; color: var(--tib-primary-dark); border-color: white; }
/* Sidebar */
.admin-sidebar { padding: 1.75rem 1rem; background: white; border-right: 1px solid var(--tib-line); }
.sidebar-title { color: var(--tib-muted); text-transform: uppercase; letter-spacing: .15em; font-size: .7rem; font-weight: 700; padding: .5rem .8rem 1rem; }
.admin-sidebar .nav-link { color: var(--tib-muted); border-radius: .5rem; margin: .2rem 0; padding: .8rem 1rem; font-weight: 600; border-left: 3px solid transparent; }
.admin-sidebar .nav-link:hover, .admin-sidebar .nav-link.active { color: var(--tib-primary); background: var(--tib-primary-light); border-left-color: var(--tib-primary); }
.admin-mobile-toggle { padding: 1rem 1rem 0; }
/* Cards */
.card, .surface-card, .metric-card, .feature-card { background: white; border: 1px solid var(--tib-line); border-radius: 1rem; box-shadow: var(--tib-shadow); }
.card.border-0 { border: 1px solid var(--tib-line) !important; }
.metric-card { height: 100%; padding: 1.5rem; position: relative; transition: transform .2s ease; }
.metric-card:hover { transform: translateY(-3px); }
.metric-card > span:not(.metric-icon) { display: block; color: var(--tib-muted); font-size: .9rem; padding-right: 2rem; }
.metric-card strong { display: block; margin: .4rem 0; font-size: 2.5rem; line-height: 1.1; }
.metric-card small { color: var(--tib-muted); font-size: .8rem; }
.metric-icon { position: absolute; right: 1.25rem; top: 1.3rem; color: var(--tib-primary); font-size: 1.5rem; }
.feature-icon { display: grid; place-items: center; background: var(--tib-primary-light); color: var(--tib-primary); border-radius: .85rem; width: 52px; height: 52px; font-size: 1.7rem; margin-bottom: 1.25rem; }
.empty-state .feature-icon { margin: 0 auto 1.25rem; }
.feature-card { height: 100%; padding: 1.75rem; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: .8rem; }
.feature-card p { color: var(--tib-muted); font-size: .92rem; margin-bottom: 0; }
/* Forms */
.auth-shell { max-width: 540px; padding: 1rem 0; }
.auth-intro { text-align: center; margin-bottom: 2rem; }
.auth-logo { width: 325px; display: block; margin: 0 auto 1.5rem; }
.form-label { font-weight: 600; margin-bottom: .5rem; }
.form-control, .form-select { border-color: #b8cbd8; border-radius: .5rem; padding: .75rem .9rem; color: var(--tib-text); }
.form-control:focus, .form-select:focus { border-color: var(--tib-primary); box-shadow: 0 0 0 .2rem rgba(7,89,133,.15); }
.form-check-input:checked { background-color: var(--tib-primary); border-color: var(--tib-primary); }
textarea.form-control { min-height: 130px; }
.field-validation-error { display: block; font-size: .85rem; margin-top: .4rem; }
.input-validation-error { border-color: #b42318; }
.card:has(form) { overflow: visible; }
.app-content > .row.justify-content-center > [class*="col-"]:has(form) { max-width: 900px; }
.alert { border-radius: .75rem; padding: 1rem 1.25rem; }
.alert-info { color: #124b6d; background: #e8f3fa; border-color: #bed9eb; }
/* Tables */
.table { color: var(--tib-text); --bs-table-hover-bg: #f0f6fa; }
.table thead th { color: var(--tib-primary-dark); background: #edf4f8; border-bottom: 1px solid #c6d7e3; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 1.15rem 1rem; white-space: nowrap; }
.table td { padding: 1rem; border-color: var(--tib-line); }
.table tbody tr:hover > td { background: #f2f7fa; }
.table-responsive { border-radius: 1rem; }
.table td .d-flex { min-width: 230px; }
.table td:first-child { min-width: 180px; overflow-wrap: anywhere; }
.admin-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .4rem; min-width: 260px; }
.badge { font-weight: 600; padding: .5em .75em; white-space: normal; line-height: 1.4; }
.text-bg-primary { background: var(--tib-primary) !important; }
.text-bg-light { color: var(--tib-primary-dark) !important; background: var(--tib-primary-light) !important; }
nav:has(> .btn[asp-route-page]), nav.d-flex.mt-3 { gap: 1rem; padding-top: .5rem; }
/* Buttons */
.btn { border-radius: .5rem; font-weight: 600; padding: .65rem 1rem; transition: background-color .15s ease, box-shadow .15s ease; }
.btn-sm { font-size: .8rem; padding: .4rem .7rem; }
.btn-lg { padding: .85rem 1.4rem; font-size: 1rem; }
.btn-primary { --bs-btn-bg: var(--tib-primary); --bs-btn-border-color: var(--tib-primary); --bs-btn-hover-bg: var(--tib-primary-dark); --bs-btn-hover-border-color: var(--tib-primary-dark); --bs-btn-active-bg: var(--tib-primary-dark); --bs-btn-active-border-color: var(--tib-primary-dark); --bs-btn-disabled-bg: var(--tib-primary); --bs-btn-disabled-border-color: var(--tib-primary); }
.btn-outline-primary { --bs-btn-color: var(--tib-primary); --bs-btn-border-color: var(--tib-primary); --bs-btn-hover-bg: var(--tib-primary); --bs-btn-hover-border-color: var(--tib-primary); --bs-btn-active-bg: var(--tib-primary-dark); --bs-btn-active-border-color: var(--tib-primary-dark); }
.btn-outline-info { --bs-btn-color: var(--tib-primary); --bs-btn-border-color: #8aafc5; --bs-btn-hover-bg: var(--tib-primary); --bs-btn-hover-border-color: var(--tib-primary); --bs-btn-hover-color: white; }
.btn-secondary, .btn-outline-secondary { --bs-btn-color: #425c6e; --bs-btn-bg: #edf2f5; --bs-btn-border-color: #c8d7e1; --bs-btn-hover-bg: #dce8ef; --bs-btn-hover-color: #173348; --bs-btn-hover-border-color: #abc2d2; }
.btn:focus-visible { outline: 3px solid #1983bc; outline-offset: 3px; }
.btn.disabled { opacity: .5; }
/* Course */
.course-card { overflow: hidden; transition: transform .2s ease, box-shadow .2s ease; }
.course-card:hover { transform: translateY(-4px); box-shadow: 0 14px 36px rgba(12,55,83,.12); }
.course-image { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: linear-gradient(135deg, #063d60, #0874a8); }
.course-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.course-image img.course-image-logo { object-fit: contain; background: white; padding: 1rem; }
.course-image-fallback { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #e6f4fd; gap: .75rem; background: radial-gradient(circle at 80% 0%, rgba(255,255,255,.13), transparent 55%); }
.course-image-fallback svg { width: 62px; height: 62px; }
.course-image-fallback span { letter-spacing: .15em; text-transform: uppercase; font-size: .75rem; font-weight: 700; }
.course-hero { overflow: hidden; }
.course-hero .course-image { height: 100%; min-height: 260px; aspect-ratio: auto; }
.progress { height: .5rem; border-radius: 99px; background: #dfeaf2; }
.progress-bar { background: var(--tib-primary); border-radius: 99px; }
.chapter-card { margin-bottom: 1.25rem; }
.chapter-number { flex: 0 0 44px; height: 44px; display: grid; place-items: center; border-radius: .75rem; background: var(--tib-primary-light); color: var(--tib-primary); font-weight: 700; }
.chapter-locked { background: #f8fafb; }
.chapter-card .list-group-item { border-color: var(--tib-line); padding: 1rem; }
.chapter-status { color: var(--tib-muted); font-size: .85rem; }
/* Lesson */
.lesson-reader { max-width: 1050px; background: white; padding: clamp(1.25rem, 4vw, 3rem); border: 1px solid var(--tib-line); border-radius: 1rem; box-shadow: var(--tib-shadow); }
.lesson-content { font-size: 1.08rem; line-height: 1.85; }
.lesson-content section { overflow-wrap: anywhere; }
.lesson-content img { max-height: 650px; object-fit: contain; }
.lesson-content blockquote { background: var(--tib-primary-light); padding: 1.5rem; border-radius: .5rem; font-size: 1.15rem; color: var(--tib-primary-dark); }
.lesson-content hr { color: #b4cad9; opacity: .7; }
.lesson-progress { height: .45rem; }
.lesson-reader > nav:last-child { flex-wrap: wrap; gap: 1rem; }
.lesson-reader > nav:last-child > div { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.breadcrumb { row-gap: .4rem; overflow-wrap: anywhere; }
/* Quiz */
.quiz-shell { max-width: 900px; }
.quiz-choice { cursor: pointer; box-shadow: none; transition: border-color .15s, background-color .15s; }
.quiz-choice:hover { border-color: var(--tib-primary); background: #f5faff; }
.quiz-choice:has(input:checked) { border: 2px solid var(--tib-primary); background: var(--tib-primary-light); }
.quiz-choice:has(input:focus-visible) { outline: 3px solid #1983bc; outline-offset: 3px; }
.quiz-choice .form-check-input { flex-shrink: 0; width: 1.2rem; height: 1.2rem; }
.quiz-choice .card-body { padding: 1.25rem; align-items: baseline; }
.quiz-result { max-width: 850px; margin: auto; }
.result-symbol { margin: 0 auto 1.5rem; width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center; font-size: 2.5rem; color: #166534; background: #eaf6ee; }
.result-symbol.failed { color: #8e2925; background: #fff0ef; }
.result-score { font-size: clamp(3rem, 6vw, 4.5rem); font-weight: 800; color: var(--tib-primary-dark); line-height: 1.2; }
.quiz-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .75rem; }
/* Certificate */
.certificate-card { border-top: 4px solid var(--tib-primary); }
.certificate-card dd { overflow-wrap: anywhere; }
.certificate-preview { background: linear-gradient(135deg, white, #edf6fb); border: 3px solid var(--tib-primary); padding: 3rem; border-radius: 1rem; }
.certificate-logo { width: 360px; height: auto; }
/* Home */
.home-hero { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 4rem; padding: 2rem 0 4rem; }
.hero-logo { width: 345px; display: block; margin-bottom: 2.5rem; }
.hero-copy h1 { font-size: clamp(2.5rem, 4.5vw, 4.5rem); font-weight: 800; margin: 1rem 0 1.5rem; letter-spacing: -.045em; }
.hero-copy h1 span { display: block; color: var(--tib-primary); }
.hero-copy h2 { font-size: 1.3rem; font-weight: 500; line-height: 1.5; margin-bottom: 1rem; }
.hero-copy > p { color: var(--tib-muted); margin-bottom: 1.8rem; max-width: 520px; }
.access-note { color: var(--tib-muted); font-size: .9rem; padding: 1.2rem 0 0; max-width: 460px; }
.hero-visual { position: relative; min-height: 450px; }
.visual-orbit { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, #c5e5f5, #eaf4fa 65%, transparent 66%); }
.visual-card { position: absolute; border: 1px solid #c7dae7; background: white; padding: 1.5rem; border-radius: 1.2rem; box-shadow: 0 18px 45px rgba(7,89,133,.1); }
.visual-main { top: 55px; left: 12%; width: 78%; padding: 2rem; }
.visual-main h3 { font-size: 1.5rem; }
.visual-main p { color: var(--tib-muted); font-size: .85rem; margin: .85rem 0 0; }
.visual-progress { height: 7px; background: #e3eef5; border-radius: 10px; margin-top: 1.5rem; }
.visual-progress span { display: block; width: 75%; height: 100%; border-radius: 10px; background: var(--tib-primary); }
.visual-quiz { bottom: 20px; left: 0; }
.visual-certificate { top: 0; right: 0; }
.visual-quiz, .visual-certificate { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.25rem; }
.visual-card small { display: block; color: var(--tib-muted); font-size: .75rem; }
.visual-card .feature-icon { flex-shrink: 0; }
.visual-quiz .feature-icon, .visual-certificate .feature-icon { margin: 0; width: 42px; height: 42px; }
.home-features { padding: 1rem 0 2rem; }
/* Responsive */
@media (max-width: 1399.98px) {
    .navbar-brand { margin-right: 1rem; gap: .75rem; }
    .navbar-logo { max-width: 190px; height: 42px; }
    .app-header .nav-link { padding: .6rem !important; font-size: .83rem; }
    .auth-nav .nav-item:first-child { max-width: 160px; }
}
@media (max-width: 1199.98px) {
    .navbar-collapse { padding-top: 1rem; padding-bottom: .5rem; }
}
@media (max-width: 991.98px) {
    .app-shell { display: block; }
    .admin-sidebar { border: 1px solid var(--tib-line); margin: 1rem; border-radius: .75rem; }
    .app-header .navbar { min-height: 72px; }
    .navbar-collapse { padding-top: 1rem; padding-bottom: .5rem; }
    .auth-nav { margin-top: .75rem; justify-content: flex-start; }
    .auth-nav .nav-item:first-child { max-width: 100%; }
    .account-name { white-space: normal; }
    .home-hero { gap: 2rem; padding-top: 1rem; grid-template-columns: 1fr; }
    .hero-visual { max-width: 600px; width: 100%; margin: auto; min-height: 400px; }
    .page-heading { align-items: flex-start; flex-wrap: wrap; }
    .footer-note { display: none; }
}
@media (max-width: 575.98px) {
    html { font-size: 15px; }
    .app-content { padding: 1.5rem 1rem 2.5rem; }
    .navbar-brand { gap: .5rem; font-size: .9rem; margin-right: .5rem; }
    .navbar-logo { height: 34px; max-width: 150px; padding: 3px; }
    .navbar-toggler { padding: .35rem; }
    .welcome-panel { padding: 1.5rem; }
    .page-heading { flex-direction: column; }
    .hero-logo { width: 290px; }
    .hero-visual { min-height: 370px; }
    .visual-main { left: 0; width: 100%; top: 65px; padding: 1.5rem; }
    .visual-card strong { font-size: .85rem; }
    .visual-certificate { top: 0; }
    .visual-quiz { bottom: 0; }
    .visual-card h3 { font-size: 1.3rem; }
    .certificate-preview { padding: 1.5rem; }
    .quiz-actions, .quiz-question-actions { flex-direction: column; gap: .75rem; }
    .quiz-actions .btn, .lesson-reader > nav:last-child .btn { width: 100%; }
    .lesson-reader > nav:last-child > div { width: 100%; }
    .lesson-reader > nav:last-child form { width: 100%; }
    .lesson-reader .ms-2 { margin-left: 0 !important; }
    .table { min-width: 680px; }
    .metric-card { padding: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
