/* ============================================================
   Spressify Web Design System — app.css
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Brand */
  --pink: #E94B8B;
  --pink-glow: rgba(233, 75, 139, 0.15);
  --pink-light: #FFF5F8;
  --pink-hover: #d63d7a;

  /* Backgrounds */
  --bg: #F5F5F5;
  --bg-white: #FFFFFF;
  --bg-input: #F9F9F9;

  /* Text */
  --text-primary: #1A1A1A;
  --text-secondary: #555555;
  --text-muted: #888888;
  --text-hint: #BBBBBB;

  /* Borders */
  --border: #E0E0E0;
  --border-light: #F0F0F0;

  /* Status */
  --success: #4CAF50;
  --error: #F44336;
  --warning: #FF9800;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Dark Theme (auth + AI surfaces) */
  --dark-bg: #0A0A0F;
  --dark-surface: #12121A;
  --dark-elevated: #1A1A2E;
  --dark-text: #FFFFFF;
  --dark-text-secondary: rgba(255,255,255,0.7);
  --dark-text-muted: rgba(255,255,255,0.4);
  --dark-glass: rgba(255,255,255,0.05);
  --dark-glass-border: rgba(255,255,255,0.1);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  background: var(--bg-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font: inherit; }

/* --- Typography --- */
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: 'Syne', sans-serif;
  line-height: 1.2;
  color: var(--text-primary);
}
.h1 { font-size: 36px; font-weight: 800; }
.h2 { font-size: 28px; font-weight: 700; }
.h3 { font-size: 22px; font-weight: 700; }
.h4 { font-size: 18px; font-weight: 700; }
.h5 { font-size: 16px; font-weight: 700; }
.h6 { font-size: 14px; font-weight: 700; }

.body     { font-size: 15px; line-height: 1.6; color: var(--text-primary); }
.body-sm  { font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.caption  { font-size: 12px; line-height: 1.4; color: var(--text-muted); }
.label    { font-size: 12px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); }

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

.page {
  min-height: 100vh;
  background: var(--bg);
}

/* --- Dark Page (auth screens + AI surfaces) --- */
.page-dark {
  min-height: 100vh;
  background: var(--dark-bg);
  color: var(--dark-text);
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Animated mesh gradient background */
.page-dark::before {
  content: '';
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(233,75,139,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(124,58,237,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(30,58,95,0.18) 0%, transparent 50%);
  animation: meshGradient 10s ease-in-out infinite alternate;
  z-index: 0;
  pointer-events: none;
}

@keyframes meshGradient {
  0%   { transform: translate(0, 0) rotate(0deg); }
  50%  { transform: translate(-2%, 1%) rotate(1deg); }
  100% { transform: translate(1%, -1%) rotate(-1deg); }
}

.page-dark > * { position: relative; z-index: 1; }

/* Glassmorphism card */
.glass-card {
  background: var(--dark-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--dark-glass-border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

/* --- Buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 56px;
  padding: 0 24px;
  background: var(--pink);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(233,75,139,0.3);
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--pink-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-primary.full-width { width: 100%; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 56px;
  padding: 0 24px;
  background: var(--bg-white);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--bg); border-color: var(--text-muted); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary.full-width { width: 100%; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 16px;
  background: transparent;
  color: var(--pink);
  border: 1px solid var(--pink);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}
.btn-ghost:hover { background: var(--pink-glow); }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 56px;
  padding: 0 24px;
  background: var(--error);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
}
.btn-danger:hover { background: #d32f2f; }
.btn-danger:active { transform: scale(0.98); }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Forms --- */
.form-group {
  margin-bottom: 20px;
}

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

.form-input {
  width: 100%;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input::placeholder { color: var(--text-hint); }
.form-input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(233,75,139,0.1);
}
.form-input.is-valid {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(76,175,80,0.1);
}
.form-input.is-invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(244,67,54,0.1);
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

.form-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 4px;
  display: none;
}
.form-error.visible { display: block; }

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

/* Dark form inputs */
.page-dark .form-input {
  background: var(--dark-elevated);
  border-color: var(--dark-glass-border);
  color: var(--dark-text);
}
.page-dark .form-input::placeholder { color: var(--dark-text-muted); }
.page-dark .form-label { color: var(--dark-text-secondary); }

/* Password toggle */
.input-password-wrap {
  position: relative;
}
.input-password-wrap .form-input { padding-right: 44px; }
.input-password-wrap .toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
}

/* --- Card --- */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 24px;
}

/* --- Skeleton Shimmer --- */
.skeleton {
  background: linear-gradient(90deg, #E0E0E0 25%, #F0F0F0 50%, #E0E0E0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  height: 20px;
  margin-bottom: 12px;
}
.skeleton:last-child { width: 60%; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Step Indicator --- */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}
.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, transform 0.2s;
}
.step-dot.active {
  background: var(--pink);
  transform: scale(1.2);
}
.step-dot.completed { background: var(--success); }
.step-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 8px;
}

/* --- Toast / Snackbar --- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: #FFFFFF;
  z-index: 9999;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.toast-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--error); }
.toast-info    { background: #333333; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.modal-overlay.modal-visible { opacity: 1; }

.modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 12px;
}
.modal-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.modal-actions button, .modal-actions a {
  min-width: 100px;
  height: 44px;
  font-size: 14px;
  border-radius: var(--radius-sm);
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-success {
  background: rgba(76,175,80,0.12);
  color: var(--success);
}
.badge-coming-soon {
  background: rgba(255,152,0,0.12);
  color: var(--warning);
}
.badge-pink {
  background: var(--pink-glow);
  color: var(--pink);
}
.badge-tier {
  background: var(--pink-light);
  color: var(--pink);
  font-weight: 600;
}

/* --- Spinner --- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* --- Divider --- */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 13px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.page-dark .divider::before,
.page-dark .divider::after { background: var(--dark-glass-border); }

/* --- AI Badge --- */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--pink);
}
.ai-badge::before { content: '✦'; }

.ai-badge-green {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
}
.ai-badge-green::before { content: '✦'; }

/* --- Google Sign-In Button --- */
.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 56px;
  background: var(--bg-white);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.btn-google:hover {
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}
.btn-google svg { width: 20px; height: 20px; flex-shrink: 0; }
.page-dark .btn-google {
  background: var(--dark-elevated);
  color: var(--dark-text);
  border-color: var(--dark-glass-border);
}
.page-dark .btn-google:hover { background: var(--dark-surface); }

/* --- Dashboard Sidebar --- */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--bg-white);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  padding: 24px 16px;
}
.sidebar-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 22px;
  color: var(--pink);
  padding: 0 8px;
  margin-bottom: 32px;
  text-decoration: none;
  display: block;
}
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.sidebar-link:hover { background: var(--bg); color: var(--text-primary); }
.sidebar-link.active { background: var(--pink); color: #FFFFFF; }
.sidebar-link .icon { font-size: 18px; width: 24px; text-align: center; }

.sidebar-footer {
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
  margin-top: auto;
}
.sidebar-business-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  padding: 0 12px;
}
.sidebar-signout {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  transition: color 0.15s;
}
.sidebar-signout:hover { color: var(--error); }

.dashboard-main {
  flex: 1;
  margin-left: 240px;
  padding: 32px;
  min-height: 100vh;
  background: var(--bg);
}

/* Mobile hamburger overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.hamburger-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 101;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

/* --- Offline Banner --- */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--warning);
  color: #FFFFFF;
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  z-index: 10000;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}
.offline-banner.visible { transform: translateY(0); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .h1 { font-size: 28px; }
  .h2 { font-size: 22px; }
  .h3 { font-size: 18px; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.open { display: block; }
  .hamburger-btn { display: flex; }
  .dashboard-main {
    margin-left: 0;
    padding: 24px 16px;
    padding-top: 64px;
  }

  .modal { padding: 20px; }
  .modal-actions { flex-direction: column; }
  .modal-actions button, .modal-actions a { width: 100%; }
}

@media (max-width: 480px) {
  .h1 { font-size: 24px; }
  .btn-primary, .btn-secondary, .btn-danger { height: 48px; font-size: 13px; }
}
