/* ── Oqim component classes ─────────────────────────────────────
   Consumed by the React primitives in /components. Sharp corners,
   emerald accent, crisp shadows. */

/* ============ BUTTON ============ */
.oq-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--font-sans); font-weight: var(--fw-semibold);
  border: var(--bw) solid transparent; border-radius: var(--r-sm);
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.oq-btn:active { transform: translateY(0.5px); }
.oq-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.oq-btn[disabled], .oq-btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.oq-btn svg { width: 1em; height: 1em; flex: none; }

/* sizes */
.oq-btn--sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--text-sm); }
.oq-btn--md { height: 36px; padding: 0 var(--sp-4); font-size: var(--text-base); }
.oq-btn--lg { height: 44px; padding: 0 var(--sp-6); font-size: var(--text-md); }

/* variants */
.oq-btn--primary   { background: var(--accent); color: var(--accent-contrast); }
.oq-btn--primary:hover   { background: var(--accent-hover); }
.oq-btn--primary:active  { background: var(--accent-active); }

.oq-btn--secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border-strong); }
.oq-btn--secondary:hover { background: var(--surface-hover); border-color: var(--neutral-300); }

.oq-btn--ghost     { background: transparent; color: var(--text-secondary); }
.oq-btn--ghost:hover     { background: var(--surface-hover); color: var(--text-primary); }

.oq-btn--danger    { background: var(--danger-solid); color: #fff; }
.oq-btn--danger:hover    { background: var(--red-700); }

.oq-btn--block { width: 100%; }

/* ============ ICON BUTTON ============ */
.oq-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  border: var(--bw) solid transparent; border-radius: var(--r-sm);
  background: transparent; color: var(--text-secondary); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.oq-iconbtn:hover { background: var(--surface-hover); color: var(--text-primary); }
.oq-iconbtn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.oq-iconbtn--sm { width: 30px; height: 30px; }
.oq-iconbtn--md { width: 36px; height: 36px; }
.oq-iconbtn svg { width: 18px; height: 18px; }
.oq-iconbtn[disabled] { opacity: .45; pointer-events: none; }

/* ============ INPUT / FIELD ============ */
.oq-field { display: flex; flex-direction: column; gap: var(--sp-2); }
.oq-label { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-secondary); }
.oq-input, .oq-select {
  height: 36px; width: 100%; padding: 0 var(--sp-3);
  font-family: var(--font-sans); font-size: var(--text-base); color: var(--text-primary);
  background: var(--surface); border: var(--bw) solid var(--border-strong); border-radius: var(--r-sm);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.oq-input::placeholder { color: var(--text-disabled); }
.oq-input:hover, .oq-select:hover { border-color: var(--neutral-300); }
.oq-input:focus, .oq-select:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
.oq-input[disabled] { background: var(--surface-sunken); color: var(--text-disabled); }
.oq-input--invalid { border-color: var(--danger-solid); }
.oq-input--invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,0.25); }
.oq-hint { font-size: var(--text-xs); color: var(--text-tertiary); }
.oq-hint--error { color: var(--danger-fg); }

.oq-inputwrap { position: relative; display: flex; align-items: center; }
.oq-inputwrap .oq-input { padding-left: 34px; }
.oq-inputwrap__icon { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--text-tertiary); pointer-events: none; }

.oq-select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7884' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px;
}

/* ============ CHECKBOX / RADIO / SWITCH ============ */
.oq-check { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-size: var(--text-base); color: var(--text-primary); }
.oq-check__box {
  width: 18px; height: 18px; flex: none; border: var(--bw-thick) solid var(--border-strong);
  border-radius: var(--r-xs); display: grid; place-items: center; background: var(--surface);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.oq-check__box svg { width: 12px; height: 12px; color: #fff; opacity: 0; }
.oq-check--on .oq-check__box { background: var(--accent); border-color: var(--accent); }
.oq-check--on .oq-check__box svg { opacity: 1; }
.oq-check--radio .oq-check__box { border-radius: var(--r-pill); }

.oq-switch { position: relative; width: 38px; height: 22px; flex: none; border-radius: var(--r-pill);
  background: var(--neutral-300); cursor: pointer; transition: background var(--dur-base) var(--ease-out); }
.oq-switch__knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: var(--r-pill);
  background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur-base) var(--ease-out); }
.oq-switch--on { background: var(--accent); }
.oq-switch--on .oq-switch__knob { transform: translateX(16px); }

/* ============ BADGE / TAG ============ */
.oq-badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  font-size: var(--text-xs); font-weight: var(--fw-semibold); border-radius: var(--r-sm);
  border: var(--bw) solid transparent; white-space: nowrap; line-height: 1;
}
.oq-badge svg { width: 12px; height: 12px; }
.oq-badge--neutral { background: var(--neutral-tag-bg); color: var(--neutral-tag-fg); }
.oq-badge--accent  { background: var(--accent-soft); color: var(--text-accent); border-color: var(--accent-soft-bd); }
.oq-badge--success { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-bd); }
.oq-badge--warning { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-bd); }
.oq-badge--danger  { background: var(--danger-bg);  color: var(--danger-fg);  border-color: var(--danger-bd); }
.oq-badge--info    { background: var(--info-bg);    color: var(--info-fg);    border-color: var(--info-bd); }
.oq-badge__dot { width: 6px; height: 6px; border-radius: var(--r-pill); background: currentColor; }

/* ============ AVATAR ============ */
.oq-avatar { display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: var(--r-pill); background: var(--accent-soft); color: var(--text-accent);
  font-weight: var(--fw-semibold); overflow: hidden; position: relative; }
.oq-avatar img { width: 100%; height: 100%; object-fit: cover; }
.oq-avatar--xs { width: 24px; height: 24px; font-size: 10px; }
.oq-avatar--sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.oq-avatar--md { width: 40px; height: 40px; font-size: var(--text-sm); }
.oq-avatar--lg { width: 52px; height: 52px; font-size: var(--text-lg); }
.oq-avatar__status { position: absolute; bottom: 0; right: 0; width: 30%; height: 30%;
  border-radius: var(--r-pill); border: 2px solid var(--surface); background: var(--success-solid); }

/* ============ CARD ============ */
.oq-card { background: var(--surface); border: var(--bw) solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); }
.oq-card--flat { box-shadow: none; }
.oq-card--pad { padding: var(--sp-5); }
.oq-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-bottom: var(--bw) solid var(--border-subtle); }
.oq-card__title { font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-primary); }
.oq-card__body { padding: var(--sp-5); }

/* ============ STAT CARD ============ */
.oq-stat { background: var(--surface); border: var(--bw) solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-2); }
.oq-stat__top { display: flex; align-items: center; justify-content: space-between; }
.oq-stat__label { font-size: var(--text-sm); color: var(--text-secondary); font-weight: var(--fw-medium); }
.oq-stat__icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r-sm);
  background: var(--accent-soft); color: var(--text-accent); }
.oq-stat__icon svg { width: 17px; height: 17px; }
.oq-stat__value { font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: var(--text-3xl); font-weight: var(--fw-semibold); letter-spacing: var(--ls-tight); color: var(--text-primary); }
.oq-stat__delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-sm); font-weight: var(--fw-semibold); }
.oq-stat__delta svg { width: 14px; height: 14px; }
.oq-stat__delta--up { color: var(--success-fg); }
.oq-stat__delta--down { color: var(--danger-fg); }
.oq-stat__delta--muted { color: var(--text-tertiary); font-weight: var(--fw-regular); }

/* ============ TABS ============ */
.oq-tabs { display: flex; gap: var(--sp-1); border-bottom: var(--bw) solid var(--border); }
.oq-tab { appearance: none; background: none; border: none; cursor: pointer; font-family: var(--font-sans);
  font-size: var(--text-base); font-weight: var(--fw-medium); color: var(--text-tertiary);
  padding: var(--sp-3) var(--sp-3); position: relative; transition: color var(--dur-fast) var(--ease-out); }
.oq-tab:hover { color: var(--text-secondary); }
.oq-tab--active { color: var(--text-primary); font-weight: var(--fw-semibold); }
.oq-tab--active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: var(--r-pill); }
.oq-tab__count { margin-left: 6px; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-tertiary); }

/* ============ PROGRESS ============ */
.oq-progress { height: 6px; width: 100%; background: var(--surface-sunken); border-radius: var(--r-pill); overflow: hidden; }
.oq-progress__fill { height: 100%; background: var(--accent); border-radius: var(--r-pill); transition: width var(--dur-slow) var(--ease-out); }

/* ============ TOOLTIP ============ */
.oq-tip { position: relative; display: inline-flex; }
.oq-tip__pop { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--neutral-900); color: #fff; font-size: var(--text-xs); font-weight: var(--fw-medium);
  padding: 6px 9px; border-radius: var(--r-sm); white-space: nowrap; box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease-out); z-index: var(--z-dropdown); }
.oq-tip:hover .oq-tip__pop { opacity: 1; }
.oq-tip__pop::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: var(--neutral-900); }

/* ============ DIALOG ============ */
.oq-overlay { position: fixed; inset: 0; background: rgba(12,15,18,0.45); display: grid; place-items: center;
  z-index: var(--z-modal); padding: var(--sp-4); backdrop-filter: blur(2px); }
.oq-dialog { background: var(--surface); border: var(--bw) solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); width: 100%; max-width: 460px; overflow: hidden; }
.oq-dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-5) var(--sp-3); }
.oq-dialog__title { font-size: var(--text-lg); font-weight: var(--fw-semibold); }
.oq-dialog__body { padding: 0 var(--sp-5) var(--sp-3); color: var(--text-secondary); font-size: var(--text-base); }
.oq-dialog__foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5);
  border-top: var(--bw) solid var(--border-subtle); background: var(--surface-sunken); }

/* ============ TOAST ============ */
.oq-toast { display: flex; align-items: flex-start; gap: var(--sp-3); background: var(--surface);
  border: var(--bw) solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg); padding: var(--sp-3) var(--sp-4); min-width: 280px; max-width: 380px; }
.oq-toast--success { border-left-color: var(--success-solid); }
.oq-toast--danger  { border-left-color: var(--danger-solid); }
.oq-toast--warning { border-left-color: var(--warning-solid); }
.oq-toast__icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.oq-toast__title { font-size: var(--text-sm); font-weight: var(--fw-semibold); }
.oq-toast__msg { font-size: var(--text-sm); color: var(--text-secondary); }

/* ============ TABLE ============ */
.oq-table { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
.oq-table th { text-align: left; font-size: var(--text-xs); font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide); text-transform: uppercase; color: var(--text-tertiary);
  padding: var(--sp-3) var(--sp-4); border-bottom: var(--bw) solid var(--border); background: var(--surface-sunken); }
.oq-table td { padding: var(--sp-3) var(--sp-4); border-bottom: var(--bw) solid var(--border-subtle); color: var(--text-primary); }
.oq-table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.oq-table tbody tr:hover { background: var(--surface-hover); }
.oq-table tbody tr:last-child td { border-bottom: none; }
