/* ============================================================================
   base.css — dizayn o'zgaruvchilari, reset, tipografiya, ikonkalar
   Foyda / foydali onlayn vositalar
   ============================================================================ */

/* ---------- 1. Rang palitrasi va o'lchamlar (design tokens) ---------- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 44px;

  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --accent: #14b8a6;
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #a855f7 100%);
  --grad-soft: linear-gradient(135deg, rgba(99, 102, 241, .16), rgba(168, 85, 247, .12));

  --ok: #16a34a;
  --warn: #f59e0b;
  --err: #ef4444;
  --info: #3b82f6;

  --topbar-h: 64px;
  --sidebar-w: 250px;
  --maxw: 1180px;

  --t-fast: .14s ease;
  --t: .22s cubic-bezier(.4, 0, .2, 1);
}

/* Qorong'i mavzu (standart) */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0e17;
  --bg-2: #0e1320;
  --surface: #141a28;
  --surface-2: #1b2233;
  --surface-3: #232c40;
  --border: rgba(255, 255, 255, .09);
  --border-2: rgba(255, 255, 255, .18);
  --text: #e9edf6;
  --text-2: #b3bccd;
  --muted: #7f8aa0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
  --glass: rgba(20, 26, 40, .78);
}

/* Yorug' mavzu */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5fb;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef0f8;
  --border: #e3e6f0;
  --border-2: #cdd2e2;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #7c8598;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 6px 20px rgba(16, 24, 40, .08);
  --shadow-lg: 0 18px 44px rgba(16, 24, 40, .14);
  --glass: rgba(255, 255, 255, .82);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }

h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
small { font-size: .82rem; }

code, kbd, pre, .mono { font-family: var(--font-mono); font-size: .88em; }

/* ---------- 3. Ikonsystema (.ico ichiga data-icon to'ldiriladi) ---------- */
.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15em;
  height: 1.15em;
  flex: 0 0 auto;
  line-height: 0;
}
.ico > svg { width: 100%; height: 100%; stroke: currentColor; fill: none;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ico.is-filled > svg { fill: currentColor; stroke: none; }

/* ---------- 4. Umumiy yordamchi sinflar ---------- */
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.scroll-x { overflow-x: auto; }
.wrap { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

::selection { background: rgba(99, 102, 241, .35); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ---------- 5. Forma elementlari (asosiy ko'rinish) ---------- */
.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  min-width: 0;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-2); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .18);
  background: var(--surface);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.input[type="range"] { padding: 0; background: none; border: 0; accent-color: var(--primary); height: 24px; }
.input[type="color"] { padding: 3px; height: 42px; cursor: pointer; }
.input[type="number"] { -moz-appearance: textfield; }
.input[type="checkbox"], .input[type="radio"] { width: auto; accent-color: var(--primary); width: 16px; height: 16px; padding: 0; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237f8aa0' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px;
  cursor: pointer;
}
label { font-weight: 600; font-size: .84rem; color: var(--text-2); }

/* ---------- 6. Harakatlar (animatsiya) ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scale(.94); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.anim-up { animation: fadeUp .3s both; }
.anim-in { animation: fadeIn .25s both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .topbar, .sidebar, .site-foot, .toasts { display: none !important; }
  body { background: #fff; }
}
