/* SAMBOX PLAYER — OFFICIAL client design system (compiled from client-design-system.scss).
   Source of truth for every client page. Homepage (/app/index.html) is the visual
   reference and does NOT link this file — everything here matches it by construction.
   Dark primary; light mode via [data-theme="light"] (same toggle logic, untouched). */

/* ============ Buttons ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 26px; border-radius: 10px; font-weight: 800; font-size: 15px; text-decoration: none; cursor: pointer; border: 1px solid transparent; font-family: inherit; }
.btn-primary { background: linear-gradient(135deg, var(--cx-accent, #00e0b5), var(--cx-accent-2, #3f8cff)); color: #04110d; box-shadow: 0 10px 30px rgba(0, 224, 181, 0.35); }
[data-theme="light"] .btn-primary { color: #fff; box-shadow: 0 10px 26px rgba(0, 133, 109, 0.35); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-secondary { background: var(--cx-surface-2, #131c2c); color: var(--cx-text, #f3f6fb); border-color: var(--cx-border, rgba(255, 255, 255, 0.09)); }
[data-theme="light"] .btn-secondary { background: #fff; }
.btn-secondary:hover { border-color: var(--cx-accent, #00e0b5); }
.btn-ghost { background: transparent; color: var(--cx-text, #f3f6fb); border-color: var(--cx-border, rgba(255, 255, 255, 0.09)); }
.btn-ghost:hover { border-color: var(--cx-accent, #00e0b5); }
.btn-danger { background: #d92d20; color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 0 18px; font-size: 14px; }
/* legacy aliases — same system values, old names */
.btn-red { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 26px; border-radius: 10px; font-weight: 800; font-size: 15px; cursor: pointer; border: 1px solid transparent; font-family: inherit; background: linear-gradient(135deg, var(--cx-accent, #00e0b5), var(--cx-accent-2, #3f8cff)); color: #04110d; box-shadow: 0 10px 30px rgba(0, 224, 181, 0.35); }
[data-theme="light"] .btn-red { color: #fff; }
.btn-darkred { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 26px; border-radius: 10px; font-weight: 800; font-size: 15px; cursor: pointer; font-family: inherit; background: var(--cx-surface-2, #131c2c); color: var(--cx-text, #f3f6fb); border: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); }

/* ============ Cards ============ */
.card { background: var(--cx-surface, #0e1622); border: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); border-radius: 14px; padding: 22px; margin: 16px 0; }
[data-theme="light"] .card { background: #fff; border-color: #e2e6ea; }
.card-header { display: flex; align-items: center; gap: 12px; margin: -22px -22px 16px; padding: 16px 22px; border-bottom: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); }
.card-header h2, .card-header h3 { margin: 0; font-size: 17px; }
.card-body { padding: 0; }
.card-footer { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px -22px -22px; padding: 16px 22px; border-top: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); }
.card h2 { margin: 0 0 8px; font-size: 20px; }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { color: var(--cx-muted, #a3b0c2); font-size: 14.5px; }

/* ============ Forms ============ */
.label { display: block; font-size: 13.5px; font-weight: 700; margin: 14px 0 6px; color: var(--cx-text, #f3f6fb); }
.input, .select {
  width: 100%; box-sizing: border-box; font-family: inherit; font-size: 15px;
  background: var(--cx-input-bg, #0a111c); color: var(--cx-text, #f3f6fb);
  border: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); border-radius: 10px;
  min-height: 48px; padding: 10px 14px;
}
[data-theme="light"] .input, [data-theme="light"] .select { background: #fff; border-color: #e2e6ea; color: #10151d; }
.input:focus, .select:focus { border-color: var(--cx-accent, #00e0b5); outline: 2px solid var(--cx-focus, #3f8cff); outline-offset: 1px; }
.input-group { display: flex; gap: 10px; flex-wrap: wrap; }
.input-group .input { flex: 1; min-width: 200px; }
.field-help { font-size: 12.5px; color: var(--cx-muted, #a3b0c2); margin: 6px 0 0; }

/* ============ Alerts ============ */
.alert { border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-top: 16px; overflow-wrap: anywhere; border: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); background: rgba(127, 144, 168, 0.1); color: var(--cx-text, #f3f6fb); }
.alert:empty { display: none; }
.alert-info { border-color: rgba(63, 140, 255, 0.5); background: rgba(63, 140, 255, 0.12); }
.alert-warning { border-color: rgba(245, 158, 11, 0.55); background: rgba(245, 158, 11, 0.12); }
.alert-danger { border-color: rgba(217, 45, 32, 0.55); background: rgba(217, 45, 32, 0.12); }
.alert-success { border-color: rgba(34, 197, 94, 0.5); background: rgba(34, 197, 94, 0.12); }
.alert[data-state="ok"] { border-color: rgba(34, 197, 94, 0.5); background: rgba(34, 197, 94, 0.12); }
.alert[data-state="err"] { border-color: rgba(217, 45, 32, 0.55); background: rgba(217, 45, 32, 0.12); }
/* legacy alias */
.info-box { border-radius: 10px; padding: 14px 16px; font-size: 14px; border: 1px solid rgba(245, 158, 11, 0.55); background: rgba(245, 158, 11, 0.12); color: var(--cx-text, #f3f6fb); }
.link-danger, .url-red { color: #d92d20; }

/* ============ Badges / pills ============ */
.badge { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; border: 1px solid var(--cx-accent, #00e0b5); color: var(--cx-accent, #00e0b5); border-radius: 999px; padding: 4px 10px; }
.pill { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--cx-text, #f3f6fb); border: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); background: rgba(127, 144, 168, 0.1); border-radius: 999px; padding: 6px 14px; }
.mac-chip { display: inline-block; background: rgba(127, 144, 168, 0.12); color: var(--cx-text, #f3f6fb); border: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); border-radius: 999px; padding: 4px 14px; font-family: ui-monospace, monospace; font-size: 13px; }

/* ============ Modal ============ */
.modal { position: fixed; inset: 0; background: rgba(3, 6, 12, 0.78); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal > div, .modal-box { background: var(--cx-surface, #0e1622); border: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); color: var(--cx-text, #f3f6fb); border-radius: 16px; padding: 24px; max-width: 520px; width: 100%; max-height: 88vh; overflow: auto; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5); }
[data-theme="light"] .modal > div, [data-theme="light"] .modal-box { background: #fff; border-color: #e2e6ea; color: #10151d; }
.modal-header { display: flex; align-items: center; margin: 0 0 12px; }
.modal-header h3 { margin: 0; font-size: 18px; }
.modal-body { font-size: 14.5px; color: var(--cx-muted, #a3b0c2); }
.modal-footer { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ============ Tables ============ */
.table { border-collapse: collapse; width: 100%; font-size: 14px; }
.table-header thead th, .table thead th { color: var(--cx-muted, #a3b0c2); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); }
.table-row tbody td, .table tbody td { padding: 12px; border-bottom: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); vertical-align: middle; overflow-wrap: anywhere; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(127, 144, 168, 0.07); }

/* ============ Client-area sidebar layout ============ */
.ca-page { padding: 20px; max-width: 1240px; margin: 0 auto; }
.ca-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.ca-main { min-width: 0; max-width: 1200px; }
.ca-side { background: var(--cx-surface, #0e1622); border: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); border-radius: 14px; padding: 12px; position: sticky; top: 76px; }
[data-theme="light"] .ca-side { background: #fff; border-color: #e2e6ea; }
.ca-side a, .sidebar-item { display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 10px 12px; border-radius: 10px; color: var(--cx-muted, #a3b0c2); text-decoration: none; font-weight: 600; font-size: 14.5px; }
.ca-side a svg { width: 18px; height: 18px; flex: none; }
.ca-side a:hover, .sidebar-item:hover { background: rgba(127, 144, 168, 0.14); color: var(--cx-text, #f3f6fb); }
.ca-side a[aria-current="page"], .sidebar-item-active { background: linear-gradient(135deg, var(--cx-accent, #00e0b5), var(--cx-accent-2, #3f8cff)); color: #04110d; box-shadow: 0 10px 30px rgba(0, 224, 181, 0.35); }
[data-theme="light"] .ca-side a[aria-current="page"], [data-theme="light"] .sidebar-item-active { color: #fff; box-shadow: 0 10px 26px rgba(0, 133, 109, 0.35); }
.ca-head { background: var(--cx-surface, #0e1622); border: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); border-radius: 14px; padding: 20px 24px; margin-bottom: 16px; }
[data-theme="light"] .ca-head { background: #fff; border-color: #e2e6ea; }
.ca-head h1 { margin: 0 0 4px; font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -0.02em; }
.ca-head p { margin: 0; color: var(--cx-muted, #a3b0c2); }
.ca-burger { display: none; background: none; border: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); border-radius: 10px; width: 44px; height: 44px; cursor: pointer; padding: 0; margin-bottom: 12px; }
.ca-burger span { display: block; height: 2px; margin: 5px 11px; background: var(--cx-text, #f3f6fb); border-radius: 2px; }

/* ============ Breadcrumb / toast / spinner ============ */
.breadcrumb { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; color: var(--cx-muted, #a3b0c2); margin: 0 0 12px; }
.breadcrumb a { color: var(--cx-accent, #00e0b5); text-decoration: none; font-weight: 600; }
.breadcrumb span[aria-current="page"] { color: var(--cx-text, #f3f6fb); }
.toast { position: fixed; bottom: 20px; right: 20px; background: #059669; color: #fff; font-weight: 700; font-size: 14px; border-radius: 10px; padding: 12px 18px; display: none; z-index: 120; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4); max-width: min(420px, 90vw); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(127, 144, 168, 0.3); border-top-color: var(--cx-accent, #00e0b5); animation: ds-spin 0.8s linear infinite; }
@keyframes ds-spin { to { transform: rotate(360deg); } }

/* ============ Drawer (< 992px) with slide transition ============ */
@media (max-width: 991px) {
  .ca-layout { grid-template-columns: 1fr; }
  .ca-burger { display: block; }
  .ca-side { position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 84vw); z-index: 90; border-radius: 0 16px 16px 0; overflow-y: auto; transform: translateX(-105%); transition: transform 250ms ease-out; }
  .ca-side.open { transform: none; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5); }
}
@media (prefers-reduced-motion: reduce) {
  .ca-side { transition: none; }
  .spinner { animation: none; }
}

/* ============ Form fields inside cards & modals ============
   Applies homepage input/label styling without touching per-field markup. */
.card label, .modal label { display: block; font-size: 13.5px; font-weight: 700; margin: 14px 0 6px; color: var(--cx-text, #f3f6fb); }
.card input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]),
.card select, .card textarea,
.modal input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]),
.modal select, .modal textarea {
  width: 100%; box-sizing: border-box; font-family: inherit; font-size: 15px;
  background: var(--cx-input-bg, #0a111c); color: var(--cx-text, #f3f6fb);
  border: 1px solid var(--cx-border, rgba(255, 255, 255, 0.09)); border-radius: 10px;
  min-height: 48px; padding: 10px 14px;
}
.card input:focus, .card select:focus, .modal input:focus, .modal select:focus {
  border-color: var(--cx-accent, #00e0b5); outline: 2px solid var(--cx-focus, #3f8cff); outline-offset: 1px;
}

/* ============ Toolbar + code display ============ */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.code-display { font-size: 28px; font-weight: 800; letter-spacing: 6px; overflow-wrap: anywhere; }
.link-accent { color: var(--cx-accent, #00e0b5); font-weight: 600; }
