/*
 * brand.css — shared design system for the customer-facing site
 * (landing page, login, register, dashboard). Colors sampled directly
 * from the UnlockCD logo artwork (unlockccd.jpg): the padlock/eraser
 * blue->purple gradient (#2981FD -> #5956FB) and the dark navy wordmark
 * (#0B1E46) — same palette XRTheme.h uses in the macOS app, so the web
 * side and the app feel like one product instead of two different looks.
 *
 * Design language: minimal, restrained, one accent (the brand gradient),
 * used sparingly — not on every element. Flat surfaces, hairline borders,
 * consistent 4px spacing scale, no decorative shapes/blurs/halos.
 */

:root {
  --brand-blue: #2981FD;
  --brand-purple: #5956FB;
  --bg: #0a0b0e;
  --card: #12141a;
  --card-alt: #171922;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --text: rgba(255,255,255,0.94);
  --text-dim: rgba(255,255,255,0.56);
  --text-faint: rgba(255,255,255,0.34);
  --green: #34D399;
  --red: #F87171;
  --orange: #FBBF24;
  --radius: 12px;
  --radius-sm: 8px;
  --gradient: linear-gradient(135deg, var(--brand-blue), var(--brand-purple));

  /* Motion tokens — strong custom easing curves, not the weak CSS
     built-ins. ease-out for anything entering/exiting or responding to
     a click; ease-in-out only for on-screen movement; never ease-in on
     UI (it starts slow and reads as sluggish). */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-fast: 140ms;   /* button press feedback */
  --dur-base: 180ms;   /* hover, small popovers */
  --dur-modal: 240ms;  /* larger surfaces */
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

svg { display: block; flex: none; }
img { display: block; max-width: 100%; }

a { color: var(--text); text-decoration: none; transition: color var(--dur-base) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  a:hover { color: var(--brand-blue); }
}

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }

.brand-gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Top nav ──────────────────────────────────────────────── */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  border-bottom: 1px solid var(--border);
}
.topnav .logo-group { display: flex; align-items: center; gap: 10px; }
.topnav .logo-group img { width: 28px; height: 28px; border-radius: 7px; }
.topnav .logo-group span { font-weight: 600; font-size: 15px; }
.topnav nav { display: flex; align-items: center; gap: 32px; }
.topnav nav a { color: var(--text-dim); font-size: 14px; transition: color var(--dur-base) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .topnav nav a:hover { color: var(--text); }
}
.topnav .cta-group { display: flex; align-items: center; gap: 12px; }

/* ── Buttons — one style per intent, nothing decorative ──── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-out),
              background-color var(--dur-base) var(--ease-out),
              opacity var(--dur-base) var(--ease-out);
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { opacity: 0.92; }
  .btn-secondary:hover { background: var(--card-alt); opacity: 1; }
}
.btn-primary { background: var(--gradient); color: #fff; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-whatsapp { background: #25D366; color: #06210f; }
.btn-block { width: 100%; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

/* ── Forms ────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field:last-of-type { margin-bottom: 20px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--dur-base) var(--ease-out);
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--brand-blue);
}
.field .hint { font-size: 12px; color: var(--text-faint); margin-top: 6px; }

/* ── Auth pages — one centered card, no split-panel gimmick ── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-shell .top-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.auth-shell .top-logo img { width: 30px; height: 30px; border-radius: 8px; }
.auth-shell .top-logo span { font-weight: 600; font-size: 15px; color: var(--text); }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { font-size: 20px; text-align: center; margin-bottom: 6px; }
.auth-box .sub { text-align: center; color: var(--text-dim); font-size: 13.5px; margin-bottom: 28px; }
.auth-box .switch { text-align: center; font-size: 13.5px; color: var(--text-dim); margin-top: 20px; }
.auth-box .switch a { color: var(--brand-blue); font-weight: 600; transition: color var(--dur-base) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .auth-box .switch a:hover { color: var(--text); }
}

/* ── Flash messages ───────────────────────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13.5px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);

  @starting-style {
    opacity: 0;
    transform: translateY(-4px);
  }
}
.flash svg { width: 16px; height: 16px; flex: none; }
.flash-ok    { background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.25); color: var(--green); }
.flash-error { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.25); color: var(--red); }

/* ── Tables ───────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }
.mono { font-family: 'SF Mono', Menlo, monospace; font-size: 12.5px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-faint); font-size: 13.5px; }
.empty-state svg { width: 26px; height: 26px; margin: 0 auto 10px; opacity: 0.5; }

/* ── Dashboard layout ─────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 280px 1fr; gap: 20px; margin-top: 32px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

.credit-stat-row { display: flex; align-items: center; gap: 16px; }
.credit-stat .num { font-size: 36px; font-weight: 700; line-height: 1; }
.credit-stat .label { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

.top-user { display: flex; align-items: center; gap: 10px; }
.top-user .avatar {
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex: none;
}
.top-user .name { font-size: 13.5px; color: var(--text-dim); }

@media (max-width: 760px) {
  .dash-grid { grid-template-columns: 1fr; }
  .topnav nav { display: none; }
}

/* ── Icon badges & status pills ───────────────────────────── */
.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex: none;
}
.icon-badge svg { width: 18px; height: 18px; }
.icon-badge-gradient { background: var(--gradient); color: #fff; }
.icon-badge-soft { background: rgba(41,129,253,0.1); color: var(--brand-blue); }
.icon-badge-lg { width: 52px; height: 52px; border-radius: 14px; }
.icon-badge-lg svg { width: 24px; height: 24px; }

.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.card-head .titles { display: flex; flex-direction: column; }
.card-head .titles .t { font-weight: 600; font-size: 14.5px; }
.card-head .titles .s { font-size: 12.5px; color: var(--text-dim); margin-top: 1px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pill svg { width: 11px; height: 11px; }
.pill-completed, .pill-active, .pill-authorized, .pill-ok { background: rgba(52,211,153,0.1); color: var(--green); }
.pill-failed, .pill-disabled, .pill-revoked, .pill-error { background: rgba(248,113,113,0.1); color: var(--red); }
.pill-refunded, .pill-pending, .pill-unregistered { background: rgba(251,191,36,0.1); color: var(--orange); }

/* ============================================================
   App shell — sidebar navigation for logged-in customer pages
   (dashboard.php "Overview", orders.php, api.php). Same structural
   pattern as the admin panel's sidebar, kept in this shared file
   since dashboard pages already load brand.css.
   ============================================================ */

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 24px; }
.sidebar-brand img { width: 26px; height: 26px; border-radius: 7px; }
.sidebar-brand span { font-weight: 600; font-size: 14.5px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 10px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text-dim);
  transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}
.sidebar-nav a svg { width: 16px; height: 16px; flex: none; }
@media (hover: hover) and (pointer: fine) {
  .sidebar-nav a:hover { background: var(--card-alt); color: var(--text); }
}
.sidebar-nav a.active { background: var(--card-alt); color: var(--text); }
.nav-badge {
  margin-left: auto;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(41,129,253,0.14); color: var(--brand-blue);
}

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.sidebar-whatsapp {
  display: flex; align-items: center; gap: 9px;
  height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; color: #25D366;
  background: rgba(37,211,102,0.08);
  transition: background-color var(--dur-base) var(--ease-out);
}
.sidebar-whatsapp svg { width: 15px; height: 15px; }
@media (hover: hover) and (pointer: fine) {
  .sidebar-whatsapp:hover { background: rgba(37,211,102,0.15); color: #25D366; }
}

.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 4px 6px; }
.sidebar-user .avatar {
  width: 30px; height: 30px; border-radius: 999px; flex: none;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; color: #fff;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info .name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .email { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-icon {
  display: flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: var(--radius-sm); color: var(--text-faint); flex: none;
  transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}
.logout-icon svg { width: 15px; height: 15px; }
@media (hover: hover) and (pointer: fine) {
  .logout-icon:hover { background: var(--card-alt); color: var(--red); }
}

.main-content { padding: 40px 48px; max-width: 1080px; }

.sidebar-toggle-input { display: none; }
.mobile-topbar { display: none; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.page-header h1 { font-size: 22px; margin-bottom: 4px; }
.page-header .sub { color: var(--text-dim); font-size: 13.5px; }

/* ── Dashboard grid (Overview page) ──────────────────────── */
.overview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat-card .num { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-card .label { color: var(--text-dim); font-size: 12.5px; margin-top: 4px; }

.content-grid { display: grid; grid-template-columns: 1.1fr 1.5fr; gap: 20px; align-items: start; }

/* ── Soon badge (API page) ───────────────────────────────── */
.soon-panel { text-align: center; padding: 64px 32px; }
.soon-panel .icon-badge { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 20px; }
.soon-panel .icon-badge svg { width: 26px; height: 26px; }
.soon-panel h2 { font-size: 19px; margin-bottom: 8px; }
.soon-panel p { color: var(--text-dim); font-size: 14px; max-width: 420px; margin: 0 auto 20px; }
.badge-soon {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(41,129,253,0.12); color: var(--brand-blue);
  margin-bottom: 18px;
}
.badge-soon svg { width: 12px; height: 12px; }

.code-preview {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 18px; text-align: left; font-family: 'SF Mono', Menlo, monospace; font-size: 12.5px;
  color: var(--text-dim); max-width: 420px; margin: 24px auto 0; opacity: 0.7;
}
.code-preview .line { padding: 2px 0; }
.code-preview .k { color: var(--brand-blue); }
.code-preview .s { color: var(--green); }

@media (max-width: 980px) {
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 56px; left: 0; bottom: 0; width: 248px; z-index: 20;
    transform: translateX(-100%);
    transition: transform var(--dur-modal) var(--ease-out);
  }
  .sidebar-toggle-input:checked ~ .sidebar { transform: translateX(0); }
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    height: 56px; padding: 0 20px; background: var(--card);
    border-bottom: 1px solid var(--border); cursor: pointer;
    position: sticky; top: 0; z-index: 21;
  }
  .mobile-topbar-brand { display: flex; align-items: center; gap: 9px; }
  .mobile-topbar-brand img { width: 24px; height: 24px; border-radius: 6px; }
  .mobile-topbar-brand span { font-weight: 600; font-size: 14px; color: var(--text); }
  .mobile-topbar-menu { display: flex; color: var(--text-dim); }
  .mobile-topbar-menu svg { width: 20px; height: 20px; }
  .main-content { padding: 24px 20px; }
  .overview-grid { grid-template-columns: 1fr; }
}
@media (min-width: 861px) {
  .sidebar-toggle-input, .mobile-topbar { display: none !important; }
}
