/*
──────────────────────────────────────────────────────────────────
Copyright (c) 2026 Ilhom Abdullayev (@aib81).
Proyekt: AT MEDSERT — sertifikatsiya tizimi (ISO 13485).
Email: ilhom8108@gmail.com · Telegram: @aib81 (id: 834760045)

Mualliflik huquqi muallifga tegishli. Without written permission —
no copying, forking, or commercial use is allowed.
──────────────────────────────────────────────────────────────────
*/
/* ============================================================
   AT MEDSERT - base.css
   Reset + layout + default CSS custom properties.
   Each theme file overrides the color tokens on :root[data-theme=...].
   ============================================================ */

:root {
  /* Typography - system font stack only, no external fonts */
  --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
  --font-size-base: 1rem;      /* 16px */
  --font-size-sm: 0.875rem;    /* 14px */
  --font-size-lg: 1.125rem;    /* 18px */
  --font-size-xl: 1.5rem;      /* 24px */
  --font-size-2xl: 2rem;       /* 32px */
  --line-height: 1.5;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-med: 200ms ease;

  /* Layout */
  --nav-width: 260px;
  --header-height: 56px;

  /* Default (dark) color tokens - overridden by theme files */
  --bg-primary: #2c3e50;
  --bg-secondary: #34495e;
  --bg-alternate: #1e2a38;
  --text-primary: #ecf0f1;
  --text-secondary: #bdc3c7;
  --text-header: #ecf0f1;
  --accent: #3498db;
  --accent-hover: #2980b9;
  --border: #7f8c8d;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #3498db;
}

/* ---------- Reset (minimal) ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-system);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background var(--transition-med), color var(--transition-med);
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ---------- Focus visible (WCAG 2.4.7) ---------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Skip link (WCAG 2.4.1) ---------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-3);
  background: var(--accent);
  color: #ffffff;
  padding: var(--space-2) var(--space-3);
  z-index: 1000;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-3);
}

/* ---------- Visually hidden (for screen readers only) ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout ---------- */
.app-layout {
  display: grid;
  grid-template-columns: var(--nav-width) 1fr;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "nav main"
    "nav footer";
  min-height: 100vh;
}

.app-nav {
  grid-area: nav;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: var(--space-3);
  overflow-y: auto;
}

.app-main {
  grid-area: main;
  padding: var(--space-4);
  background: var(--bg-primary);
}

.app-footer {
  grid-area: footer;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

/* Responsive: collapse nav on narrow screens */
@media (max-width: 1023px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "nav"
      "main"
      "footer";
  }

  .app-nav {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* ---------- Headings ---------- */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3) 0;
  color: var(--text-header);
  font-weight: 600;
  line-height: 1.25;
}

h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }

p {
  margin: 0 0 var(--space-3) 0;
}

/* ---------- Tables (zebra via bg_alternate) ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table th,
.table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: var(--bg-alternate);
  color: var(--text-header);
  font-weight: 600;
}

.table tbody tr:nth-child(even) {
  background: var(--bg-alternate);
}

.table tbody tr:hover {
  background: var(--bg-primary);
}

/* ---------- Form controls ---------- */
.form-group {
  margin-bottom: var(--space-3);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--text-secondary);
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: var(--font-size-base);
  background: var(--bg-alternate);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin-right: var(--space-1);
  accent-color: var(--accent);
}

/* ---------- Demo page helpers ---------- */
.demo-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.demo-section h2 {
  margin-top: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-2);
}

.demo-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.demo-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 600;
  background: var(--bg-alternate);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.demo-status-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}
