/* ============================================================
   LG Subscribe Hub — Shared Design System
   Mirrors tokens from lgsubscribe.asia (the rotator marketing site)
   Keeps hub's own density: compact cards, admin tables, tight forms.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  /* ---- Brand / Surfaces ---- */
  --warm-cream: #F5F2EB;
  --warm-cream-50: #FAF8F5;
  --warm-cream-200: #E8E4DC;
  --warm-cream-300: #D4CFC4;

  --white: #FFFFFF;

  --lg-red: #A50034;
  --lg-red-dark: #8B002C;
  --lg-red-light: #C6003F;

  --whatsapp-green: #25D366;
  --whatsapp-green-dark: #1DA851;

  /* ---- Neutrals (Tailwind gray scale, matches rotator site) ---- */
  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* ---- Semantic ---- */
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --error: #EF4444;
  --error-light: #FEE2E2;
  --info: #3B82F6;
  --info-light: #DBEAFE;

  /* ---- Radii ---- */
  --radius-sm: 8px;
  --radius-base: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-base: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 6px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.10);
  --shadow-red: 0 4px 12px rgba(165, 0, 52, 0.25);
  --shadow-red-hover: 0 6px 16px rgba(165, 0, 52, 0.35);

  /* ---- Motion ---- */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* ---- Typography ---- */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-body);
  background: var(--warm-cream);
  color: var(--gray-900);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--gray-900); letter-spacing: -0.01em; }

a { color: var(--lg-red); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--lg-red-dark); }

::selection { background: var(--lg-red); color: var(--white); }

/* ============================================================
   Layout primitives
   ============================================================ */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
@media (min-width: 768px) { .container { padding: 0 2rem; } }

.container-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section-padding { padding-top: 2rem; padding-bottom: 2rem; }
@media (min-width: 768px) { .section-padding { padding-top: 3rem; padding-bottom: 3rem; } }

/* ============================================================
   App header (sticky, white, backdrop blur)
   Replaces the old purple gradient header.
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--warm-cream-300);
}

.app-header__nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
@media (min-width: 768px) { .app-header__nav { padding: 16px 2rem; } }

.app-header__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-header__mark {
  width: 36px; height: 36px; border-radius: var(--radius-base);
  background: var(--lg-red);
  color: var(--white);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0;
  flex-shrink: 0;
}
.app-header__title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header__tagline {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 1px;
}

.app-header__actions { display: flex; align-items: center; gap: 10px; }

.app-header__agent { text-align: right; line-height: 1.2; }
.app-header__agent-name { font-size: 13px; font-weight: 600; color: var(--gray-900); }
.app-header__agent-role {
  font-size: 10px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-top: 2px;
}

@media (max-width: 520px) {
  .app-header__tagline { display: none; }
  .app-header__agent-role { display: none; }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition-base);
  padding: 10px 20px;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--lg-red);
  color: var(--white);
  box-shadow: var(--shadow-red);
}
.btn-primary:hover:not(:disabled) {
  background: var(--lg-red-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-red-hover);
  color: var(--white);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-primary-lg {
  padding: 14px 28px;
  font-size: 15px;
}

.btn-whatsapp {
  background: var(--whatsapp-green);
  color: var(--white);
}
.btn-whatsapp:hover:not(:disabled) {
  background: var(--whatsapp-green-dark);
  transform: translateY(-2px);
  color: var(--white);
}

.btn-secondary {
  background: var(--white);
  color: var(--gray-900);
  border: 1px solid var(--gray-300);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--gray-900);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-700);
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--warm-cream-200);
  color: var(--gray-900);
}

.btn-danger {
  background: var(--error);
  color: var(--white);
}
.btn-danger:hover:not(:disabled) {
  background: #DC2626;
  color: var(--white);
}

.btn-success {
  background: var(--success);
  color: var(--white);
}
.btn-success:hover:not(:disabled) {
  background: #059669;
  color: var(--white);
}

.btn-block { width: 100%; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-base);
  border: 1px solid var(--warm-cream-200);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}
.card--hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--warm-cream-300);
}
.card--padded { padding: 32px; }
.card--compact { padding: 16px; }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-hint {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--gray-900);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--gray-400); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--lg-red);
  box-shadow: 0 0 0 3px rgba(165, 0, 52, 0.12);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--gray-50);
  color: var(--gray-500);
  cursor: not-allowed;
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.5; }

.form-error {
  font-size: 13px;
  color: var(--error);
  margin-top: 6px;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.2px;
  line-height: 1.4;
}
.badge-neutral    { background: var(--gray-100);       color: var(--gray-700); }
.badge-draft      { background: var(--warning-light);  color: #92400E; }
.badge-signed     { background: var(--info-light);     color: #1E40AF; }
.badge-pending    { background: var(--warning-light);  color: #92400E; }
.badge-approved   { background: var(--success-light);  color: #065F46; }
.badge-rejected   { background: var(--error-light);    color: #991B1B; }
.badge-admin      { background: var(--error-light);    color: var(--lg-red); }
.badge-internal   { background: var(--warm-cream-200); color: var(--gray-700); }
.badge-external   { background: #FEF3E2;              color: #9A4E00; }

/* ============================================================
   Greeting header (inside main)
   ============================================================ */
.page-heading {
  margin-bottom: 2rem;
}
.page-heading__eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: var(--lg-red);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 6px;
}
.page-heading__title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 2vw + 1rem, 2rem);
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}
.page-heading__subtitle {
  font-size: 15px;
  color: var(--gray-600);
}

/* ============================================================
   Section labels
   ============================================================ */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 14px;
}

/* ============================================================
   Tool grid (hub dashboard)
   ============================================================ */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
@media (max-width: 600px) {
  .tools-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}

.tool-card {
  background: var(--white);
  border: 1px solid var(--warm-cream-200);
  border-radius: var(--radius-base);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--lg-red);
  color: inherit;
}
.tool-card__icon { font-size: 30px; line-height: 1; }
.tool-card__name {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
}
.tool-card__desc {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.5;
}
.tool-card .badge { margin-top: auto; width: fit-content; }

/* ============================================================
   Tables (admin views)
   ============================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-500);
  padding: 10px 14px;
  border-bottom: 1px solid var(--warm-cream-300);
}
.table td {
  padding: 14px;
  border-bottom: 1px solid var(--warm-cream-200);
  vertical-align: middle;
  color: var(--gray-800);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--warm-cream-50); }

/* ============================================================
   Stats grid (admin counters)
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--white);
  border: 1px solid var(--warm-cream-200);
  border-radius: var(--radius-base);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.stat__value {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}
.stat--accent .stat__value { color: var(--lg-red); }
.stat--success .stat__value { color: var(--success); }
.stat--warning .stat__value { color: var(--warning); }
.stat--error .stat__value { color: var(--error); }

/* ============================================================
   Toast (bottom-right)
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  background: var(--gray-900);
  color: var(--white);
  border-radius: var(--radius-base);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--transition-base), transform var(--transition-base);
  pointer-events: none;
  z-index: 100;
  max-width: calc(100vw - 48px);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast--success { background: var(--success); }
.toast--error   { background: var(--error); }

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition-base);
}
.modal-backdrop.show { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--white);
  border-radius: var(--radius-base);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px);
  transition: transform var(--transition-base);
}
.modal-backdrop.show .modal { transform: translateY(0); }

.modal__header {
  display: flex; justify-content: space-between; align-items: start;
  margin-bottom: 20px;
}
.modal__title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}
.modal__close {
  background: transparent; border: none; cursor: pointer;
  color: var(--gray-500); font-size: 20px; line-height: 1;
  padding: 4px;
}
.modal__close:hover { color: var(--gray-900); }

.modal__footer {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--warm-cream-200);
}

/* ============================================================
   Utilities
   ============================================================ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.mt-0 { margin-top: 0; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.mb-xl { margin-bottom: 32px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.w-full { width: 100%; }

/* Accessible focus ring across all interactive elements */
button:focus-visible,
a:focus-visible,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: 2px solid var(--lg-red);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
