/*
 * Covey Design System
 * Shared CSS for all Covey frontend applications.
 *
 * Brand: Warm cream backgrounds, plum/burgundy accents, serif display headings,
 *        Inter body text, polished tables, subtle shadows.
 *
 * Usage: <link rel="stylesheet" href="covey.css"> — copied into each app by deploy pipeline
 *        Then app-specific style.css can override as needed.
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  /* Brand Colors */
  --cream:         #F8F4ED;
  --cream-dark:    #F0EBE1;
  --surface:       #FFFFFF;
  --plum:          #8B5E3C;
  --plum-dark:     #6F4A2E;
  --plum-light:    rgba(139, 94, 60, 0.08);

  /* Text */
  --text:          #2D2A26;
  --text-muted:    #8C8279;
  --text-light:    #B5ADA5;

  /* UI */
  --border:        #E8E2D9;
  --border-light:  #F0EBE3;
  --input-border:  #D5CEC4;
  --dark:          #3D3833;
  --dark-hover:    #2D2A26;

  /* Status */
  --green:         #4A8B6E;
  --green-bg:      #EDF7F1;
  --amber:         #C49A3C;
  --amber-bg:      #FDF8EC;
  --red:           #C75F5F;
  --red-bg:        #FDF0F0;
  --blue:          #5B7FB5;
  --blue-bg:       #EEF3FA;

  /* Spacing & Radius */
  --radius:        8px;
  --radius-lg:     12px;
  --radius-full:   9999px;

  /* Shadows */
  --shadow-sm:     0 1px 2px rgba(45, 42, 38, 0.04);
  --shadow:        0 1px 3px rgba(45, 42, 38, 0.06), 0 1px 2px rgba(45, 42, 38, 0.04);
  --shadow-md:     0 4px 12px rgba(45, 42, 38, 0.08);
  --shadow-lg:     0 12px 40px rgba(45, 42, 38, 0.12);

  /* Transitions */
  --transition:    0.2s ease;

  /* Typography */
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display:  'DM Serif Display', Georgia, 'Times New Roman', serif;
}

/* ========================================================================
   BASE
   ======================================================================== */

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--cream);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--plum); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Pages */
.page { display: none; }
.page.active { display: block; }

/* ========================================================================
   TYPOGRAPHY
   ======================================================================== */

h1, h2, h3 { line-height: 1.2; }
.display { font-family: var(--font-display); }
.serif { font-family: var(--font-display); }
.accent { color: var(--plum); font-style: italic; }
.caps { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); }

/* ========================================================================
   LOGO
   ======================================================================== */

.logo {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--text);
  letter-spacing: -0.3px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.logo:hover { text-decoration: none; }
.logo svg { width: 20px; height: 20px; }
.logo-badge {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--plum-light);
  color: var(--plum);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* ========================================================================
   HEADER / NAV
   ======================================================================== */

.header {
  background: var(--cream);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header nav {
  display: flex;
  gap: 8px;
  align-items: center;
}
.header nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 12px;
  transition: color var(--transition);
}
.header nav a:hover {
  color: var(--text);
  text-decoration: none;
}

/* ========================================================================
   BUTTONS
   ======================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--dark);
  color: #fff;
}
.btn-primary:hover { background: var(--dark-hover); }

.btn-plum {
  background: var(--plum);
  color: #fff;
}
.btn-plum:hover { background: var(--plum-dark); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  background: var(--cream-dark);
  border-color: var(--text-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); background: var(--cream-dark); }

.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: 8px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ========================================================================
   FORMS
   ======================================================================== */

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 14px;
  height: 42px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: all var(--transition);
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--plum);
  box-shadow: 0 0 0 3px var(--plum-light);
}
.field input::placeholder { color: var(--text-light); }
.field textarea { height: auto; min-height: 100px; resize: vertical; }

/* ========================================================================
   MESSAGES / TOASTS
   ======================================================================== */

.error {
  background: var(--red-bg);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
}
.success {
  background: var(--green-bg);
  color: var(--green);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
}
.loading {
  color: var(--text-muted);
  padding: 40px;
  text-align: center;
}
.empty {
  color: var(--text-muted);
  padding: 60px 20px;
  text-align: center;
  font-size: 15px;
}

/* ========================================================================
   AUTH PAGES
   ======================================================================== */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-card .logo {
  display: block;
  text-align: center;
  margin-bottom: 24px;
}
.auth-card h2 {
  font-family: var(--font);
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 24px;
  color: var(--text);
}
.auth-link {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 16px;
}
.auth-link a { color: var(--plum); font-weight: 500; }

/* ========================================================================
   APP LAYOUT — SIDEBAR + MAIN
   ======================================================================== */

.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
}
.sidebar-logo, .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo { font-size: 22px; }

.sidebar-nav {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all var(--transition);
}
.nav-item:hover {
  background: var(--cream);
  color: var(--text);
}
.nav-item.active {
  background: var(--plum-light);
  color: var(--plum);
}
.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.user-email-sidebar {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 32px 40px;
  max-width: calc(100% - 240px);
  background: var(--cream);
}

/* ========================================================================
   TABS
   ======================================================================== */

.tab { display: none; }
.tab.active { display: block; }

/* ========================================================================
   DASHBOARD HEADER / STAT CARDS
   ======================================================================== */

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.dash-header h1 {
  font-family: var(--font);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: all var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}
.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ========================================================================
   QUICK ACTIONS
   ======================================================================== */

.quick-actions h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}
.action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
}
.action-card:hover {
  border-color: var(--plum);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.action-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.action-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ========================================================================
   TABLES
   ======================================================================== */

.table {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--cream);
}
.table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(248, 244, 237, 0.5); }

/* Member row with avatar */
.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.member-name {
  font-weight: 600;
  color: var(--text);
  display: block;
}
.member-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ========================================================================
   BADGES
   ======================================================================== */

.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-full);
}
.badge-active   { background: var(--green-bg); color: var(--green); }
.badge-pending, .badge-onboarding { background: var(--amber-bg); color: var(--amber); }
.badge-inactive, .badge-suspended { background: var(--red-bg); color: var(--red); }
.badge-info     { background: var(--blue-bg); color: var(--blue); }

/* Tier badges */
.badge-starter    { background: var(--cream-dark); color: var(--text-muted); }
.badge-growth     { background: var(--green-bg); color: var(--green); }
.badge-pro        { background: var(--blue-bg); color: var(--blue); }
.badge-enterprise { background: var(--amber-bg); color: var(--amber); }

/* ========================================================================
   CARDS
   ======================================================================== */

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

/* ========================================================================
   HERO (Marketing)
   ======================================================================== */

.hero {
  padding: 60px 0 40px;
  text-align: center;
}
.hero-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 20px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}
.hero h1 em {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--plum);
}
.hero-sub {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.7;
}
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
}
.trust-bar {
  font-size: 13px;
  color: var(--text-light);
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 60px;
}
.trust-bar span::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-light);
  margin-right: 12px;
  vertical-align: middle;
}
.trust-bar span:first-child::before { display: none; }

/* ========================================================================
   FEATURES GRID
   ======================================================================== */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 80px;
}
.feature {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.feature:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--plum);
}
.feature h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.feature p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ========================================================================
   PRICING
   ======================================================================== */

.pricing {
  text-align: center;
  margin-bottom: 80px;
}
.pricing h2 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  margin-bottom: 40px;
  color: var(--text);
}
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.price-card {
  padding: 32px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.price-card:hover { box-shadow: var(--shadow-md); }
.price-card.featured {
  border-color: var(--plum);
  box-shadow: 0 0 0 1px var(--plum);
}
.price-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.price {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.price span {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-muted);
}
.price-card p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ========================================================================
   BILLING
   ======================================================================== */

.billing-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.billing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.billing-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}
.billing-plan {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.plan-name { font-size: 24px; font-weight: 700; color: var(--text); }
.plan-price { font-size: 16px; color: var(--text-muted); }
.billing-detail { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.usage-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 8px;
}
.usage-fill {
  height: 100%;
  background: var(--plum);
  border-radius: var(--radius-full);
  transition: width 0.3s;
}

/* ========================================================================
   WEBSITE BUILDER PLACEHOLDER
   ======================================================================== */

.builder-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0;
}
.builder-preview {
  width: 100%;
  max-width: 640px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 32px;
  background: var(--surface);
}
.browser-chrome {
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.browser-dots { display: flex; gap: 6px; }
.browser-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}
.browser-url {
  font-family: var(--font);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  flex: 1;
}
.browser-body {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}
.builder-actions { text-align: center; }
.builder-hint { font-size: 13px; color: var(--text-muted); margin-top: 12px; }

/* ========================================================================
   MODAL
   ======================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 42, 38, 0.4);
}
.modal-content {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.modal-content h2 {
  margin-bottom: 20px;
  font-weight: 600;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ========================================================================
   VERIFICATION / PROVISIONING
   ======================================================================== */

.verify-hint {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.5;
}
#verify-code {
  text-align: center;
  font-size: 24px;
  letter-spacing: 8px;
  font-weight: 600;
}

.provision-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.provision-card .logo { display: block; margin-bottom: 24px; }
.provision-card h2 { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.provision-hint { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; }

.progress-container { margin-bottom: 32px; }
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 24px;
}
.progress-fill {
  height: 100%;
  background: var(--plum);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.progress-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-muted);
}
.progress-step.active { color: var(--plum); font-weight: 500; }
.progress-step.done { color: var(--green); }
.progress-step.error { color: var(--red); }
.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: background 0.3s;
}
.progress-step.active .step-dot { background: var(--plum); box-shadow: 0 0 0 3px var(--plum-light); }
.progress-step.done .step-dot { background: var(--green); }
.progress-step.error .step-dot { background: var(--red); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.progress-step.active .step-label { animation: pulse 1.5s ease-in-out infinite; }

/* ========================================================================
   FOOTER
   ======================================================================== */

.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-light);
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */

@media (max-width: 768px) {
  .sidebar { width: 64px; }
  .sidebar-logo, .sidebar-brand { padding: 16px; justify-content: center; }
  .sidebar-brand .logo { font-size: 18px; }
  .sidebar-brand .logo-badge { display: none; }
  .nav-item span:not(.step-dot):not(.step-label) { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .sidebar-footer { padding: 8px; }
  .user-email-sidebar { display: none; }
  .main-content { margin-left: 64px; padding: 24px 20px; max-width: calc(100% - 64px); }

  .hero h1 { font-size: 36px; }
  .hero-actions { flex-direction: column; align-items: center; }
  .trust-bar { flex-direction: column; align-items: center; gap: 8px; }
  .trust-bar span::before { display: none; }
}

@media (max-width: 640px) {
  .features { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .action-cards { grid-template-columns: 1fr; }
  .billing-info { grid-template-columns: 1fr; }
}
