/* GRAIL Owners Card - Premium Design System */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ============================================
   DESIGN TOKENS
   ============================================ */

:root {
  /* Light mode */
  --bg: #f7f6f3;
  --bg-subtle: #efede8;
  --card: #ffffff;
  --card-elevated: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #555;
  --muted: #777;
  --border: #e0ddd6;
  --border-subtle: #ebe8e1;

  /* Brand */
  --accent: #9e7c00;
  --accent-bg: #FFD500;
  --accent-glow: rgba(255, 213, 0, 0.15);
  --accent-text: #1a1a1a;

  /* Semantic */
  --danger: #c0392b;
  --danger-bg: rgba(192, 57, 43, 0.08);
  --ok: #1a7a35;
  --ok-bg: rgba(26, 122, 53, 0.08);
  --warn: #b86e00;
  --warn-bg: rgba(184, 110, 0, 0.08);
  --replaced: #666;
  --replaced-bg: rgba(102, 102, 102, 0.08);

  /* Input */
  --inputbg: #fff;
  --input-border: #ddd8cf;
  --input-focus: #9e7c00;

  /* Surfaces */
  --surface: #f0ede6;
  --overlay: rgba(0, 0, 0, 0.5);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.06);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0d0d0d;
  --bg-subtle: #161616;
  --card: #1a1a1a;
  --card-elevated: #1f1f1f;
  --text: #f0ece4;
  --text-secondary: #bbb;
  --muted: #888;
  --border: #2a2a2a;
  --border-subtle: #222;

  --accent: #FFD500;
  --accent-bg: #FFD500;
  --accent-glow: rgba(255, 213, 0, 0.08);
  --accent-text: #111;

  --danger: #e74c3c;
  --danger-bg: rgba(231, 76, 60, 0.12);
  --ok: #2ecc71;
  --ok-bg: rgba(46, 204, 113, 0.1);
  --warn: #f39c12;
  --warn-bg: rgba(243, 156, 18, 0.1);
  --replaced: #888;
  --replaced-bg: rgba(136, 136, 136, 0.1);

  --inputbg: #111;
  --input-border: #333;
  --input-focus: #FFD500;

  --surface: #141414;
  --overlay: rgba(0, 0, 0, 0.7);

  --shadow-sm: 0 1px 3px rgba(0,0,0,.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.4);
}

/* ============================================
   BASE
   ============================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================
   HEADER
   ============================================ */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

[data-theme="dark"] header {
  background: rgba(13, 13, 13, 0.9);
}

header .title {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 16px;
  color: var(--accent);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, .card-title, .panel-title, .modal-title {
  font-family: 'Outfit', sans-serif;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-primary {
  background: var(--accent-bg);
  color: var(--accent-text);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: 0.3px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  filter: brightness(1.05);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 12px;
  transition: all var(--transition);
}
.btn-ghost:hover { background: var(--surface); border-color: var(--text-secondary); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
}
.btn-danger:hover { filter: brightness(1.1); }

/* ============================================
   LAYOUT
   ============================================ */

main {
  padding: 24px 20px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================
   CARDS / PANELS
   ============================================ */

.card, .panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .card,
[data-theme="dark"] .panel {
  border-color: var(--border-subtle);
}

.card-title, .panel-title {
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.card-subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 20px;
}

/* ============================================
   GRID
   ============================================ */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.grid-full { grid-column: 1 / -1; }

/* ============================================
   FLEX ROW
   ============================================ */

.row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.row-wrap { flex-wrap: wrap; }

/* ============================================
   FORM FIELDS
   ============================================ */

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--input-border);
  background: var(--inputbg);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  outline: none;
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field textarea { resize: vertical; min-height: 80px; }

.hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.prefix-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prefix-text {
  color: var(--text);
  padding: 10px 0;
  min-width: 62px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   TABS
   ============================================ */

.tabs {
  display: flex;
  gap: 6px;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

[data-theme="dark"] .tabs {
  background: rgba(13, 13, 13, 0.9);
}

.tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  transition: all var(--transition);
}
.tab:hover { border-color: var(--accent); color: var(--text); }

.tab.active {
  background: var(--accent-bg);
  color: var(--accent-text);
  border-color: var(--accent-bg);
  font-weight: 700;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============================================
   STATUS BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-ok, .status-badge.status-ACTIVATED, .status-badge.status-activated {
  background: var(--ok-bg); color: var(--ok); border: 1px solid transparent;
}
.badge-err, .status-badge.status-BLOCKED, .status-badge.status-blocked {
  background: var(--danger-bg); color: var(--danger); border: 1px solid transparent;
}
.badge-warn, .status-badge.status-PREREGISTERED, .status-badge.status-preregistered {
  background: var(--warn-bg); color: var(--warn); border: 1px solid transparent;
}
.status-badge.status-REPLACED, .status-badge.status-replaced {
  background: var(--replaced-bg); color: var(--replaced); border: 1px solid transparent;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ============================================
   DETAILS GRID
   ============================================ */

.details-box {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.details-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  margin-bottom: 12px;
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  max-width: 720px;
}

.d-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: background var(--transition);
}
.d-row:hover { background: var(--bg-subtle); }

.d-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  min-width: 130px;
}

.d-val {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

/* ============================================
   RESULT / MESSAGES
   ============================================ */

.result, .msg {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.5;
}

.error-box {
  margin-top: 12px;
  color: #fff;
  background: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13px;
}

/* ============================================
   DIVIDER
   ============================================ */

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* ============================================
   LINKS
   ============================================ */

a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }

/* ============================================
   PRODUCT / REVIEW / DONE BOXES
   ============================================ */

.product-box, .review-box, .done-box {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.5;
}

.p-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.p-line:last-child { border-bottom: none; }

/* ============================================
   CONSENT
   ============================================ */

.consent-box {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 14px;
}

.consent-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}
.consent-row input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--accent-bg);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.consent-details {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* ============================================
   HINT / ATTEMPTS / CONTACT
   ============================================ */

.hint-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.45;
}

.attempts-box {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.contact-box {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

/* ============================================
   SEARCH RESULT BOX
   ============================================ */

.search-result-box {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.search-not-found {
  text-align: center;
  color: var(--muted);
  padding: 20px;
  font-size: 14px;
}

/* ============================================
   LOGIN / MODAL
   ============================================ */

.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  backdrop-filter: blur(4px);
}

.modal {
  width: 92%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 2000;
  color: #fff;
  transition: opacity .3s ease;
  backdrop-filter: blur(4px);
}

.loading-overlay.hide {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: var(--accent-bg);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   PDF LINK
   ============================================ */

.pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}
.pdf-link:hover {
  background: var(--bg-subtle);
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .row { flex-wrap: wrap; }
  header { padding: 14px 16px; flex-wrap: wrap; gap: 8px; }

  main { padding: 16px 14px; }

  .card, .panel { padding: 18px 16px; border-radius: var(--radius-md); }
  .card-title, .panel-title { font-size: 15px; }

  .tabs { padding: 10px 14px; gap: 6px; }
  .tab { padding: 8px 14px; font-size: 12px; }

  .d-row {
    padding: 8px 12px;
    flex-direction: column;
    gap: 2px;
  }
  .d-label { min-width: unset; font-size: 11px; }
  .d-val { text-align: left; font-size: 13px; }

  .field input,
  .field textarea,
  .field select {
    padding: 12px 14px;
    font-size: 15px;
  }

  .modal { width: 94%; padding: 22px 18px; }
  .search-result-box { padding: 16px; }
}

@media (max-width: 480px) {
  header .title { font-size: 14px; letter-spacing: 1px; }
  .btn-ghost { padding: 6px 10px; font-size: 11px; }
  .card, .panel { padding: 14px 12px; }
  .search-result-box { padding: 12px; }
}
