/* ============================================================
   mycarrd — Shared Stylesheet
   ============================================================ */

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

/* ============================================================
   1. CSS Custom Properties
   ============================================================ */
:root {
  /* Marketing palette */
  --primary:       #0EA5E9;
  --primary-dark:  #0284C7;
  --primary-light: #E0F2FE;
  --accent:        #14B8A6;
  --accent-dark:   #0F766E;
  --accent-light:  #CCFBF1;

  /* Neutrals */
  --neutral-900: #0F172A;
  --neutral-800: #1E293B;
  --neutral-700: #334155;
  --neutral-600: #475569;
  --neutral-500: #64748B;
  --neutral-400: #94A3B8;
  --neutral-300: #CBD5E1;
  --neutral-200: #E2E8F0;
  --neutral-100: #F1F5F9;
  --neutral-50:  #F8FAFC;
  --white:       #FFFFFF;

  /* Semantic */
  --success:  #22C55E;
  --error:    #EF4444;
  --warning:  #F59E0B;
  --gold:     #F59E0B;

  /* Template brand (overridden dynamically) */
  --brand:       #0EA5E9;
  --brand-dark:  #0284C7;
  --brand-light: #E0F2FE;

  /* Spacing */
  --container-max: 1200px;
  --container-pad: 24px;

  /* Border radius */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 20px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 8px 40px rgba(15, 23, 42, 0.14);
  --shadow-xl: 0 20px 60px rgba(15, 23, 42, 0.18);
  --shadow-blue: 0 4px 20px rgba(14, 165, 233, 0.25);
  --shadow-teal: 0 4px 20px rgba(20, 184, 166, 0.25);

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index */
  --z-nav:    100;
  --z-modal:  200;
  --z-toast:  300;
}

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

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--neutral-800);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 700;
}

/* ============================================================
   3. Layout Utilities
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.section {
  padding: 80px 0;
}

.section-sm {
  padding: 48px 0;
}

.section-lg {
  padding: 120px 0;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }
.gap-48 { gap: 48px; }

.text-center { text-align: center; }
.text-left   { text-align: left; }

/* ============================================================
   4. Typography Utilities
   ============================================================ */
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 16px;
}

.section-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  color: var(--neutral-900);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.section-subtitle {
  font-size: 18px;
  color: var(--neutral-500);
  max-width: 600px;
  line-height: 1.7;
}

.section-header {
  margin-bottom: 56px;
}

/* ============================================================
   5. Button Components
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
  border: 2px solid transparent;
  letter-spacing: -0.01em;
}

.btn-sm {
  padding: 8px 18px;
  font-size: 13px;
}

.btn-lg {
  padding: 16px 36px;
  font-size: 17px;
}

.btn-xl {
  padding: 20px 48px;
  font-size: 18px;
  border-radius: var(--radius-xl);
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow-blue);
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(14, 165, 233, 0.35);
}

.btn-accent {
  background: var(--accent);
  color: var(--white);
  box-shadow: var(--shadow-teal);
}
.btn-accent:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--white);
  color: var(--primary);
  border-color: var(--primary);
}
.btn-secondary:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--neutral-700);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--neutral-100);
  color: var(--neutral-900);
}

.btn-white {
  background: var(--white);
  color: var(--neutral-900);
  box-shadow: var(--shadow-md);
}
.btn-white:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-dark {
  background: var(--neutral-900);
  color: var(--white);
}
.btn-dark:hover {
  background: var(--neutral-800);
  transform: translateY(-1px);
}

.btn-brand {
  background: var(--brand);
  color: var(--white);
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.3);
}
.btn-brand:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.btn-full { width: 100%; }

/* ============================================================
   6. Card Components
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--neutral-200);
  transition: all var(--transition);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.card-sm {
  padding: 20px;
  border-radius: var(--radius-md);
}

.card-bordered {
  border: 2px solid var(--neutral-200);
  box-shadow: none;
}

.card-accent-top {
  border-top: 3px solid var(--primary);
}

/* ============================================================
   7. Form Components
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.form-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--neutral-700);
  letter-spacing: -0.01em;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--neutral-900);
  background: var(--white);
  border: 2px solid var(--neutral-200);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  outline: none;
  line-height: 1.5;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--neutral-400);
}

.form-input.error,
.form-textarea.error {
  border-color: var(--error);
}

.form-input.success {
  border-color: var(--success);
}

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

.form-error {
  font-size: 13px;
  color: var(--error);
  font-weight: 500;
}

.form-hint {
  font-size: 13px;
  color: var(--neutral-500);
}

.form-row {
  display: grid;
  gap: 16px;
}

.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 4px;
  accent-color: var(--primary);
  cursor: pointer;
  margin-top: 2px;
}

.checkbox-label {
  font-size: 14px;
  color: var(--neutral-600);
  line-height: 1.5;
}

/* ============================================================
   8. Badge / Pill
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.badge-accent {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.badge-success {
  background: #DCFCE7;
  color: #15803D;
}

.badge-gold {
  background: #FEF3C7;
  color: #92400E;
}

.badge-dark {
  background: var(--neutral-900);
  color: var(--white);
}

/* ============================================================
   9. Navigation (Shared Base)
   ============================================================ */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--container-pad);
  height: 68px;
  max-width: var(--container-max);
  margin: 0 auto;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--neutral-900);
  letter-spacing: -0.03em;
}

.nav-logo svg {
  color: var(--primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--neutral-600);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.nav-link:hover {
  color: var(--neutral-900);
  background: var(--neutral-100);
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Sticky nav */
.nav-wrapper {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: all var(--transition);
}

.nav-wrapper.scrolled {
  border-bottom-color: var(--neutral-200);
  box-shadow: var(--shadow-sm);
}

/* Mobile hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--neutral-700);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ============================================================
   10. Toast Notification
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--neutral-900);
  color: var(--white);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: all;
  min-width: 220px;
  max-width: 380px;
}

.toast.toast-success { background: #064E3B; border-left: 3px solid var(--success); }
.toast.toast-error   { background: #7F1D1D; border-left: 3px solid var(--error); }
.toast.toast-info    { background: var(--primary-dark); border-left: 3px solid var(--primary); }
.toast.toast-out     { animation: toastOut 0.25s ease forwards; }

/* ============================================================
   11. Modal
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  backdrop-filter: blur(4px);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-backdrop.active .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--neutral-100);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--neutral-200);
}

/* ============================================================
   12. Loading States
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--neutral-200) 25%, var(--neutral-100) 50%, var(--neutral-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-primary {
  border-color: var(--primary-light);
  border-top-color: var(--primary);
}

/* ============================================================
   13. Star Rating
   ============================================================ */
.stars {
  display: flex;
  gap: 2px;
}

.stars svg {
  width: 16px;
  height: 16px;
  color: var(--gold);
  fill: currentColor;
}

.stars-lg svg {
  width: 20px;
  height: 20px;
}

/* ============================================================
   14. Avatar
   ============================================================ */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--primary-light);
  color: var(--primary-dark);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-xl { width: 80px; height: 80px; font-size: 24px; }

/* ============================================================
   15. Scroll Animation (Shared IntersectionObserver target)
   ============================================================ */
.anim {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.anim.visible {
  opacity: 1;
  transform: translateY(0);
}

.anim-delay-1 { transition-delay: 0.1s; }
.anim-delay-2 { transition-delay: 0.2s; }
.anim-delay-3 { transition-delay: 0.3s; }
.anim-delay-4 { transition-delay: 0.4s; }
.anim-delay-5 { transition-delay: 0.5s; }

/* ============================================================
   16. Keyframe Animations
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.05); opacity: 0.8; }
}

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

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

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(12px) scale(0.95); }
}

@keyframes marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-10px); }
}

@keyframes blobPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  33%       { transform: scale(1.05) rotate(2deg); }
  66%       { transform: scale(0.97) rotate(-1deg); }
}

/* ============================================================
   17. Divider
   ============================================================ */
.divider {
  height: 1px;
  background: var(--neutral-200);
  margin: 32px 0;
}

/* ============================================================
   18. Responsive Breakpoints
   ============================================================ */
@media (max-width: 1024px) {
  .section { padding: 60px 0; }
  .section-lg { padding: 80px 0; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --container-pad: 16px; }

  .section { padding: 48px 0; }
  .section-lg { padding: 64px 0; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }

  .form-row-2,
  .form-row-3 { grid-template-columns: 1fr; }

  .nav-links { display: none; }
  .hamburger { display: flex; }

  .section-title { font-size: 28px; }
  .section-subtitle { font-size: 16px; }

  .btn-xl { padding: 16px 32px; font-size: 16px; }
}

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

/* ============================================================
   Dashboard Mobile Bottom Nav
   ============================================================ */
.dash-mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #0B1628;
  border-top: 1px solid rgba(255,255,255,.1);
  z-index: 100;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.dash-mob-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 8px 4px 10px; font-size: 10px; font-weight: 600; letter-spacing: .01em;
  color: rgba(255,255,255,.45); cursor: pointer; border: none; background: none;
  transition: color .2s; line-height: 1; font-family: 'Inter', sans-serif;
}
.dash-mob-tab svg { width: 20px; height: 20px; flex-shrink: 0; }
.dash-mob-tab.active { color: var(--primary); }
.dash-mob-tab:hover { color: rgba(255,255,255,.8); }

@media (max-width: 768px) {
  .dash-mobile-nav { display: flex; }
  /* Push dashboard content above the bottom nav */
  .dash-content { padding-bottom: 84px !important; }
}
