/* Tweetycam Warranty System — Light theme, dashboard-aligned design language */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  /* ── Core palette (light mode) ── */
  --bg:         #ffffff;
  --bg-2:       #f7f6f3;       /* page secondary */
  --surface:    #ffffff;        /* cards */
  --surface2:   #f7f6f3;        /* inputs / nested surfaces */
  --surface3:   #efece6;        /* hover / pressed */
  --border:     #e6e2d8;        /* primary divider */
  --border-soft:#efece6;
  --grid:       #f1ede4;

  /* ── Text ── */
  --text:       #1a1d24;        /* primary ink — near-black, warm */
  --text-dim:   #555a66;        /* secondary */
  --text-muted: #8a8f9a;        /* tertiary / placeholder */

  /* ── Accent (dashboard gold) ── */
  --gold:       #c89020;        /* darker gold for legibility on white */
  --gold-bright:#f5b842;        /* hero / button fill */
  --gold-soft:  rgba(245,184,66,0.12);
  --gold-line:  rgba(200,144,32,0.35);

  /* ── Status ── */
  --success:    #1f9d4d;
  --warn:       #b97509;
  --danger:     #c53030;
  --info:       #1e5fbf;

  --radius:     10px;
  --shadow:     0 1px 2px rgba(20,18,12,0.04), 0 4px 16px rgba(20,18,12,0.06);
  --shadow-sm:  0 1px 2px rgba(20,18,12,0.05);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  min-height: 100vh;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  /* 3-column grid: brand on the left, nav perfectly centred, optional right slot. */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-brand { justify-self: start; }
.header-nav   { justify-self: center; }

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.header-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav-link {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-dim);
  transition: all 0.15s;
  line-height: 1.2;
}

.nav-link:hover {
  background: var(--surface2);
  color: var(--text);
}

/* Active tab — visually larger + stronger emphasis so the team knows where they are. */
.nav-link.active {
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 16px;
  padding: 10px 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ── Main container ─────────────────────────────────────────────────────── */

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ── Page title ─────────────────────────────────────────────────────────── */

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.page-sub {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 28px;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 18px;
}

/* ── Form fields ────────────────────────────────────────────────────────── */

.field {
  margin-bottom: 18px;
}

.field:last-child { margin-bottom: 0; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

label .req {
  color: var(--danger);
  margin-left: 2px;
}

label .auto {
  font-size: 10px;
  font-weight: 600;
  color: var(--info);
  margin-left: 6px;
  text-transform: none;
  letter-spacing: 0;
  background: rgba(30,95,191,0.10);
  padding: 1px 6px;
  border-radius: 4px;
}

input[type="text"],
input[type="url"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  padding: 11px 14px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238a8f9a' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

input.auto-filled, select.auto-filled {
  border-color: rgba(30,95,191,0.4);
  background: rgba(30,95,191,0.04);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

/* ── Gorgias URL field special ──────────────────────────────────────────── */

.url-wrap {
  position: relative;
}

.url-status {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Banners ─────────────────────────────────────────────────────────────── */

.banner {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.banner-warn {
  background: rgba(185,117,9,0.08);
  border: 1px solid rgba(185,117,9,0.25);
  color: var(--warn);
}

.banner-success {
  background: rgba(31,157,77,0.08);
  border: 1px solid rgba(31,157,77,0.25);
  color: var(--success);
}

.banner-error {
  background: rgba(197,48,48,0.08);
  border: 1px solid rgba(197,48,48,0.25);
  color: var(--danger);
}

.banner-info {
  background: rgba(30,95,191,0.08);
  border: 1px solid rgba(30,95,191,0.25);
  color: var(--info);
}

.banner-icon { flex-shrink: 0; font-size: 16px; }

/* ── Success card ───────────────────────────────────────────────────────── */

.success-card {
  background: var(--surface);
  border: 1px solid rgba(31,157,77,0.3);
  border-radius: var(--radius);
  padding: 32px 28px;
  text-align: center;
  box-shadow: var(--shadow);
}

.success-icon { font-size: 48px; margin-bottom: 12px; }

.success-case-id {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 28px;
  font-weight: 500;
  color: var(--gold);
  margin-bottom: 8px;
}

.success-detail {
  font-size: 15px;
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.6;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--gold-bright);
  color: #1a1d24;
  box-shadow: 0 1px 2px rgba(200,144,32,0.25);
}

.btn-primary:hover:not(:disabled) {
  background: #f7c55a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245,184,66,0.35);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--surface3); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-full { width: 100%; }

.btn-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Status badge ───────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.badge-ordered   { background: rgba(30,95,191,0.10);  color: #1e5fbf; border-color: rgba(30,95,191,0.25); }
.badge-shipped   { background: rgba(185,117,9,0.10);  color: #b97509; border-color: rgba(185,117,9,0.25); }
.badge-transit   { background: rgba(124,58,237,0.10); color: #6d28d9; border-color: rgba(124,58,237,0.25); }
.badge-received  { background: rgba(31,157,77,0.10);  color: #1f9d4d; border-color: rgba(31,157,77,0.25); }
.badge-china     { background: rgba(197,48,48,0.08);  color: #c53030; border-color: rgba(197,48,48,0.25); }
.badge-closed    { background: var(--surface2);       color: var(--text-dim); border-color: var(--border); }

/* ── Recent cases mini-list ─────────────────────────────────────────────── */

.case-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
  gap: 12px;
}

.case-row:last-child { border-bottom: none; }

.case-id {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--gold);
  min-width: 60px;
}

.case-info {
  flex: 1;
  min-width: 0;
}

.case-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-link {
  text-decoration: none;
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 8px;
  border-radius: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.case-link:hover { color: var(--gold); border-color: var(--gold-line); }

/* ── Stats row ──────────────────────────────────────────────────────────── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
}

.stat-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 22px;
  font-weight: 500;
  color: var(--gold);
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Divider ─────────────────────────────────────────────────────────────── */

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .container { padding: 20px 16px 48px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  /* Stack header on mobile: brand row + nav row. */
  .header {
    padding: 12px 16px;
    grid-template-columns: 1fr;
    gap: 8px;
    justify-items: center;
  }
  .header-brand { justify-self: center; }
  .header-nav { flex-wrap: wrap; justify-content: center; }
  .header-title { display: none; }
  .nav-link { font-size: 12px; padding: 6px 10px; }
  .nav-link.active { font-size: 13px; padding: 7px 14px; }
  .btn-group { flex-direction: column; }
}
