/* base.css — docs/DESIGN-shadcn-ui.md §7
 * Reset, tipografiya, havola, skrollbar, tanlash, fokus, harakatni kamaytirish, [hidden], jadval default'lari, yordamchilar.
 * Barcha ranglar tokens.css dagi tokenlardan — light/dark ikkalasida ishlaydi. Komponentlar — components.css.
 */

*, ::before, ::after { box-sizing: border-box; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  scroll-behavior: auto;
}

body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  font-family: var(--font-sans);
  font-size: 0.875rem;           /* 14px (text-sm) */
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* --- Sarlavhalar (shadcn: sarlavha stili komponentda; bu yerda faqat sodda asos) --- */
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; line-height: 1.25; color: var(--foreground); text-wrap: balance; }
h1 { font-size: 1.5rem; letter-spacing: -0.015em; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.875rem; font-weight: 500; margin: 1rem 0 0.5rem; }
h5, h6 { font-size: 0.875rem; font-weight: 500; }
p { margin: 0; }
b, strong { font-weight: 600; }
small { font-size: 0.75rem; }

/* --- Havolalar: shadcn "link" ko'rinishi (primary matn, underline-offset-4, hover'da chiziq) ---
   Klassli havolalar (nav, tugma, karta...) o'z uslubini beradi — bu qoidalar ataylab past o'ziga xoslikda. */
a { color: var(--primary); text-decoration: none; text-underline-offset: 4px; }
a:hover { text-decoration: underline; }
:where(a:not([class])) {
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, currentColor 35%, transparent);
  font-weight: 500;
}
:where(a:not([class])):hover { text-decoration-color: currentColor; }

/* --- Forma elementlari asosi (preflight): shrift/rang meros, tugma fonsiz --- */
button, input, select, optgroup, textarea {
  font: inherit;
  font-feature-settings: inherit;
  font-variation-settings: inherit;
  letter-spacing: inherit;
  color: inherit;
  margin: 0;
}
:where(button, [type="button"], [type="submit"], [type="reset"]) {
  -webkit-appearance: button;
  appearance: button;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}
:where(button:disabled, [type="button"]:disabled, [type="submit"]:disabled) { cursor: not-allowed; }
::placeholder { color: var(--muted-foreground); opacity: 1; }
textarea { resize: vertical; }

/* --- Media --- */
img, svg, video, canvas { max-width: 100%; }
img { border-style: none; }
svg:not(:root) { overflow: hidden; }

/* --- Jadval defaultlari (batafsil ko'rinish — components.css) --- */
table { width: 100%; border-collapse: collapse; border-spacing: 0; text-indent: 0; }
th { text-align: left; }
caption { text-align: left; }

/* --- Boshqa elementlar --- */
hr { height: 0; margin: 1rem 0; border: 0; border-top: 1px solid var(--border); color: inherit; }
code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.875em; }
:where(:not(pre) > code) { background: var(--muted); padding: 0.125rem 0.375rem; border-radius: var(--radius-sm); }
summary { cursor: pointer; }
[hidden] { display: none !important; }

/* --- Tanlash --- */
::selection { background: var(--primary); color: var(--primary-foreground); }

/* --- Fokus halqasi ---
   Umumiy element: ring/50 kontur (shadcn base: outline-ring/50). Boshqaruvlar (.btn, input...) components.css'da
   border-ring + 3px ring/50 (box-shadow) bilan qayta belgilaydi. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus-border);
  outline-offset: 2px;
}
/* Dasturiy fokus oladigan konteynerlar (modal, menyu, #page) — halqa ko'rsatilmaydi */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }

/* --- Ingichka neytral skrollbar (Chromium/Firefox, ikkala tema) --- */
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklab, var(--muted-foreground) 45%, transparent) transparent;
}

/* --- Harakatni kamaytirish --- */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Yordamchilar --- */
.tabular, .num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.mt0 { margin-top: 0; }
.small { font-size: 0.75rem; }

/* owner-only: faqat media_owner ko'radi (UX qulayligi — haqiqiy chegara backend'da) */
body:not([data-role="media_owner"]) .owner-only { display: none !important; }
