/* ============================================
   WhatsApp Automation V2 - Premium Design System
   Glassmorphism + Dark Theme + Modern Aesthetics
   ============================================ */

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

/* Smooth theme transition – animate CSS variables (no overlay, no full-screen cover) */
@property --bg-primary { syntax: '<color>'; initial-value: #0a0a0f; inherits: true; }
@property --bg-secondary { syntax: '<color>'; initial-value: #0f0f16; inherits: true; }
@property --bg-surface { syntax: '<color>'; initial-value: #16161f; inherits: true; }
@property --text-primary { syntax: '<color>'; initial-value: #f8fafc; inherits: true; }
@property --text-secondary { syntax: '<color>'; initial-value: #94a3b8; inherits: true; }
@property --border-subtle { syntax: '<color>'; initial-value: rgba(255,255,255,0.06); inherits: true; }

:root {
    transition: --bg-primary 0.32s ease, --bg-secondary 0.32s ease, --bg-surface 0.32s ease, --text-primary 0.32s ease, --text-secondary 0.32s ease, --border-subtle 0.32s ease;

    /* ========================================
       Premium Dark Color Palette
       ======================================== */

    /* Backgrounds - Rich dark tones */
    --bg-void: #050508;
    --bg-primary: #0a0a0f;
    --bg-secondary: #0f0f16;
    --bg-tertiary: #16161f;
    --bg-elevated: #1a1a25;
    --bg-card: rgba(22, 22, 31, 0.8);
    --bg-card-solid: #16161f;
    --bg-hover: rgba(255, 255, 255, 0.03);
    --bg-active: rgba(255, 255, 255, 0.06);
    --bg-surface: #16161f;

    /* Glassmorphism */
    --glass-bg: rgba(22, 22, 31, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(20px);

    /* Primary Accent - Electric Indigo */
    --accent-primary: #6366f1;
    --accent-primary-light: #818cf8;
    --accent-primary-dark: #4f46e5;
    --accent-primary-glow: rgba(99, 102, 241, 0.4);
    --accent-primary-subtle: rgba(99, 102, 241, 0.15);
    --accent-soft: rgba(99, 102, 241, 0.15);
    --accent-border: #818cf8;

    /* WhatsApp Green - Brand Color */
    --whatsapp-green: #25d366;
    --whatsapp-dark: #128c7e;
    --whatsapp-light: #4ee089;
    --whatsapp-glow: rgba(37, 211, 102, 0.3);

    /* Status Colors */
    --success: #10b981;
    --success-light: #34d399;
    --success-subtle: rgba(16, 185, 129, 0.15);
    --success-glow: rgba(16, 185, 129, 0.3);

    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --warning-subtle: rgba(245, 158, 11, 0.15);

    --danger: #ef4444;
    --danger-light: #f87171;
    --danger-subtle: rgba(239, 68, 68, 0.15);
    --danger-glow: rgba(239, 68, 68, 0.3);

    --info: #22d3ee;
    --info-light: #67e8f9;
    --info-subtle: rgba(34, 211, 238, 0.15);

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #e2e8f0;
    --text-tertiary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-disabled: #334155;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.15);
    --border-focus: var(--accent-primary);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);
    --shadow-glow-primary: 0 0 30px var(--accent-primary-glow);
    --shadow-glow-success: 0 0 30px var(--success-glow);
    --shadow-glow-whatsapp: 0 0 30px var(--whatsapp-glow);

    /* ========================================
       Spacing System (4px base)
       ======================================== */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;

    /* ========================================
       Typography
       ======================================== */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;

    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 14px;
    --text-md: 15px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-2xl: 20px;
    --text-3xl: 24px;
    --text-4xl: 30px;
    --text-5xl: 36px;

    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.75;

    --tracking-tight: -0.02em;
    --tracking-normal: 0;
    --tracking-wide: 0.05em;

    /* ========================================
       Layout Dimensions
       ======================================== */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --content-max-width: 1600px;

    /* ========================================
       Border Radius
       ======================================== */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* ========================================
       Transitions & Animations
       ======================================== */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    --duration-fast: 150ms;
    --duration-base: 200ms;
    --duration-slow: 300ms;
    --duration-slower: 500ms;

    --transition-fast: var(--duration-fast) var(--ease-out);
    --transition-base: var(--duration-base) var(--ease-out);
    --transition-slow: var(--duration-slow) var(--ease-out);

    /* ========================================
       Z-Index Scale
       ======================================== */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
}

/* ============================================
   Light Theme Color Palette
   ============================================ */

[data-theme="light"] {
    /* ========================================
       Base Surfaces (3-layer system)
       ======================================== */
    --bg-canvas: #F6F7FB;   /* app background */
    --bg-surface: #FFFFFF;  /* cards, panels */
    --bg-muted: #F1F3F7;    /* inputs, rows, pills */
    
    /* Legacy mappings for backward compatibility */
    --bg-void: var(--bg-canvas);
    --bg-primary: var(--bg-canvas);
    --bg-secondary: var(--bg-surface);
    --bg-tertiary: var(--bg-muted);
    --bg-elevated: var(--bg-surface);
    --bg-card: var(--bg-surface);
    --bg-card-solid: var(--bg-surface);
    --bg-hover: rgba(0, 0, 0, 0.02);
    --bg-active: rgba(0, 0, 0, 0.04);

    /* Glassmorphism - Removed, use solid surfaces */
    --glass-bg: var(--bg-surface);
    --glass-border: #E5E7EB;
    --glass-blur: none;

    /* ========================================
       Text Colors
       ======================================== */
    --text-primary: #111827;
    --text-secondary: #1F2937;
    --text-tertiary: #374151;
    --text-muted: #4B5563;
    --text-disabled: #D1D5DB;

    /* ========================================
       Icon Colors (Neutral by default)
       ======================================== */
    --icon-primary: #374151;
    --icon-secondary: #6B7280;
    --icon-muted: #9CA3AF;
    
    /* Semantic icon colors (only when needed) */
    --icon-success: #10B981;
    --icon-warning: #F59E0B;
    --icon-error: #EF4444;
    --icon-whatsapp: #25D366;
    --icon-cta: #FFFFFF;

    /* ========================================
       Accent Color Discipline
       ======================================== */
    --accent-primary: #4F46E5;   /* buttons, CTAs, active nav */
    --accent-primary-light: #6366F1;  /* hover states */
    --accent-primary-dark: #4338CA;   /* pressed states */
    --accent-soft: #EEF2FF;     /* selection, hover, active rows */
    --accent-border: #C7D2FE;   /* focus rings */
    --accent-primary-glow: rgba(79, 70, 229, 0.2);  /* reduced glow */
    --accent-primary-subtle: var(--accent-soft);

    /* ========================================
       Status Colors (Desaturated)
       ======================================== */
    --success: #10B981;
    --success-light: #34D399;
    --success-subtle: rgba(16, 185, 129, 0.10);  /* reduced from 0.15 */
    --success-glow: rgba(16, 185, 129, 0.15);    /* reduced from 0.3 */
    --success-text: #047857;  /* darker green for text */

    --warning: #F59E0B;
    --warning-light: #FBBF24;
    --warning-subtle: rgba(245, 158, 11, 0.10);

    --danger: #EF4444;
    --danger-light: #F87171;
    --danger-subtle: rgba(239, 68, 68, 0.10);
    --danger-glow: rgba(239, 68, 68, 0.15);

    --info: #22D3EE;
    --info-light: #67E8F9;
    --info-subtle: rgba(34, 211, 238, 0.10);

    /* ========================================
       WhatsApp Brand Colors
       ======================================== */
    --whatsapp-green: #25D366;
    --whatsapp-dark: #128C7E;
    --whatsapp-light: #4EE089;
    --whatsapp-glow: rgba(37, 211, 102, 0.15);  /* reduced */

    /* ========================================
       Borders
       ======================================== */
    --border-subtle: #E5E7EB;
    --border-default: #D1D5DB;
    --border-strong: #9CA3AF;
    --border-focus: var(--accent-border);

    /* ========================================
       Shadows (unchanged)
       ======================================== */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.10);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.12);
    --shadow-glow-primary: 0 0 20px var(--accent-primary-glow);  /* reduced */
    --shadow-glow-success: 0 0 15px var(--success-glow);  /* reduced */
    --shadow-glow-whatsapp: 0 0 15px var(--whatsapp-glow);  /* reduced */
}

/* Light mode background - clean, no gradients */
[data-theme="light"] body::before {
    display: none;
}

[data-theme="light"] body::after {
    display: none;
}

/* Light mode scrollbar - Apple style */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(60, 60, 67, 0.3);
    border-radius: var(--radius-full);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(60, 60, 67, 0.5);
}

/* ============================================
   Base Styles
   ============================================ */

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-void);
    color: var(--text-primary);
    line-height: var(--leading-normal);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Gradient Orbs */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 20%, var(--accent-primary-glow) 0%, transparent 50%);
    pointer-events: none;
    opacity: 0.3;
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    bottom: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 70% 80%, var(--whatsapp-glow) 0%, transparent 50%);
    pointer-events: none;
    opacity: 0.2;
    z-index: -1;
}

/* Focus States */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: var(--accent-primary);
    color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Links */
a {
    color: var(--accent-primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-primary);
}

/* ============================================
   Typography Utilities
   ============================================ */

.text-xs {
    font-size: var(--text-xs);
}

.text-sm {
    font-size: var(--text-sm);
}

.text-base {
    font-size: var(--text-base);
}

.text-md {
    font-size: var(--text-md);
}

.text-lg {
    font-size: var(--text-lg);
}

.text-xl {
    font-size: var(--text-xl);
}

.text-2xl {
    font-size: var(--text-2xl);
}

.text-3xl {
    font-size: var(--text-3xl);
}

.text-4xl {
    font-size: var(--text-4xl);
}

.font-normal {
    font-weight: 400;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-tertiary {
    color: var(--text-tertiary);
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.text-info {
    color: var(--info);
}

/* ============================================
   Animation Keyframes
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

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

    100% {
        background-position: 200% 0;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px var(--accent-primary-glow);
    }

    50% {
        box-shadow: 0 0 40px var(--accent-primary-glow);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn var(--duration-base) var(--ease-out);
}

.animate-fade-in-up {
    animation: fadeInUp var(--duration-slow) var(--ease-out);
}

.animate-fade-in-down {
    animation: fadeInDown var(--duration-slow) var(--ease-out);
}

.animate-slide-in-left {
    animation: slideInLeft var(--duration-slow) var(--ease-out);
}

.animate-slide-in-right {
    animation: slideInRight var(--duration-slow) var(--ease-out);
}

.animate-scale-in {
    animation: scaleIn var(--duration-base) var(--ease-spring);
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* Stagger Animation Delays */
.stagger-1 {
    animation-delay: 50ms;
}

.stagger-2 {
    animation-delay: 100ms;
}

.stagger-3 {
    animation-delay: 150ms;
}

.stagger-4 {
    animation-delay: 200ms;
}

.stagger-5 {
    animation-delay: 250ms;
}

.stagger-6 {
    animation-delay: 300ms;
}

/* ============================================
   Utility Classes
   ============================================ */

/* Flexbox */
.flex {
    display: flex;
}

.inline-flex {
    display: inline-flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.items-end {
    align-items: flex-end;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.gap-1 {
    gap: var(--space-1);
}

.gap-2 {
    gap: var(--space-2);
}

.gap-3 {
    gap: var(--space-3);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

.gap-8 {
    gap: var(--space-8);
}

.flex-1 {
    flex: 1;
}

.flex-shrink-0 {
    flex-shrink: 0;
}

/* Grid */
.grid {
    display: grid;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Spacing */
.mt-1 {
    margin-top: var(--space-1);
}

.mt-2 {
    margin-top: var(--space-2);
}

.mt-3 {
    margin-top: var(--space-3);
}

.mt-4 {
    margin-top: var(--space-4);
}

.mt-6 {
    margin-top: var(--space-6);
}

.mt-8 {
    margin-top: var(--space-8);
}

.mb-1 {
    margin-bottom: var(--space-1);
}

.mb-2 {
    margin-bottom: var(--space-2);
}

.mb-3 {
    margin-bottom: var(--space-3);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-6 {
    margin-bottom: var(--space-6);
}

.mb-8 {
    margin-bottom: var(--space-8);
}

.ml-auto {
    margin-left: auto;
}

.mr-auto {
    margin-right: auto;
}

.p-2 {
    padding: var(--space-2);
}

.p-3 {
    padding: var(--space-3);
}

.p-4 {
    padding: var(--space-4);
}

.p-5 {
    padding: var(--space-5);
}

.p-6 {
    padding: var(--space-6);
}

/* Width/Height */
.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.min-h-screen {
    min-height: 100vh;
}

/* Position */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.sticky {
    position: sticky;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

/* Overflow */
.overflow-hidden {
    overflow: hidden;
}

.overflow-auto {
    overflow: auto;
}

.overflow-x-auto {
    overflow-x: auto;
}

.overflow-y-auto {
    overflow-y: auto;
}

/* Border Radius */
.rounded-sm {
    border-radius: var(--radius-sm);
}

.rounded-md {
    border-radius: var(--radius-md);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

.rounded-2xl {
    border-radius: var(--radius-2xl);
}

.rounded-full {
    border-radius: var(--radius-full);
}

/* Visibility */
.hidden {
    display: none;
}

.invisible {
    visibility: hidden;
}

.opacity-0 {
    opacity: 0;
}

.opacity-50 {
    opacity: 0.5;
}

.opacity-100 {
    opacity: 1;
}

/* Cursor */
.cursor-pointer {
    cursor: pointer;
}

.cursor-not-allowed {
    cursor: not-allowed;
}

/* Transitions */
.transition-all {
    transition: all var(--transition-base);
}

.transition-colors {
    transition: background-color var(--transition-base), color var(--transition-base), border-color var(--transition-base);
}

.transition-transform {
    transition: transform var(--transition-base);
}

.transition-opacity {
    transition: opacity var(--transition-base);
}

/* Hover Effects */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.hover-scale {
    transition: transform var(--transition-fast);
}

.hover-scale:hover {
    transform: scale(1.02);
}

.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow-primary);
}

/* Truncate */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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