/* ═══════════════════════════════════════════════════════════════════════════
   Vorks ID — Pro Design System
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Brand */
  --red:        #ef4444;
  --red-bright: #f87171;
  --red-dark:   #dc2626;
  --red-deep:   #991b1b;
  --red-dim:    rgba(239, 68, 68, 0.14);
  --red-dim2:   rgba(239, 68, 68, 0.06);
  --red-glow:   rgba(239, 68, 68, 0.35);

  /* Surface — refined depth scale */
  --bg:    #08090b;
  --bg2:   #0d0e10;
  --bg3:   #131418;
  --bg4:   #1a1b1f;
  --bg5:   #232529;
  --bg6:   #2c2e34;

  --surface:    linear-gradient(180deg, #15161a 0%, #101115 100%);
  --surface-2:  linear-gradient(180deg, #1a1c20 0%, #15161a 100%);
  --surface-hi: linear-gradient(180deg, #1f2126 0%, #17181c 100%);

  /* Borders */
  --border:   rgba(255, 255, 255, 0.06);
  --border2:  rgba(255, 255, 255, 0.10);
  --border3:  rgba(255, 255, 255, 0.16);
  --border-hi:rgba(255, 255, 255, 0.22);

  /* Text */
  --text:   #f5f5f7;
  --text2:  #a1a1aa;
  --text3:  #71717a;
  --text4:  #52525b;
  --text5:  #3f3f46;

  /* Semantic */
  --success:     #10b981;
  --success-dim: rgba(16, 185, 129, 0.14);
  --warn:        #f59e0b;
  --warn-dim:    rgba(245, 158, 11, 0.14);
  --info:        #3b82f6;
  --info-dim:    rgba(59, 130, 246, 0.14);
  --purple:      #a855f7;
  --purple-dim:  rgba(168, 85, 247, 0.14);
  --pink:        #ec4899;

  /* Typography */
  --font: 'Inter', 'DM Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'DM Mono', 'SF Mono', ui-monospace, monospace;

  /* Layout */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius:    9px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  /* Motion */
  --tr:        150ms cubic-bezier(0.4, 0, 0.2, 1);
  --tr-md:     220ms cubic-bezier(0.4, 0, 0.2, 1);
  --tr-bounce: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Shadows */
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:       0 4px 12px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg:    0 12px 32px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-xl:    0 24px 48px rgba(0, 0, 0, 0.7), 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-red:   0 0 0 1px rgba(239, 68, 68, 0.4), 0 8px 24px rgba(239, 68, 68, 0.2);

  --hl-top: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ─── Reset ────────────────────────────────────────────────────────────────── */

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

html {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11" 1, "ss01" 1;
}

body {
  min-height: 100vh;
  position: relative;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(239, 68, 68, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at 100% 100%, rgba(168, 85, 247, 0.02) 0%, transparent 50%),
    var(--bg);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: center center;
  -webkit-mask-image: radial-gradient(ellipse 100% 80% at 50% 50%, black 30%, transparent 90%);
  mask-image: radial-gradient(ellipse 100% 80% at 50% 50%, black 30%, transparent 90%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

::selection { background: var(--red-dim); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--bg5);
  border-radius: 10px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--bg6); }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.1px;
  cursor: pointer;
  transition: all var(--tr);
  border: 1px solid transparent;
  white-space: nowrap;
  position: relative;
  isolation: isolate;
  user-select: none;
  font-family: inherit;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.98); }

.btn-primary {
  background: linear-gradient(180deg, var(--red) 0%, var(--red-dark) 100%);
  color: #fff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.15) inset,
    0 0 0 1px rgba(239, 68, 68, 0.5),
    0 6px 16px rgba(239, 68, 68, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--red-bright) 0%, var(--red) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 0 0 1px rgba(239, 68, 68, 0.7),
    0 10px 24px rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--bg3);
  border-color: var(--border2);
  color: var(--text2);
  box-shadow: var(--hl-top);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg4);
  color: var(--text);
  border-color: var(--border3);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red-bright);
}
.btn-danger:hover:not(:disabled) {
  background: var(--red-dim);
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.btn-sm { padding: 7px 13px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 13px 24px; font-size: 14px; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--tr);
  font-family: inherit;
}
.btn-icon:hover {
  background: var(--bg4);
  color: var(--text);
  border-color: var(--border3);
  transform: translateY(-1px);
}
.btn-icon.btn-icon-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--red-bright);
}

/* ─── Form elements ────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: all var(--tr);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset;
}
.form-input::placeholder { color: var(--text4); }
.form-input:hover { border-color: var(--border2); }
.form-input:focus {
  border-color: var(--red);
  background: var(--bg4);
  box-shadow:
    0 0 0 3px rgba(239, 68, 68, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.2) inset;
}

.form-hint {
  font-size: 11.5px;
  color: var(--text4);
  margin-top: 6px;
  line-height: 1.5;
}

.search-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 13px 8px 32px;
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  width: 260px;
  transition: all var(--tr);
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}
.search-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

select.form-input,
select.search-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a1a1aa' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}

/* ─── Toggle ───────────────────────────────────────────────────────────────── */

.toggle {
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: var(--bg5);
  border: 1px solid var(--border2);
  cursor: pointer;
  position: relative;
  transition: background var(--tr), border-color var(--tr);
  flex-shrink: 0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}
.toggle.on {
  background: linear-gradient(180deg, #14d68b 0%, #0d9f66 100%);
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 0 3px rgba(16, 185, 129, 0.1);
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff 0%, #e5e7eb 100%);
  transition: transform var(--tr-bounce);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.toggle.on::after { transform: translateX(16px); }

/* ─── Cards ────────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  overflow: hidden;
  box-shadow: var(--shadow), var(--hl-top);
  transition: border-color var(--tr);
}

.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
}

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.card-body { padding: 22px; }

/* ─── Tables ───────────────────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text4);
  padding: 11px 22px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
  font-weight: 600;
}

td {
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr { transition: background var(--tr); }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.btn-row { display: flex; gap: 6px; }

/* ─── Badges ───────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.badge-success { background: var(--success-dim); color: #4ade80; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-danger  { background: var(--red-dim); color: var(--red-bright); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-warn    { background: var(--warn-dim); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-info    { background: var(--info-dim); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-purple  { background: var(--purple-dim); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-neutral { background: var(--bg4); color: var(--text3); border: 1px solid var(--border2); }

/* ─── Modal ────────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modalFade 200ms ease both;
}

@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface-2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 30px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlide 250ms cubic-bezier(0.16, 1, 0.3, 1) both;
  box-shadow: var(--shadow-xl), var(--hl-top);
}

@keyframes modalSlide {
  from { transform: translateY(20px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-title {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.4px;
}

.modal-sub {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 24px;
}

.modal-close {
  float: right;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  transition: all var(--tr);
}
.modal-close:hover {
  color: var(--text);
  background: var(--bg4);
  border-color: var(--border3);
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ─── Confirm modal (pro) ──────────────────────────────────────────────────── */

.confirm-modal {
  max-width: 440px;
  text-align: center;
  padding: 32px 30px 26px;
}

.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 18px;
  box-shadow: var(--hl-top);
  position: relative;
}
.confirm-icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  opacity: 0.3;
  z-index: -1;
  filter: blur(8px);
}

.confirm-icon-primary {
  background: linear-gradient(180deg, var(--info-dim) 0%, rgba(59, 130, 246, 0.04) 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}
.confirm-icon-primary::after { background: rgba(59, 130, 246, 0.4); }

.confirm-icon-danger {
  background: linear-gradient(180deg, var(--red-dim) 0%, rgba(239, 68, 68, 0.04) 100%);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--red-bright);
}
.confirm-icon-danger::after { background: rgba(239, 68, 68, 0.5); }

.confirm-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}

.confirm-message {
  color: var(--text2);
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 340px;
  margin: 0 auto;
}

.confirm-modal .modal-footer {
  border-top: none;
  padding-top: 0;
  justify-content: center !important;
}
.confirm-modal .modal-footer .btn { min-width: 110px; }

/* ─── Toast ────────────────────────────────────────────────────────────────── */

#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  min-width: 300px;
  max-width: 400px;
  pointer-events: all;
  cursor: default;
  animation: toastIn 350ms cubic-bezier(0.16, 1, 0.3, 1) both;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.toast.removing { animation: toastOut 250ms ease both; }

@keyframes toastIn  { from { opacity: 0; transform: translateX(50px) scale(0.95); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); }   to { opacity: 0; transform: translateX(50px); } }

.toast-success { background: rgba(13, 43, 25, 0.95); border: 1px solid rgba(16, 185, 129, 0.4); color: #6ee7b7; }
.toast-error   { background: rgba(43, 13, 13, 0.95); border: 1px solid rgba(239, 68, 68, 0.4); color: var(--red-bright); }
.toast-info    { background: rgba(13, 26, 43, 0.95); border: 1px solid rgba(59, 130, 246, 0.4); color: #93c5fd; }
.toast-warn    { background: rgba(43, 31, 13, 0.95); border: 1px solid rgba(245, 158, 11, 0.4); color: #fcd34d; }

.toast-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
}
.toast-msg { flex: 1; line-height: 1.45; }
.toast-close-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.5;
  font-size: 18px;
  padding: 0;
  flex-shrink: 0;
  transition: opacity var(--tr);
}
.toast-close-btn:hover { opacity: 1; }

/* ─── Spinner ──────────────────────────────────────────────────────────────── */

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Utility ──────────────────────────────────────────────────────────────── */

.text-mono { font-family: var(--mono); font-feature-settings: "tnum" 1; }
.text-sm   { font-size: 12px; }
.text-xs   { font-size: 11px; }
.text-dim  { color: var(--text2); }
.text-dim3 { color: var(--text3); }
.text-dim4 { color: var(--text4); }

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text4);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-title { color: var(--text2); margin-bottom: 6px; font-size: 14px; font-weight: 500; }

.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 12.5px;
  margin: 12px 0;
  line-height: 1.6;
}
.alert-info    { background: var(--info-dim); border: 1px solid rgba(59, 130, 246, 0.25); color: #93c5fd; }
.alert-warn    { background: var(--warn-dim); border: 1px solid rgba(245, 158, 11, 0.25); color: #fcd34d; }
.alert-success { background: var(--success-dim); border: 1px solid rgba(16, 185, 129, 0.25); color: #6ee7b7; }
.alert-danger  { background: var(--red-dim2); border: 1px solid rgba(239, 68, 68, 0.25); color: var(--red-bright); }
