/* ============ SETTINGS PANEL (theme + language) ============ */

/* Trigger button — navbar / sidebar ichida ishlatiladi */
.settings-trigger {
    width: 40px;
    height: 40px;
    background: var(--gray-100);
    border: none;
    border-radius: 10px;
    color: var(--gray-700);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition, all 0.2s ease);
    margin-right: 8px;
}
.settings-trigger:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    transform: rotate(45deg);
}

/* Overlay */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.settings-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Panel — o'ng tomondan chiqadi */
.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 92vw;
    height: 100vh;
    background: var(--white);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.12);
    z-index: 999;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.settings-panel.show {
    transform: translateX(0);
}

/* Header */
.settings-head {
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.settings-head h3 {
    font-size: 19px;
    margin-bottom: 2px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    color: var(--gray-900);
}
.settings-head p {
    font-size: 12.5px;
    color: var(--gray-500);
}
.settings-close {
    width: 36px;
    height: 36px;
    background: var(--gray-100);
    border: none;
    border-radius: 8px;
    color: var(--gray-700);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition, all 0.2s ease);
}
.settings-close:hover {
    background: #FEE2E2;
    color: var(--danger, #EF4444);
}

/* Body */
.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 30px;
}

/* Section */
.settings-section { margin-bottom: 14px; }
.settings-section:last-child { margin-bottom: 0; }
.settings-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gray-500);
    margin-bottom: 12px;
}
.settings-label i { color: var(--primary); }

/* ===== Akkordion — bo'limlar sarlavhaga bosilganda ochiladi ===== */
.settings-section[data-accordion] { margin-bottom: 12px; }
.settings-section[data-accordion] > .settings-label {
    width: 100%;
    margin-bottom: 0;
    padding: 14px 16px;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    color: var(--gray-600);
    transition: var(--transition, all 0.2s ease);
}
.settings-section[data-accordion] > .settings-label:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}
.settings-section[data-accordion].open > .settings-label {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.settings-acc-arrow {
    margin-left: auto;
    font-size: 12px;
    color: var(--gray-400) !important;
    transition: transform 0.3s ease;
}
.settings-section[data-accordion].open .settings-acc-arrow {
    transform: rotate(180deg);
    color: var(--primary) !important;
}

/* Collapsible body — grid-rows 0fr -> 1fr orqali silliq ochilish */
.settings-section-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid transparent;
    border-top: none;
    border-radius: 0 0 12px 12px;
}
.settings-section[data-accordion].open .settings-section-body {
    grid-template-rows: 1fr;
    border-color: var(--gray-200);
}
.settings-section-inner {
    overflow: hidden;
    min-height: 0;
}
/* Padding bevosita grid-item ga emas, uning bolasiga — aks holda 0fr collapse ishlamaydi */
.settings-section-inner > * {
    padding: 16px;
}

html[data-theme="dark"] .settings-section[data-accordion] > .settings-label {
    background: #0F172A;
    border-color: rgba(255,255,255,0.08);
}
html[data-theme="dark"] .settings-section[data-accordion].open .settings-section-body {
    border-color: rgba(255,255,255,0.08);
}

/* Theme tiles */
.theme-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.theme-card {
    border: 2px solid var(--gray-200);
    border-radius: 14px;
    padding: 16px 14px;
    cursor: pointer;
    background: var(--white);
    transition: var(--transition, all 0.2s ease);
    text-align: left;
    font-family: inherit;
    position: relative;
}
.theme-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}
.theme-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
}
.theme-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-bottom: 10px;
}
.theme-card.light .theme-card-icon {
    background: linear-gradient(135deg, #FEF3C7, #FBBF24);
    color: #B45309;
}
.theme-card.dark .theme-card-icon {
    background: linear-gradient(135deg, #1E293B, #0F172A);
    color: #FBBF24;
}
.theme-card strong {
    display: block;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    color: var(--gray-900);
    margin-bottom: 2px;
}
.theme-card span {
    font-size: 11.5px;
    color: var(--gray-500);
}
.theme-card .theme-tick {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 22px;
    height: 22px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0;
    transform: scale(0.6);
    transition: var(--transition, all 0.2s ease);
}
.theme-card.active .theme-tick {
    opacity: 1;
    transform: scale(1);
}

/* Language list */
.lang-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.lang-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    cursor: pointer;
    background: var(--white);
    transition: var(--transition, all 0.2s ease);
    font-family: inherit;
    text-align: left;
    width: 100%;
}
.lang-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.lang-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
}
.lang-flag {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: var(--gray-50);
    flex-shrink: 0;
}
.lang-card.active .lang-flag {
    background: var(--white);
}
.lang-info { flex: 1; }
.lang-info strong {
    display: block;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    color: var(--gray-900);
    margin-bottom: 2px;
}
.lang-info span {
    font-size: 11.5px;
    color: var(--gray-500);
}
.lang-card .lang-tick {
    width: 22px;
    height: 22px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0;
    transition: var(--transition, all 0.2s ease);
}
.lang-card.active .lang-tick { opacity: 1; }

/* Settings as sidebar nav item (dashboard) */
.side-link.settings-trigger-link {
    /* dashboard sidebar ichida — odatdagi side-link kabi */
    width: auto; height: auto;
    background: transparent; transform: none;
    margin-right: 0;
}
.side-link.settings-trigger-link:hover { transform: none; }

/* ============ DARK THEME ============ */
html[data-theme="dark"] {
    --bg: #0F172A;
    --white: #1E293B;
    --gray-50: #1E293B;
    --gray-100: #334155;
    --gray-200: #475569;
    --gray-300: #64748B;
    --gray-400: #94A3B8;
    --gray-500: #CBD5E1;
    --gray-600: #E2E8F0;
    --gray-700: #F1F5F9;
    --gray-800: #F8FAFC;
    --gray-900: #FFFFFF;
    --primary-light: rgba(34, 197, 94, 0.15);
    color-scheme: dark;
}
html[data-theme="dark"] body {
    background: var(--bg);
    color: var(--gray-700);
}
html[data-theme="dark"] .navbar {
    background: rgba(15, 23, 42, 0.88) !important;
    border-bottom-color: rgba(255,255,255,0.05);
}
html[data-theme="dark"] .navbar.scrolled {
    background: rgba(15, 23, 42, 0.95) !important;
}
html[data-theme="dark"] .nav-link {
    color: var(--gray-600);
}
html[data-theme="dark"] .hero-bg {
    background: radial-gradient(ellipse at top, rgba(34, 197, 94, 0.12), transparent 70%);
}
html[data-theme="dark"] .hero-card,
html[data-theme="dark"] .app-card,
html[data-theme="dark"] .review-card,
html[data-theme="dark"] .how-step,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .quick-actions,
html[data-theme="dark"] .subscr-banner,
html[data-theme="dark"] .info-strip,
html[data-theme="dark"] .ns-step,
html[data-theme="dark"] .mp-app-card,
html[data-theme="dark"] .form-card,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .settings-panel,
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .dash-header,
html[data-theme="dark"] .footer {
    background: #1E293B;
    color: var(--gray-700);
    border-color: rgba(255,255,255,0.06);
}
html[data-theme="dark"] .stats-section,
html[data-theme="dark"] .apps-section,
html[data-theme="dark"] .how-section,
html[data-theme="dark"] .reviews-section,
html[data-theme="dark"] .cta-section,
html[data-theme="dark"] .dash-content,
html[data-theme="dark"] .subscribe-page {
    background: var(--bg);
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .auth-input,
html[data-theme="dark"] .form-input,
html[data-theme="dark"] .form-select {
    background: #0F172A;
    border-color: rgba(255,255,255,0.1);
    color: var(--gray-800);
}
html[data-theme="dark"] .auth-input input { background: transparent; }
html[data-theme="dark"] .footer { background: #020617; }
html[data-theme="dark"] code {
    background: rgba(255,255,255,0.08);
    color: #FBBF24;
}
html[data-theme="dark"] .theme-card,
html[data-theme="dark"] .lang-card {
    background: #0F172A;
    border-color: rgba(255,255,255,0.08);
}
html[data-theme="dark"] .theme-card.active,
html[data-theme="dark"] .lang-card.active {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--primary);
}
html[data-theme="dark"] .settings-trigger {
    background: rgba(255,255,255,0.08);
    color: var(--gray-700);
}
html[data-theme="dark"] .lang-flag { background: rgba(255,255,255,0.06); }

/* Hero card text in dark */
html[data-theme="dark"] .hc-title { color: var(--gray-800); }
html[data-theme="dark"] .hc-sub { color: var(--gray-500); }

@media (max-width: 480px) {
    .settings-panel { width: 100vw; max-width: 100vw; }
}

/* ============ THEME TOGGLE BUTTON (small) ============ */
/* settings-trigger bilan bir o'lchamda — yonida joylashadi */
.theme-toggle-btn {
    width: 40px;
    height: 40px;
    background: var(--gray-100);
    border: none;
    border-radius: 10px;
    color: var(--gray-700);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition, all 0.2s ease);
    margin-right: 8px;
}
.theme-toggle-btn:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}
.theme-toggle-btn i { transition: transform 0.3s ease; }
.theme-toggle-btn:hover i { transform: rotate(20deg) scale(1.1); }

html[data-theme="dark"] .theme-toggle-btn {
    background: rgba(255,255,255,0.08);
    color: #FBBF24;
}

/* Settings forms — email/parol o'zgartirish */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.settings-input-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.settings-input-row label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
}
.settings-input-row input {
    padding: 10px 14px;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    color: var(--gray-900);
    outline: none;
    transition: var(--transition, all 0.2s ease);
}
.settings-input-row input:focus {
    border-color: var(--primary);
    background: var(--white);
}
.settings-input-row input[readonly] {
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}
.settings-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 11px 18px;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    margin-top: 6px;
    transition: var(--transition, all 0.2s ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.settings-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

html[data-theme="dark"] .settings-input-row input {
    background: #0F172A;
    border-color: rgba(255,255,255,0.1);
}
html[data-theme="dark"] .settings-input-row input[readonly] {
    background: rgba(255,255,255,0.04);
}
