/* ================================================================
   CMzon Design System v1.0
   ================================================================
   Comprehensive design tokens, utility classes, animations,
   and dark mode support for the CMzon platform.
   ================================================================ */

/* ================================================================
   1. DESIGN TOKENS (CSS Custom Properties)
   ================================================================ */
:root {
  /* ---- Primary Color Scale ---- */
  --primary: #10b981;
  --primary-foreground: #ffffff;
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --primary-200: #a7f3d0;
  --primary-300: #6ee7b7;
  --primary-400: #34d399;
  --primary-500: #10b981;
  --primary-600: #059669;
  --primary-700: #047857;
  --primary-800: #065f46;
  --primary-900: #064e3b;

  /* ---- Secondary (Gray) System ---- */
  --secondary: #f1f5f9;
  --secondary-foreground: #0f172a;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --gray-950: #020617;

  /* ---- Semantic Tokens ---- */
  --background: #ffffff;
  --foreground: #0f172a;

  --card: #ffffff;
  --card-foreground: #0f172a;

  --popover: #ffffff;
  --popover-foreground: #0f172a;

  --muted: #f1f5f9;
  --muted-foreground: #64748b;

  --accent: #f1f5f9;
  --accent-foreground: #0f172a;

  --destructive: #ef4444;
  --destructive-foreground: #ffffff;

  --border: #e2e8f0;
  --input: #e2e8f0;
  --ring: #10b981;

  /* ---- Status Colors ---- */
  --success: #10b981;
  --success-foreground: #ffffff;
  --warning: #f59e0b;
  --warning-foreground: #ffffff;
  --info: #3b82f6;
  --info-foreground: #ffffff;
  --danger: #ef4444;
  --danger-foreground: #ffffff;

  /* ---- Border Radius ---- */
  --radius-sm: 0.375rem;    /* 6px */
  --radius-md: 0.5rem;      /* 8px */
  --radius-lg: 0.75rem;     /* 12px */
  --radius-xl: 1rem;        /* 16px */
  --radius-2xl: 1.25rem;    /* 20px */
  --radius-3xl: 1.5rem;     /* 24px */
  --radius-full: 9999px;

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  /* ---- Typography ---- */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', Consolas, Monaco, 'Courier New', monospace;

  /* ---- Spacing ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* ---- Container ---- */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1400px;

  /* ---- Transitions ---- */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ---- Solid Color Tokens (gradients removed) ---- */
  --whatsapp-bg: #10b981;
  --page-bg: #f8fafc;
  --cta-bg: var(--primary);
  --timeline-bg: var(--primary-500);
}

/* ================================================================
   2. DARK MODE
   ================================================================ */
[data-theme="dark"],
.dark {
  --primary: #10b981;
  --primary-foreground: #ffffff;

  --background: #0f172a;
  --foreground: #f8fafc;

  --card: #1e293b;
  --card-foreground: #f8fafc;

  --popover: #1e293b;
  --popover-foreground: #f8fafc;

  --muted: #1e293b;
  --muted-foreground: #94a3b8;

  --accent: #1e293b;
  --accent-foreground: #f8fafc;

  --secondary: #1e293b;
  --secondary-foreground: #f8fafc;

  --destructive: #dc2626;
  --destructive-foreground: #ffffff;

  --border: #334155;
  --input: #334155;
  --ring: #10b981;

  --success: #10b981;
  --warning: #f59e0b;
  --info: #3b82f6;
  --danger: #ef4444;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);

  --page-bg: #1e293b;
  --cta-bg: var(--primary-700);
}

/* ================================================================
   3. BASE STYLES & TYPOGRAPHY
   ================================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

/* ================================================================
   4. UTILITY CLASSES — Backgrounds
   ================================================================ */
.bg-background { background-color: var(--background) !important; }
.bg-foreground { background-color: var(--foreground) !important; }
.bg-card { background-color: var(--card) !important; }
.bg-popover { background-color: var(--popover) !important; }
.bg-muted { background-color: var(--muted) !important; }
.bg-accent { background-color: var(--accent) !important; }
.bg-primary { background-color: var(--primary) !important; }
.bg-secondary { background-color: var(--secondary) !important; }
.bg-destructive { background-color: var(--destructive) !important; }
.bg-success { background-color: var(--success) !important; }
.bg-warning { background-color: var(--warning) !important; }
.bg-info { background-color: var(--info) !important; }
.bg-danger { background-color: var(--danger) !important; }

/* ================================================================
   5. UTILITY CLASSES — Text Colors
   ================================================================ */
.text-foreground { color: var(--foreground) !important; }
.text-muted-foreground { color: var(--muted-foreground) !important; }
.text-card-foreground { color: var(--card-foreground) !important; }
.text-primary { color: var(--primary) !important; }
.text-primary-foreground { color: var(--primary-foreground) !important; }
.text-secondary-foreground { color: var(--secondary-foreground) !important; }
.text-destructive { color: var(--destructive) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-danger { color: var(--danger) !important; }

/* ================================================================
   6. UTILITY CLASSES — Borders & Ring
   ================================================================ */
.border-border { border-color: var(--border) !important; }
.border-input { border-color: var(--input) !important; }
.ring-ring { outline-color: var(--ring) !important; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important; }

/* ================================================================
   7. UTILITY CLASSES — Border Radius
   ================================================================ */
.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }
.rounded-2xl { border-radius: var(--radius-2xl) !important; }
.rounded-3xl { border-radius: var(--radius-3xl) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

/* ================================================================
   8. UTILITY CLASSES — Shadows
   ================================================================ */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-xl { box-shadow: var(--shadow-xl) !important; }
.shadow-2xl { box-shadow: var(--shadow-2xl) !important; }

/* ================================================================
   9. SOLID COLOR & EFFECT CLASSES
   ================================================================ */

/* WhatsApp Background */
.whatsapp-gradient {
  background: var(--whatsapp-bg);
}

/* WhatsApp Shadow */
.whatsapp-shadow {
  box-shadow: 0 10px 40px -10px rgba(16, 185, 129, 0.4);
}

/* Glass Effect - Light Mode */
.glass-effect {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Glass Effect - Dark Mode */
[data-theme="dark"] .glass-effect,
.dark .glass-effect {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(51, 65, 85, 0.5);
}

/* Hover Lift */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* Primary Text */
.gradient-text {
  color: var(--primary);
}

/* Scale on Hover */
.scale-on-hover {
  transition: transform var(--transition-base);
}
.scale-on-hover:hover {
  transform: scale(1.05);
}

/* Page Background */
.page-gradient {
  background: var(--page-bg);
}

/* CTA Background */
.cta-gradient {
  background: var(--cta-bg);
}

/* Timeline Background */
.timeline-gradient {
  background: var(--timeline-bg);
}

/* ================================================================
   10. ANIMATIONS
   ================================================================ */

/* Floating animation */
@keyframes floating {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.floating {
  animation: floating 3s ease-in-out infinite;
}

/* Bounce In */
@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}
.bounce-in {
  animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Fade In Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.fade-in-up {
  animation: fadeInUp 0.5s ease-out forwards;
}

/* Slide In Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.slide-in-right {
  animation: slideInRight 0.4s ease-out forwards;
}

/* Pulse */
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.pulse-ring {
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Spin */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.animate-spin {
  animation: spin 1s linear infinite;
}

/* ================================================================
   11. BUTTON SYSTEM
   ================================================================ */

/* Base Button */
.btn-ds {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1;
}

/* Button Sizes */
.btn-ds { /* default */
  height: 2.5rem;
  padding: 0 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}
.btn-ds.btn-sm {
  height: 2.25rem;
  padding: 0 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
}
.btn-ds.btn-lg {
  height: 2.75rem;
  padding: 0 2rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
}
.btn-ds.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: var(--radius-md);
}

/* Button Variants */
.btn-ds.btn-default,
.btn-ds.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.btn-ds.btn-default:hover,
.btn-ds.btn-primary:hover {
  background-color: var(--primary-600);
  border-color: var(--primary-600);
}

.btn-ds.btn-destructive {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
  border-color: var(--destructive);
}
.btn-ds.btn-destructive:hover {
  background-color: #dc2626;
  border-color: #dc2626;
}

.btn-ds.btn-outline {
  background-color: transparent;
  color: var(--foreground);
  border-color: var(--input);
}
.btn-ds.btn-outline:hover {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

.btn-ds.btn-outline-green {
  background-color: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-ds.btn-outline-green:hover {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.btn-ds.btn-outline-white {
  background-color: transparent;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.5);
}
.btn-ds.btn-outline-white:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
}

.btn-ds.btn-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--secondary);
}
.btn-ds.btn-secondary:hover {
  background-color: var(--gray-200);
  border-color: var(--gray-200);
}

.btn-ds.btn-ghost {
  background-color: transparent;
  color: var(--foreground);
  border-color: transparent;
}
.btn-ds.btn-ghost:hover {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

.btn-ds.btn-link {
  background-color: transparent;
  color: var(--primary);
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.btn-ds.btn-link:hover {
  color: var(--primary-600);
}

/* Button disabled state */
.btn-ds:disabled,
.btn-ds[disabled] {
  pointer-events: none;
  opacity: 0.5;
}

/* ================================================================
   12. CARD COMPONENT
   ================================================================ */
.card-ds {
  background-color: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.card-ds:hover {
  box-shadow: var(--shadow-md);
}
.card-ds.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ================================================================
   13. INPUT COMPONENT
   ================================================================ */
.input-ds {
  width: 100%;
  padding: 0.625rem 0.75rem;
  background-color: var(--background);
  color: var(--foreground);
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input-ds:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.input-ds::placeholder {
  color: var(--muted-foreground);
}

/* ================================================================
   14. BADGE COMPONENT
   ================================================================ */
.badge-ds {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
}
.badge-ds.badge-primary {
  background-color: var(--primary-100);
  color: var(--primary-700);
}
.badge-ds.badge-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}
.badge-ds.badge-destructive {
  background-color: #fef2f2;
  color: var(--destructive);
}
.badge-ds.badge-success {
  background-color: var(--primary-100);
  color: var(--primary-700);
}
.badge-ds.badge-warning {
  background-color: #fffbeb;
  color: #b45309;
}
.badge-ds.badge-info {
  background-color: #eff6ff;
  color: #1d4ed8;
}

/* ================================================================
   15. STAT ICON COMPONENT (replaces emoji stat icons)
   ================================================================ */
.stat-icon-ds {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: 1.25rem;
}
.stat-icon-ds.stat-messages {
  background-color: var(--primary-100);
  color: var(--primary-600);
}
.stat-icon-ds.stat-waiting {
  background-color: #fffbeb;
  color: #d97706;
}
.stat-icon-ds.stat-active {
  background-color: var(--primary-100);
  color: var(--primary);
}
.stat-icon-ds.stat-pending {
  background-color: #eff6ff;
  color: var(--info);
}
.stat-icon-ds.stat-accepted {
  background-color: var(--primary-100);
  color: var(--primary);
}
.stat-icon-ds.stat-paid {
  background-color: #ecfdf5;
  color: var(--primary-600);
}

/* ================================================================
   16. ACCESSIBILITY
   ================================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus ring for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* ================================================================
   17. SCROLLBAR STYLING
   ================================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb,
.dark ::-webkit-scrollbar-thumb {
  background: var(--gray-600);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover,
.dark ::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}

/* ================================================================
   18. NOTIFICATION ICON CLASSES (replacing emojis in WooCommerce)
   ================================================================ */
.icon-section-header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  margin-right: 8px;
  font-size: 0.875rem;
}
.icon-section-header.icon-order {
  background: var(--primary-100);
  color: var(--primary-600);
}
.icon-section-header.icon-user {
  background: #eff6ff;
  color: var(--info);
}
.icon-section-header.icon-lock {
  background: #fef3c7;
  color: #d97706;
}
.icon-section-header.icon-comment {
  background: #f3e8ff;
  color: #7c3aed;
}
.icon-section-header.icon-bell {
  background: #fef2f2;
  color: var(--destructive);
}
.icon-section-header.icon-mobile {
  background: #eff6ff;
  color: var(--info);
}
.icon-section-header.icon-sync {
  background: var(--primary-100);
  color: var(--primary-600);
}
.icon-section-header.icon-copy {
  background: var(--gray-100);
  color: var(--gray-600);
}
.icon-section-header.icon-key {
  background: #fef3c7;
  color: #d97706;
}
