/* ===== responsive.css: faqat @media qoidalari ===== */

/* Planshet va telefon: 1023px va kichik */
@media (max-width: 1023px) {
    .ut-card {
        min-height: 280px;
    }

    /* ---- Navbar: burger chapda, logo o'rtada, profil o'ngda ---- */
    .ut-nav-in {
        grid-template-columns: auto 1fr auto; /* uch ustun: burger | logo | profil */
    }
    .ut-burger {
        display: flex; /* burger ko'rinadi */
    }
    .ut-logo {
        justify-self: center; /* logo o'rtada (chapga qo'yish uchun: start) */
    }
    .ut-links {
        display: none; /* gorizontal havolalar yashiriladi, ular panelda */
    }

    /* Burger paneli: chapdan suriladi */
    .ut-dr {
        display: flex; /* panel ishlaydi */
        flex-direction: column; /* tepada logo, pastda havolalar */
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 80;
        width: 300px;
        max-width: 85vw; /* tor ekranda butun ekranni egallamaydi */
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
        background: var(--ut-bg, #030712);
        border-right: 1px solid var(--ut-line);
        overflow-y: auto;
        -webkit-transform: translateX(-100%);
        transform: translateX(-100%); /* boshida chapga yashirin */
        visibility: hidden;
        transition:
            transform 0.2s,
            visibility 0s 0.2s;
    }
    .ut-dr.ut-open {
        -webkit-transform: none;
        transform: none; /* ochiq holat */
        visibility: visible;
        transition-delay: 0s;
    }
    .ut-dr-top {
        display: flex;
        align-items: center;
        justify-content: space-between; /* logo chapda, ✕ o'ngda */
        padding-bottom: 16px;
        margin-bottom: 12px;
        border-bottom: 1px solid var(--ut-line);
    }
    .ut-dr-top img {
        display: block;
        height: 52px;
        width: auto; /* panel tepasidagi logo */
    }
    .ut-dr-x {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        background: none;
        border: 0;
        border-radius: 8px;
        color: var(--ut-text);
        cursor: pointer;
    }
    .ut-dr-x:hover {
        background: var(--ut-panel2);
    }
    .ut-dr-x svg {
        width: 24px;
        height: 24px;
    }
    .ut-dr nav {
        display: flex;
        flex-direction: column; /* havolalar ustun bo'lib */
        gap: 4px;
    }
    .ut-dr nav a {
        display: flex;
        align-items: center;
        min-height: 48px; /* barmoq uchun qulay balandlik */
        padding: 0 14px;
        border-radius: 8px;
        color: var(--ut-text);
        font-size: 16px;
    }
    .ut-dr nav a:hover {
        background: var(--ut-panel2);
    }
    .ut-dr nav a.ut-on {
        color: var(--ut-accent); /* faol sahifa */
    }
    .ut-dr-back {
        display: block; /* orqa fon ishlaydi */
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 75;
        background: rgba(0, 0, 0, 0.6);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s;
    }
    .ut-dr-back.ut-open {
        opacity: 1;
        visibility: visible;
    }
}

/* Telefon: 640px va kichik — 2 ustun */
@media (max-width: 640px) {
    .ut-nav-in {
        padding: 0 8px;
        gap: 4px;
    }
    .ut-logo img {
        height: 42px;
    }
    .ut-main {
        padding: 16px 12px;
    }
    .ut-h1 {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .ut-grid {
        grid-template-columns: minmax(0, 320px);
        justify-content: center;
        gap: 12px;
    }
    .ut-card {
        min-height: 250px;
        padding: 18px 8px;
    }
    .ut-card h2 {
        font-size: 14px;
    }
    .ut-pic,
    .ut-plus {
        width: 64px;
        height: 64px;
    }
    .ut-plus svg {
        width: 44px;
        height: 44px;
    }
    .ut-btn {
        min-height: 40px;
        width: 100%;
    }
    .ut-foot {
        margin: 20px 8px 8px;
    }

    /* ---- Test sahifasi (telefon) ---- */
    .ut-test {
        padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }
    .ut-t-grid {
        display: block;
    }

    /* Tepada yopishib turuvchi taymer paneli */
    .ut-t-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        z-index: 40;
        margin: 0 0 12px;
        padding: 6px 12px;
        background: var(--ut-panel);
        border: 1px solid var(--ut-line);
        border-radius: 10px;
    }
    .ut-t-bar .ut-time {
        font-size: 24px;
    }
    .ut-t-open {
        min-height: 44px;
        padding: 0 16px;
        background: var(--ut-accent);
        border: 0;
        border-radius: 8px;
        color: #111;
        font: inherit;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
    }

    /* Savollar paneli: pastdan ochiladi */
    .ut-t-side {
        position: fixed;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 70;
        width: auto;
        max-height: 80vh;
        max-height: 80dvh;
        margin: 0;
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
        background: var(--ut-bg, #030712);
        border-top: 1px solid var(--ut-line);
        border-radius: 16px 16px 0 0;
        -webkit-transform: translateY(100%);
        transform: translateY(100%);
        visibility: hidden;
        transition:
            transform 0.2s,
            visibility 0s 0.2s;
    }
    .ut-t-side.ut-open {
        -webkit-transform: none;
        transform: none;
        visibility: visible;
        transition-delay: 0s;
    }
    .ut-t-side .ut-timer {
        display: none;
    }
    .ut-t-sh {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        font-weight: 600;
    }
    .ut-t-back {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 65;
        background: rgba(0, 0, 0, 0.6);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s;
    }
    .ut-t-back.ut-open {
        opacity: 1;
        visibility: visible;
    }

    /* Savol raqamlari: barmoq uchun 44px */
    .ut-sqs {
        grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    }
    .ut-sq {
        width: 100%;
        height: 44px;
        font-size: 14px;
    }
    .ut-sq-m {
        font-size: 13px;
    }
    .ut-sq-s {
        font-size: 11px;
    }

    /* Oldingi / Keyingi: ekran pastiga qadalgan */
    .ut-t-foot {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 50;
        margin: 0;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
        background: var(--ut-panel);
        border-top: 1px solid var(--ut-line);
    }

    /* Ixchamroq bloklar */
    .ut-t-head {
        padding: 14px;
        margin-bottom: 12px;
    }
    .ut-t-head h1 {
        font-size: 18px;
    }
    .ut-q {
        padding: 16px;
    }

    /* ---- Natijalar sahifasi (telefon) ---- */
    .ut-r-head {
        padding: 20px 12px;
    }
    .ut-r-head h1 {
        font-size: 22px;
    }
    .ut-r-stats {
        gap: 8px;
    }
    .ut-r-stat {
        padding: 12px 4px;
    }
    .ut-r-stat small {
        font-size: 12px;
    }
    .ut-r-stat b {
        font-size: 22px;
    }
    .ut-r-card {
        padding: 14px;
    }

    /* ---- Login va register (telefon) ---- */
    .ut-auth-card {
        padding: 20px 16px;
    }

    /* ---- Tariflar (telefon) ---- */
    .ut-p-head {
        margin-bottom: 20px;
    }
    .ut-p-head h1 {
        font-size: 26px;
    }
    .ut-p-head p {
        font-size: 16px;
    }
    .ut-p-cur {
        padding: 12px 16px;
    }
    /* Karta 420px dan kengaymaydi va markazda turadi */
    .ut-plans {
        grid-template-columns: minmax(0, 420px);
        justify-content: center;
        gap: 28px;
    }
    .ut-p-help {
        margin-top: 32px;
    }

    /* ---- Dashboard (telefon) ---- */
    .ut-d-top {
        flex-direction: column;
        padding: 16px;
    }
    .ut-d-top h1 {
        font-size: 20px;
    }
    .ut-d-plan {
        text-align: left;
    }
    .ut-d-stats {
        gap: 8px;
    }
    .ut-d-stat {
        padding: 14px 4px;
    }
    .ut-d-stat small {
        font-size: 12px;
    }
    .ut-d-stat b {
        font-size: 24px;
    }
    .ut-d-stat span {
        display: none;
    }
    .ut-d-links {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }
    .ut-d-res {
        padding: 16px;
    }
    .ut-d-row {
        padding: 10px 12px;
    }
    .ut-d-l {
        gap: 12px;
    }
    .ut-d-pct {
        width: 44px;
        height: 44px;
        font-size: 12px;
    }

    .ut-pf {
        padding: 20px 12px;
    } /* telefonda tashqi bo'sh joy kamayadi */
    .ut-pf-card {
        padding: 16px;
        border-radius: 12px;
    } /* kartaning ichki bo'sh joyi kichrayadi */
    .ut-pf-btn {
        width: 100%;
    } /* tugma to'liq kenglikda */

    .ut-vres {
        /* Natija nishoni */
        font-size: 12px; /* Matnni biroz kichraytiramiz */
        padding: 3px 9px; /* Ichki bo'shliqni kamaytiramiz */
        margin-top: 8px; /* Tepadagi masofani kamaytiramiz */
    }
}

/* Katta monitorlar: 1600px va undan katta — container kengayadi */
@media (min-width: 1600px) {
    .ut-main {
        max-width: 1480px;
    }
    .ut-wrap {
        max-width: 1400px;
    }
    .ut-grid {
        grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
        gap: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ut-t-side,
    .ut-t-back,
    .ut-dr,
    .ut-dr-back {
        transition: none;
    }
}

/* ===== Foydali xizmatlar: responsive ===== */
@media (max-width: 1024px) {
    /* Planshet */
    .ut-u-grid {
        grid-template-columns: repeat(2, 1fr);
    } /* 2 ustun */
}
@media (max-width: 640px) {
    /* Telefon */
    .ut-u-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    } /* 1 ustun */
    .ut-u-panel {
        padding: 16px;
    } /* Ixcham panel */
    .ut-u-form {
        grid-template-columns: 1fr;
    } /* Maydonlar ustma-ust */
    .ut-u-res {
        flex-direction: column;
        gap: 2px;
    } /* Yorliq va qiymat ustma-ust */
    .ut-u-k {
        min-width: 0;
    }
    .ut-u-tbl {
        min-width: 420px;
    } /* Jadval gorizontal aylanadi */
    .ut-u-acts .ut-tbtn {
        flex: 1 1 auto;
    } /* Tugmalar kengayadi */
}
