/* =========================================================
   base.css — KUKA HOME (Premium Minimal UI)
   Purpose: global reset + design tokens + base components
   Notes:
   - Works great with your other files (style.css, admin.css, responsive.css)
   - Keep this loaded FIRST:
     <link rel="stylesheet" href="/public/css/base.css">
   ========================================================= */

/* ---------------------------
   1) CSS Reset (modern)
---------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html:focus-within {
  scroll-behavior: smooth;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: transparent;
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

p, h1, h2, h3, h4, h5, h6 {
  margin: 0;
  overflow-wrap: break-word;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ---------------------------
   2) Design Tokens
---------------------------- */
:root {
  /* Brand */
  --bg: #0b0b0c;
  --surface: #111113;
  --surface-2: #151518;
  --surface-3: #1a1a1f;

  --text: #f5f5f6;
  --text-2: rgba(245,245,246,0.78);
  --text-3: rgba(245,245,246,0.58);

  --border: rgba(255,255,255,0.10);
  --border-2: rgba(255,255,255,0.14);

  --brand: #c9a96a;       /* premium gold */
  --brand-2: #d7bf8b;     /* lighter gold */
  --success: #3ddc97;
  --warning: #ffcc66;
  --danger: #ff6b6b;
  --info: #6aa9ff;

  /* Shadows */
  --shadow-sm: 0 6px 18px rgba(0,0,0,0.28);
  --shadow-md: 0 14px 40px rgba(0,0,0,0.36);
  --shadow-lg: 0 22px 70px rgba(0,0,0,0.42);

  /* Radii */
  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 18px;
  --r-lg: 22px;
  --r-xl: 28px;

  /* Spacing */
  --s-1: 6px;
  --s-2: 10px;
  --s-3: 14px;
  --s-4: 18px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 44px;
  --s-8: 56px;

  /* Typography */
  --font-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Helvetica Neue", "Noto Sans", "Liberation Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --fs-1: 12px;
  --fs-2: 14px;
  --fs-3: 16px;
  --fs-4: 18px;
  --fs-5: 22px;
  --fs-6: 28px;
  --fs-7: 36px;

  --lh-tight: 1.15;
  --lh: 1.45;
  --lh-loose: 1.7;

  /* Layout */
  --container: 1180px;
  --container-narrow: 980px;

  /* Motion */
  --ease: cubic-bezier(.2,.8,.2,1);
  --ease-soft: cubic-bezier(.25,.9,.25,1);
  --t-fast: 140ms;
  --t: 220ms;

  /* Focus ring */
  --ring: 0 0 0 4px rgba(201,169,106,0.22);
}

/* Optional: Light theme hook (if later you add data-theme="light") */
:root[data-theme="light"] {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --surface-3: #efeff3;

  --text: #111113;
  --text-2: rgba(17,17,19,0.78);
  --text-3: rgba(17,17,19,0.58);

  --border: rgba(17,17,19,0.10);
  --border-2: rgba(17,17,19,0.14);

  --shadow-sm: 0 8px 20px rgba(0,0,0,0.10);
  --shadow-md: 0 16px 46px rgba(0,0,0,0.12);
  --shadow-lg: 0 26px 80px rgba(0,0,0,0.14);

  --ring: 0 0 0 4px rgba(201,169,106,0.20);
}

/* ---------------------------
   3) Base Typography
---------------------------- */
body {
  font-family: var(--font-sans);
  font-size: var(--fs-3);
  line-height: var(--lh);
  background: radial-gradient(1200px 700px at 10% 0%, rgba(201,169,106,0.08), transparent 60%),
              radial-gradient(900px 600px at 90% 10%, rgba(106,169,255,0.06), transparent 55%),
              var(--bg);
  color: var(--text);
}

::selection {
  background: rgba(201,169,106,0.30);
}

small { font-size: var(--fs-2); color: var(--text-2); }
code, pre { font-family: var(--font-mono); }

.h1, h1 { font-size: var(--fs-7); line-height: var(--lh-tight); letter-spacing: -0.02em; }
.h2, h2 { font-size: var(--fs-6); line-height: var(--lh-tight); letter-spacing: -0.02em; }
.h3, h3 { font-size: var(--fs-5); line-height: var(--lh-tight); letter-spacing: -0.01em; }
.h4, h4 { font-size: var(--fs-4); line-height: var(--lh-tight); }
.h5, h5 { font-size: var(--fs-3); line-height: var(--lh-tight); }
.h6, h6 { font-size: var(--fs-2); line-height: var(--lh-tight); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }

.muted { color: var(--text-2); }
.muted-2 { color: var(--text-3); }

/* Links */
.link {
  color: var(--brand-2);
  transition: color var(--t) var(--ease);
}
.link:hover { color: var(--brand); }

/* ---------------------------
   4) Layout Helpers
---------------------------- */
.container {
  width: min(var(--container), calc(100% - 2*var(--s-5)));
  margin: 0 auto;
}
.container.narrow {
  width: min(var(--container-narrow), calc(100% - 2*var(--s-5)));
}
.section {
  padding: var(--s-7) 0;
}

.grid {
  display: grid;
  gap: var(--s-5);
}
.flex {
  display: flex;
  gap: var(--s-4);
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

/* Spacing utils */
.mt-1 { margin-top: var(--s-1); }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); }
.mt-6 { margin-top: var(--s-6); }
.mb-1 { margin-bottom: var(--s-1); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-5 { margin-bottom: var(--s-5); }
.mb-6 { margin-bottom: var(--s-6); }

/* ---------------------------
   5) Surfaces (Card / Panel)
---------------------------- */
.surface {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card__header,
.card__body,
.card__footer {
  padding: var(--s-5);
}

.card__header {
  border-bottom: 1px solid var(--border);
}

.card__footer {
  border-top: 1px solid var(--border);
}

.hr {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: var(--s-5) 0;
}

/* ---------------------------
   6) Buttons
---------------------------- */
.btn {
  --btn-bg: transparent;
  --btn-bd: var(--border-2);
  --btn-tx: var(--text);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  padding: 12px 16px;
  border-radius: 14px;

  background: var(--btn-bg);
  border: 1px solid var(--btn-bd);
  color: var(--btn-tx);

  font-weight: 600;
  letter-spacing: 0.01em;

  transition: transform var(--t-fast) var(--ease),
              background var(--t) var(--ease),
              border-color var(--t) var(--ease),
              box-shadow var(--t) var(--ease),
              opacity var(--t) var(--ease);
  user-select: none;
  will-change: transform;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(201,169,106,0.28);
}

.btn:active {
  transform: translateY(0px);
  opacity: 0.92;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring), var(--shadow-sm);
}

/* Primary */
.btn--primary {
  --btn-bg: linear-gradient(180deg, rgba(201,169,106,0.95), rgba(201,169,106,0.72));
  --btn-bd: rgba(201,169,106,0.45);
  --btn-tx: #111113;
}
.btn--primary:hover {
  border-color: rgba(201,169,106,0.75);
  box-shadow: 0 16px 50px rgba(201,169,106,0.18);
}

/* Secondary */
.btn--secondary {
  --btn-bg: rgba(255,255,255,0.06);
  --btn-bd: var(--border);
}
.btn--secondary:hover {
  background: rgba(255,255,255,0.08);
}

/* Ghost */
.btn--ghost {
  --btn-bg: transparent;
  --btn-bd: transparent;
}
.btn--ghost:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
}

/* Danger */
.btn--danger {
  --btn-bg: rgba(255,107,107,0.12);
  --btn-bd: rgba(255,107,107,0.28);
  --btn-tx: #ffd7d7;
}
.btn--danger:hover {
  box-shadow: 0 18px 55px rgba(255,107,107,0.12);
}

.btn--sm { padding: 9px 12px; border-radius: 12px; font-size: var(--fs-2); }
.btn--lg { padding: 14px 18px; border-radius: 16px; font-size: var(--fs-4); }

.btn[disabled],
.btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---------------------------
   7) Inputs / Forms
---------------------------- */
.label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: var(--fs-2);
  color: var(--text-2);
  margin-bottom: 8px;
}

.input,
.select,
.textarea {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  outline: none;

  transition: border-color var(--t) var(--ease),
              box-shadow var(--t) var(--ease),
              background var(--t) var(--ease);
}

.input::placeholder,
.textarea::placeholder {
  color: rgba(245,245,246,0.45);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(201,169,106,0.55);
  box-shadow: var(--ring);
  background: rgba(255,255,255,0.06);
}

.textarea {
  min-height: 110px;
  resize: vertical;
}

.field {
  display: grid;
  gap: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}

.help {
  font-size: var(--fs-2);
  color: var(--text-3);
}

/* Checkbox / Radio (simple) */
.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

/* ---------------------------
   8) Badges / Pills
---------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: var(--fs-2);
  font-weight: 600;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text-2);
}

.badge--gold {
  background: rgba(201,169,106,0.14);
  border-color: rgba(201,169,106,0.28);
  color: rgba(201,169,106,0.95);
}

.badge--success {
  background: rgba(61,220,151,0.12);
  border-color: rgba(61,220,151,0.24);
  color: rgba(61,220,151,0.95);
}

/* ---------------------------
   9) Tables
---------------------------- */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}

.table th,
.table td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.table th {
  font-size: var(--fs-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  background: rgba(255,255,255,0.04);
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tr:hover td {
  background: rgba(255,255,255,0.04);
}

.table .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------------------------
   10) Modal / Overlay (base)
---------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: var(--s-5);
  z-index: 1000;
}

.modal {
  width: min(560px, 100%);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal__head,
.modal__body,
.modal__foot {
  padding: var(--s-5);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  border-bottom: 1px solid var(--border);
}

.modal__title {
  font-size: var(--fs-5);
  line-height: var(--lh-tight);
}

.modal__foot {
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--s-3);
}

/* ---------------------------
   11) Toast / Alert
---------------------------- */
.alert {
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  padding: 14px 16px;
  color: var(--text-2);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.alert--success {
  border-color: rgba(61,220,151,0.24);
  background: rgba(61,220,151,0.10);
}
.alert--warning {
  border-color: rgba(255,204,102,0.24);
  background: rgba(255,204,102,0.10);
}
.alert--danger {
  border-color: rgba(255,107,107,0.26);
  background: rgba(255,107,107,0.10);
}

/* ---------------------------
   12) Skeleton / Loading
---------------------------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

/* ---------------------------
   13) Accessibility helpers
---------------------------- */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---------------------------
   14) Responsive base tweaks
---------------------------- */
@media (max-width: 900px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .section {
    padding: var(--s-6) 0;
  }
}

@media (max-width: 520px) {
  .container {
    width: calc(100% - 2*var(--s-4));
  }
  .card__header,
  .card__body,
  .card__footer,
  .modal__head,
  .modal__body,
  .modal__foot {
    padding: var(--s-4);
  }
  .btn {
    width: 100%;
    justify-content: center;
  }
}
