/* =====================================================================
   S-Pedagog — zamonaviy qatlam (mavjud dizayn ustidan, uni buzmasdan)
   Faqat animatsiya, o'tishlar, fokus holatlari va kichik tuzatishlar.
   Barcha animatsiyalar "prefers-reduced-motion" da o'chadi.
   ===================================================================== */

:root {
    --sp-primary: #EB8153;
    --sp-primary-dark: #d8693a;
    --sp-primary-soft: rgba(235, 129, 83, .12);
    --sp-ease: cubic-bezier(.2, .8, .2, 1);
    --sp-shadow: 0 6px 18px rgba(17, 24, 39, .08);
    --sp-shadow-lg: 0 16px 36px rgba(17, 24, 39, .14);
    --sp-radius: 12px;
}

html { scroll-behavior: smooth; }

/* ---------- Sahifa kirish animatsiyasi ----------
   Yakuniy holat transform: none — fixed elementlar (modal oynalar) joyidan siljimaydi */
@keyframes spFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}
@keyframes spFadeIn { from { opacity: 0; } to { opacity: 1; } }

.content-body > *:not(#div-add-new):not(script):not(style) {
    animation: spFadeUp .5s var(--sp-ease) both;
}
.content-body > *:nth-child(2) { animation-delay: .04s; }
.content-body > *:nth-child(3) { animation-delay: .08s; }
.content-body > *:nth-child(4) { animation-delay: .12s; }
.content-body > *:nth-child(n+5) { animation-delay: .16s; }

/* ---------- Kartalar ---------- */
.card {
    transition: box-shadow .3s var(--sp-ease), transform .3s var(--sp-ease);
}
.card:hover { box-shadow: var(--sp-shadow-lg); }
.order-card:hover,
.card-custom:hover,
.chart-card:hover,
.info-card:hover { transform: translateY(-4px); }

/* ---------- Tugmalar ---------- */
.btn {
    transition: transform .18s var(--sp-ease), box-shadow .18s var(--sp-ease),
                background-color .2s, border-color .2s, color .2s, opacity .2s;
}
.btn:not(:disabled):not(.disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(17, 24, 39, .14);
}
.btn:not(:disabled):not(.disabled):active { transform: translateY(0) scale(.98); box-shadow: none; }
.btn.sp-loading { opacity: .75; cursor: progress; pointer-events: none; }
.btn .sp-spinner {
    display: inline-block; width: 1em; height: 1em; margin-right: .45em; vertical-align: -.15em;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
    animation: spSpin .7s linear infinite;
}
@keyframes spSpin { to { transform: rotate(360deg); } }

/* ---------- Formalar ---------- */
.form-control, .custom-select, select.form-control {
    transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.form-control:focus, select.form-control:focus {
    border-color: var(--sp-primary);
    box-shadow: 0 0 0 .2rem rgba(235, 129, 83, .18);
}
a:focus-visible, .btn:focus-visible, button:focus-visible {
    outline: 2px solid var(--sp-primary);
    outline-offset: 2px;
}

/* ---------- Jadvallar ---------- */
.table tbody tr {
    transition: background-color .2s;
    animation: spFadeIn .35s ease both;
}
.table tbody tr:nth-child(2)  { animation-delay: .03s; }
.table tbody tr:nth-child(3)  { animation-delay: .06s; }
.table tbody tr:nth-child(4)  { animation-delay: .09s; }
.table tbody tr:nth-child(5)  { animation-delay: .12s; }
.table tbody tr:nth-child(n+6) { animation-delay: .15s; }
.table tbody tr:hover { background-color: rgba(235, 129, 83, .06); }
.table td, .table th { vertical-align: middle; }
thead.sticky th { position: sticky; top: 0; z-index: 2; }

/* ---------- Yon menyu ---------- */
.deznav .metismenu a { transition: color .2s, background-color .2s, padding-left .25s var(--sp-ease); }

/* ---------- Sahifa o'tishidagi yuqori chiziq ---------- */
#sp-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 99999;
    background: linear-gradient(90deg, var(--sp-primary), #ffb38f);
    box-shadow: 0 0 10px rgba(235, 129, 83, .6);
    transition: width .4s var(--sp-ease), opacity .3s;
    opacity: 0; pointer-events: none;
}
#sp-progress.active { opacity: 1; width: 75%; transition: width 8s cubic-bezier(.1, .7, .1, 1), opacity .2s; }

/* ---------- Bildirishnomalar (toast) ---------- */
.sp-toast-stack {
    position: fixed; top: 92px; right: 20px; z-index: 1080;
    display: flex; flex-direction: column; gap: 10px;
    width: min(380px, calc(100vw - 40px));
    pointer-events: none;
}
.sp-toast-stack .alert {
    pointer-events: auto; margin: 0; border: 0; border-radius: 10px;
    box-shadow: var(--sp-shadow-lg);
    animation: spSlideIn .45s var(--sp-ease) both;
    position: relative; overflow: hidden;
}
.sp-toast-stack .alert .sp-toast-bar {
    position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
    background: rgba(255, 255, 255, .55); transform-origin: left;
    animation: spShrink linear forwards;
}
.sp-toast-stack .alert.sp-toast-out { animation: spSlideOut .35s ease forwards; }
@keyframes spSlideIn  { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes spSlideOut { to { opacity: 0; transform: translateX(40px); height: 0; padding-top: 0; padding-bottom: 0; } }
@keyframes spShrink   { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- Tasdiqlash oynasi ---------- */
.sp-confirm {
    position: fixed; inset: 0; z-index: 100000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(17, 24, 39, .45); backdrop-filter: blur(3px);
    animation: spFadeIn .2s ease both;
}
.sp-confirm-box {
    background: #fff; border-radius: 16px; padding: 26px 26px 20px; width: min(380px, calc(100vw - 32px));
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25); text-align: center;
    animation: spPop .3s var(--sp-ease) both;
}
.sp-confirm-icon {
    width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #fdecea; color: #e5533d; font-size: 28px; font-weight: 700;
}
.sp-confirm-box h5 { margin-bottom: 6px; color: #222; }
.sp-confirm-box p { color: #6b7280; margin-bottom: 18px; }
.sp-confirm-actions { display: flex; gap: 10px; justify-content: center; }
.sp-confirm-actions .btn { min-width: 110px; }
@keyframes spPop { from { opacity: 0; transform: scale(.92) translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Sarlavhadagi qidiruv ---------- */
.search-area { position: relative; }
.sp-search-results {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 1050;
    background: #fff; border-radius: 12px; box-shadow: var(--sp-shadow-lg);
    max-height: 340px; overflow-y: auto; padding: 6px;
    animation: spFadeUp .2s var(--sp-ease) both;
}
.sp-search-results a {
    display: block; padding: 9px 12px; border-radius: 8px; color: #333;
    font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: background-color .15s, color .15s;
}
.sp-search-results a small { display: block; color: #9ca3af; font-size: 11px; }
.sp-search-results a:hover, .sp-search-results a.active { background: var(--sp-primary-soft); color: var(--sp-primary-dark); }
.sp-search-results mark { background: none; color: var(--sp-primary); padding: 0; font-weight: 600; }
.sp-search-empty { padding: 12px; color: #9ca3af; font-size: 13px; text-align: center; }

/* ---------- Yuqoriga qaytish ---------- */
#sp-top {
    position: fixed; right: 22px; bottom: 22px; z-index: 1040;
    width: 44px; height: 44px; border-radius: 50%; border: 0;
    background: var(--sp-primary); color: #fff; font-size: 20px; line-height: 44px;
    box-shadow: 0 8px 20px rgba(235, 129, 83, .45);
    opacity: 0; transform: translateY(16px); pointer-events: none;
    transition: opacity .3s, transform .3s var(--sp-ease), background-color .2s;
}
#sp-top.show { opacity: 1; transform: none; pointer-events: auto; }
#sp-top:hover { background: var(--sp-primary-dark); }

/* ---------- Kichik tuzatishlar ---------- */
/* Dars elementlari havolalari (bosh sahifa) */
.card-body a.bg-primary { transition: transform .2s var(--sp-ease), box-shadow .2s, filter .2s; }
.card-body a.bg-primary:hover { transform: translateX(4px); box-shadow: 0 4px 12px rgba(235, 129, 83, .35); filter: brightness(1.05); }
/* "Ma'lumotlar ... qabul qilindi" belgisi */
.content-body .bg-success.text-light.p-1.rounded { display: inline-block; animation: spFadeIn .6s ease both; }
/* Progress chiziqlari silliq to'lishi */
.progress-bar { transition: width .9s var(--sp-ease); }
/* Uzun matnlar jadvaldan chiqib ketmasin */
.table td { overflow-wrap: break-word; }
/* Rasm va iframe chegaradan chiqmasin */
.content-body img, .content-body iframe { max-width: 100%; }
/* Moslikni topish o'yinidagi elementlar */
.item.matched { transition: all .35s var(--sp-ease); }

/* =====================================================================
   v2 — Kontent bloklari: kartalar, formalar, jadvallar, ro'yxatlar
   Ranglar va joylashuv o'zgarmaydi; faqat yumaloq burchaklar, soyalar,
   bo'shliqlar va animatsiyalar. Hammasi .content-body ichida (menyu/sarlavhaga tegmaydi).
   ===================================================================== */

/* ---------- Umumiy ---------- */
.content-body .btn { border-radius: 10px; font-weight: 500; }
.content-body .alert { border-radius: 12px; }
.content-body .card { border-radius: 18px; border: 0; box-shadow: 0 2px 10px rgba(17, 24, 39, .06); }
.content-body .card-header { border-radius: 18px 18px 0 0 !important; background: transparent; border-bottom: 1px solid #f1f1f4; }
.content-body hr { border-top-color: #f1f1f4; }

/* ---------- Formalar (qo'shish / tahrirlash / sozlamalar) ---------- */
.content-body form.container.shadow,
.content-body form.shadow.rounded,
.content-body .container.shadow.form-group {
    background: #fff;
    border-radius: 20px !important;
    box-shadow: 0 10px 30px rgba(17, 24, 39, .07) !important;
    padding: 28px 30px !important;
    border: 1px solid #f3f3f6;
    position: relative;
    overflow: hidden;
}
/* Yuqorida ingichka brend chizig'i */
.content-body form.container.shadow::before,
.content-body form.shadow.rounded::before {
    content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, #EB8153, #f6b08f);
}
.content-body form.container.shadow h4,
.content-body form.shadow.rounded h4 {
    font-weight: 600; margin-bottom: 22px; position: relative; padding-bottom: 12px;
}
.content-body form.container.shadow h4::after,
.content-body form.shadow.rounded h4::after {
    content: ""; position: absolute; left: 50%; bottom: 0; width: 46px; height: 3px;
    margin-left: -23px; border-radius: 3px; background: currentColor; opacity: .55;
}
.content-body form.container.shadow > strong,
.content-body form.container.shadow > label,
.content-body form.shadow.rounded strong {
    display: block; font-size: 13px; font-weight: 600; color: #4b5563; margin: 12px 0 6px;
}
.content-body .form-control {
    border-radius: 12px;
    border: 1px solid #e7e8ee;
    background-color: #fbfbfc;
    min-height: 46px;
}
.content-body .form-control:hover { border-color: #d9dbe3; }
.content-body .form-control:focus { background-color: #fff; }
.content-body textarea.form-control { min-height: 96px; }
.content-body form .btn[type="submit"], .content-body form input.btn[type="submit"] {
    padding: .62rem 1.5rem; margin: 14px 6px 0 0; border-radius: 12px; font-weight: 600;
}

/* Fayl tanlash maydoni */
.content-body input[type="file"].form-control {
    padding: 8px; min-height: 52px; border-style: dashed; cursor: pointer; background: #fff;
}
.content-body input[type="file"]::file-selector-button {
    border: 0; border-radius: 9px; padding: 8px 14px; margin-right: 12px;
    background: var(--sp-primary); color: #fff; font-weight: 600; cursor: pointer;
    transition: filter .2s;
}
.content-body input[type="file"]::file-selector-button:hover { filter: brightness(1.08); }

/* ---------- Qidiruv maydonlari (jadval ustida) ---------- */
.content-body input[id^="searchInput"] {
    border-radius: 14px; min-height: 46px; padding-left: 44px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 16px center;
    box-shadow: 0 2px 8px rgba(17, 24, 39, .04);
}

/* "Ma'lumotlar ... qabul qilindi" belgisi — ixcham pill */
.content-body span.bg-success.text-light.p-1.rounded {
    border-radius: 999px !important; padding: 5px 14px !important; font-size: 12px;
    box-shadow: 0 4px 12px rgba(40, 167, 69, .22);
}
.content-body span.bg-success.text-light.p-1.rounded::before { content: "⚡ "; }

/* ---------- Jadvallar ---------- */
.content-body .table-responsive { border-radius: 18px; }
.content-body .table {
    border-collapse: separate; border-spacing: 0;
    background: #fff; border-radius: 18px; overflow: hidden;
    box-shadow: 0 8px 26px rgba(17, 24, 39, .07);
    border: 1px solid #f0f0f4 !important;
}
.content-body .table thead th {
    background: #EB8153 !important;
    color: #fff; border: 0 !important; padding: 15px 14px;
    font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    position: static;
}
.content-body .table td {
    border-color: #f2f2f6 !important; padding: 13px 14px; color: #4b5563;
    border-left: 0 !important; border-right: 0 !important;
}
.content-body .table tbody tr:nth-child(even) { background-color: #fcfcfd; }
.content-body .table tbody tr:hover { background-color: rgba(235, 129, 83, .06); }
.content-body .table tbody tr:last-child td { border-bottom: 0 !important; }
/* Jadvaldagi ikonka tugmalar */
.content-body .table td > a.btn {
    width: 40px; height: 40px; padding: 0; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(17, 24, 39, .12);
}
.content-body .table td > a.btn:hover { transform: translateY(-2px) scale(1.05); }
.content-body .table .badge, .content-body .table td > span.rounded {
    border-radius: 999px !important; padding: 5px 12px !important; font-weight: 500;
}

/* ---------- Admin bosh sahifa kartalari ---------- */
.content-body .order-card { border-radius: 20px; overflow: hidden; position: relative; }
.content-body .order-card::after {
    content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px;
    border-radius: 50%; background: rgba(255, 255, 255, .14); pointer-events: none;
}
.content-body .order-card i { width: 42px; height: 42px; line-height: 42px; text-align: center; border-radius: 12px; background: rgba(255, 255, 255, .2); }

/* ---------- Topshiriq turi tanlash tugmalari (#h1, #h2, #h3) ---------- */
.content-body #h1, .content-body #h2, .content-body #h3 {
    border-radius: 16px !important; cursor: pointer;
    box-shadow: 0 6px 16px rgba(40, 167, 69, .22);
    transition: transform .2s var(--sp-ease), box-shadow .2s, filter .2s;
}
.content-body #h1:hover, .content-body #h2:hover, .content-body #h3:hover { transform: translateY(-3px); filter: brightness(1.05); }
.content-body #h1.sp-active, .content-body #h2.sp-active, .content-body #h3.sp-active {
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(40, 167, 69, .45), 0 8px 20px rgba(40, 167, 69, .3);
}
.content-body .row.pl-5.text-center > .bg-success { border-radius: 16px !important; }

/* ---------- Mustaqil / Amaliy ro'yxatlari (o'quvchi) ---------- */
.content-body .open-close-lessons > .bg-primary {
    border-radius: 18px !important; padding: 14px !important;
    box-shadow: 0 8px 22px rgba(235, 129, 83, .28);
    align-items: center;
    transition: transform .25s var(--sp-ease), box-shadow .25s;
}
.content-body .open-close-lessons > .bg-primary:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(235, 129, 83, .36); }
.content-body .open-close-lessons > .bg-primary > span { border-radius: 12px !important; padding: 12px !important; }
.content-body .open-close-lessons > .bg-primary > span:first-child a { display: block; }
.content-body .open-close-lessons > .bg-primary > span:first-child { transition: background-color .2s, transform .2s; }
.content-body .open-close-lessons > .bg-primary > span:first-child:hover { transform: scale(1.04); }

/* Topshiriq sahifasi (yuklab olish / yuborish) */
.content-body .form-group.container.shadow.rounded.bg-primary {
    background: #EB8153 !important; border: 0; padding: 22px !important;
    box-shadow: 0 16px 36px rgba(235, 129, 83, .3) !important;
}
.content-body .form-group.container.shadow.rounded.bg-primary .bg-light,
.content-body .form-group.container.shadow.rounded.bg-primary form {
    border-radius: 16px !important; padding: 18px !important; margin-bottom: 8px; height: 100%;
}
.content-body .form-group.container.shadow.rounded.bg-primary .row { row-gap: 12px; }
.content-body .form-group.container.shadow.rounded.bg-primary h4 { font-weight: 600; margin-bottom: 14px; }

/* Admin: yangi fayl qo'shish oynasi */
#div-add-new { backdrop-filter: blur(4px); }
#div-add-new .add-form form {
    max-width: 540px; margin: 8vh auto 0; border-radius: 22px !important; padding: 30px !important;
    box-shadow: 0 30px 70px rgba(0, 0, 0, .35) !important;
    animation: spPop .35s var(--sp-ease) both;
}
#div-add-new .add-form form h4 { margin-bottom: 18px; }
#div-add-new .form-control { border-radius: 12px; min-height: 46px; }

/* ---------- O'quvchi bosh sahifasi (darslar) ---------- */
.content-body span.shadow.bg-primary.text-light.p-2.rounded {
    display: inline-block; border-radius: 999px !important; padding: 9px 20px !important;
    box-shadow: 0 8px 20px rgba(235, 129, 83, .35) !important;
}
.content-body .row > .card.m-2 { border-radius: 20px; padding: 6px 4px; }
.content-body .row > .card.m-2 .card-header { font-weight: 600; }
.content-body .row > .card.m-2 .card-title {
    display: block; width: fit-content; padding: 4px 10px; border-radius: 8px; background: #f8f8fa; margin-top: 6px;
}
.content-body .card-body a.bg-primary { border-radius: 999px !important; padding: 5px 14px !important; font-weight: 500; }
.content-body .card-body a.bg-primary + hr { margin: 8px 0 10px; }

/* ---------- Dars sahifasi ---------- */
.content-body h4.bg-warning.rounded-top { border-radius: 18px 18px 0 0 !important; letter-spacing: .02em; }
.content-body .game-container { border-radius: 0 0 18px 18px; border-color: #f0f0f4; }
.content-body .item { border-radius: 12px; }
.content-body #fill-in-container, .content-body #test-container { border-radius: 0 0 18px 18px; }
.content-body .text-justify.bg-light.rounded.shadow-sm { border-radius: 18px !important; }
.content-body iframe { border-radius: 0 0 18px 18px; display: block; }

/* ---------- Natija sahifalari ---------- */
.content-body .card-custom, .content-body .chart-card, .content-body .info-card { border-radius: 20px; }
.content-body .element-badge { box-shadow: 0 6px 14px rgba(0, 0, 0, .12); transition: transform .2s var(--sp-ease); }
.content-body .element-badge:hover { transform: scale(1.1); }
.content-body .list-group-item { border-color: #f1f1f4; }
.content-body .accordion-item, .content-body .accordion-button { border-radius: 14px !important; }
.content-body .row.bg-primary.text-white.rounded { border-radius: 18px !important; box-shadow: 0 10px 26px rgba(235, 129, 83, .28); }

/* Profil va bo'sh holat xabarlari */
.content-body .alert-info { border: 0; background: #f0f7ff; color: #1e5a96; }

/* Skrollbar */
* { scrollbar-width: thin; scrollbar-color: rgba(235, 129, 83, .55) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(235, 129, 83, .5); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(235, 129, 83, .8); }

@media (max-width: 767px) {
    .sp-toast-stack { top: 76px; right: 12px; width: calc(100vw - 24px); }
}

/* Harakatni kamaytirish sozlamasi yoqilgan foydalanuvchilar uchun */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important; animation-delay: 0s !important;
        transition-duration: .001ms !important; scroll-behavior: auto !important;
    }
}
