:root {
    --bs-primary: #3157d5;
    --bs-primary-rgb: 49, 87, 213;
    --bs-link-color: #3157d5;
    --bs-link-hover-color: #2443ad;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f4f6fb;
}

a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .nav-link:hover, .dropdown-item:hover, .list-group-item-action:hover, .card-link:hover, .page-link:hover { text-decoration: none; }

.btn-primary { --bs-btn-bg: #3157d5; --bs-btn-border-color: #3157d5; --bs-btn-hover-bg: #2443ad; --bs-btn-hover-border-color: #2443ad; }
.btn-outline-primary { --bs-btn-color: #3157d5; --bs-btn-border-color: #3157d5; --bs-btn-hover-bg: #3157d5; --bs-btn-hover-border-color: #3157d5; }
.bg-primary { background-color: #3157d5 !important; }
.text-primary { color: #3157d5 !important; }

.breadcrumb { font-size: .875rem; }

/* Bosh sahifa */
.hero {
    background: linear-gradient(135deg, #3157d5 0%, #6a3fd0 100%);
}
.hero-stat {
    background: rgba(255, 255, 255, .15);
    border-radius: 1rem;
    padding: 1rem .5rem;
}
.feature-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: rgba(49, 87, 213, .1);
    color: #3157d5;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

/* Kirish bo'limlari */
.portal-icon {
    width: 72px; height: 72px;
    border-radius: 18px;
    background: rgba(49, 87, 213, .1);
    color: #3157d5;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    margin-bottom: 1rem;
}
.portal-icon-admin { background: rgba(33, 37, 41, .08); color: #212529; }
.login-switch { background: #fff; border-radius: .75rem; padding: .3rem; box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075); }
.login-switch .nav-link { border-radius: .55rem; color: #495057; }
.login-switch .nav-link.active { background: #3157d5; color: #fff; }

/* Statistik kartochkalar */
.stat-card {
    background: #fff;
    border-radius: .75rem;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075);
    height: 100%;
}
.stat-card > i {
    font-size: 1.6rem;
    color: #3157d5;
    background: rgba(49, 87, 213, .1);
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-value { font-size: 1.4rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .8rem; color: #6c757d; }
a.stat-card { color: inherit; height: 100%; transition: transform .15s, box-shadow .15s; }
a.stat-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .08); }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
    background: #fff;
    border-radius: .75rem;
    border: 2px dashed #dee2e6;
}
.empty-state > i { font-size: 2.5rem; display: block; margin-bottom: .5rem; opacity: .6; }

.card-link { color: inherit; display: block; transition: transform .15s, box-shadow .15s; }
.card-link:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .08) !important; }

/* Kurslar */
.course-card { overflow: hidden; transition: transform .15s, box-shadow .15s; }
.course-card:hover { transform: translateY(-3px); box-shadow: 0 .75rem 1.5rem rgba(0, 0, 0, .1) !important; }
.course-cover {
    height: 110px;
    background: linear-gradient(135deg, hsl(var(--hue), 65%, 55%), hsl(calc(var(--hue) + 40), 65%, 45%));
    display: flex; align-items: center; justify-content: center;
    color: rgba(255, 255, 255, .85);
    font-size: 2.6rem;
}
.course-description { white-space: normal; }

.info-box { background: #f4f6fb; border-radius: .75rem; padding: .75rem .5rem; }

/* Test topshirish */
.question-text { font-size: 1.05rem; font-weight: 500; }
.answer-option {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .75rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: .6rem;
    margin-bottom: .5rem;
    cursor: pointer;
    transition: background .1s, border-color .1s;
}
.answer-option:hover { background: #f4f6fb; }
.answer-option:has(input:checked) { border-color: #3157d5; background: rgba(49, 87, 213, .07); }
.answer-option .form-check-input { margin-top: .3rem; flex-shrink: 0; }
.option-letter {
    font-weight: 600;
    color: #6c757d;
    min-width: 1.2rem;
}

.test-sidebar { position: sticky; top: 1rem; }
.timer {
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}
.timer.text-danger { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .5; } }

.q-nav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; }
.q-nav {
    display: flex; align-items: center; justify-content: center;
    height: 36px;
    border-radius: .4rem;
    border: 1px solid #dee2e6;
    color: #495057;
    font-size: .85rem;
    font-weight: 500;
}
.q-nav:hover { background: #f4f6fb; text-decoration: none; }
.q-nav.answered { background: #3157d5; border-color: #3157d5; color: #fff; }

@media (max-width: 991.98px) {
    .test-sidebar { position: sticky; top: 0; z-index: 10; }
    .test-sidebar .q-nav-grid { grid-template-columns: repeat(10, 1fr); }
    .timer { font-size: 1.5rem; }
}

/* Natijalar */
.result-circle {
    --p: 0;
    width: 150px; height: 150px;
    border-radius: 50%;
    margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    background: conic-gradient(var(--c) calc(var(--p) * 1%), #e9ecef 0);
    position: relative;
}
.result-circle::before {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: #fff;
}
.result-circle span { position: relative; font-size: 1.8rem; font-weight: 700; }
.result-circle.pass { --c: #198754; }
.result-circle.fail { --c: #dc3545; }

.review-card { border-left: 4px solid #dc3545 !important; }
.review-card.ok { border-left-color: #198754 !important; }
.review-option {
    display: flex; align-items: flex-start; gap: .75rem;
    padding: .5rem .75rem;
    border-radius: .5rem;
    margin-bottom: .35rem;
    border: 1px solid transparent;
}
.review-option.correct { background: #e8f5ee; border-color: #b7e0c8; }
.review-option.wrong { background: #fdecee; border-color: #f3b8bf; }

.table > :not(caption) > * > * { padding: .7rem .75rem; }

/* Kurs jurnali */
.journal-table > :not(caption) > * > * { padding: .45rem .5rem; }
.journal-table .journal-test { min-width: 90px; max-width: 140px; font-size: .85rem; white-space: normal; }
.journal-table .cell-pass { background: #e8f5ee; }
.journal-table .cell-fail { background: #fdecee; }

/* Import natijasi: login-parol kartochkalari */
.cred-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.cred-card {
    background: #fff;
    border: 1px dashed #adb5bd;
    border-radius: .5rem;
    padding: .75rem 1rem;
    break-inside: avoid;
    page-break-inside: avoid;
}
.cred-line { font-size: .95rem; }
.cred-line > span:first-child { display: inline-block; width: 52px; color: #6c757d; }
.cred-line code { font-size: 1rem; color: #212529; }

/* Chop etish */
@media print {
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    body { background: #fff; display: block; min-height: 0; }
    nav.navbar, footer, .breadcrumb, .alert-dismissible, .btn { display: none !important; }
    main.container { max-width: none; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #dee2e6 !important; }
    .stat-card { box-shadow: none; border: 1px solid #dee2e6; }
    .table-responsive { overflow: visible !important; }
    .tab-content > .tab-pane { display: block !important; opacity: 1 !important; }
    a { color: inherit !important; text-decoration: none !important; }
    tr, .review-card, .stat-card { break-inside: avoid; page-break-inside: avoid; }
    thead { display: table-header-group; }
    .journal-table { font-size: 10px; }
    .cred-grid { grid-template-columns: repeat(3, 1fr); }
}

/* PDF eksporti paytida (html2pdf) — chop etish ko'rinishi bilan bir xil */
.pdf-export { background: #fff; }
.pdf-export .d-print-none, .pdf-export .btn { display: none !important; }
.pdf-export .d-print-block { display: block !important; }
.pdf-export .tab-content > .tab-pane { display: block !important; opacity: 1 !important; }
.pdf-export .table-responsive { overflow: visible !important; }
.pdf-export .card, .pdf-export .stat-card { box-shadow: none !important; border: 1px solid #dee2e6 !important; }
.pdf-export a { color: inherit !important; }
.pdf-export .journal-table { font-size: 11px; }
.pdf-export .cred-grid { grid-template-columns: repeat(3, 1fr); }
/* html2canvas conic-gradient ni chizmaydi — oddiy halqa bilan almashtiriladi */
.pdf-export .result-circle { background: none; border: 12px solid var(--c); }
.pdf-export .result-circle::before { display: none; }
