/* 
   =============================================
   GLOBAL SaaS DESIGN SYSTEM
   =============================================
*/

:root {
    /* 1. Spacing Scale (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;

    /* 2. Border Radius System */
    --radius-sm: 6px;
    /* Inputs, Badges, Small Buttons */
    --radius-md: 10px;
    /* Cards, Standard Buttons, Dropdowns */
    --radius-lg: 16px;
    /* Modals, Large Panels */
    --radius-full: 9999px;

    /* 3. Global Shadows System */
    /* Light UI shadows only apply in the light theme. Dark overrides below. */
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    /* Cards, Inputs */
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    /* Dropdowns, Floating */
    --shadow-strong: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    /* Modals */

    /* 4. Font & Typography */
    --font-heading: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* 5. Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);

    /* 
       =============================================
       LIGHT THEME (Default)
       =============================================
    */
    --bg-primary: #f8fafc;
    /* Crisp, cool light app background */
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;

    --text-primary: #0f172a;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    --border: #e2e8f0;
    --border-hover: #cbd5e1;

    --accent: #2563eb;
    /* Premium Blue */
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;

    --success: #059669;
    --success-bg: #d1fae5;
    --success-text: #064e3b;

    --warning: #d97706;
    --warning-bg: #fef3c7;
    --warning-text: #78350f;

    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --danger-text: #7f1d1d;

    --focus-ring: rgba(37, 99, 235, 0.5);
}

/* 
   =============================================
   DARK THEME
   =============================================
*/
:root[data-theme="dark"] {
    /* Sleek, modern dark mode (True black/blue-tinted gray) */
    --bg-primary: #0f1115;
    --bg-surface: #191c20;
    --bg-surface-hover: #22262d;

    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    --border: #2a2e37;
    --border-hover: #3b4250;

    --accent: #3b82f6;
    /* Lighter premium blue */
    --accent-hover: #60a5fa;
    --accent-light: #1e3a8a;

    --success: #10b981;
    --success-bg: #064e3b;
    --success-text: #a7f3d0;

    --warning: #f59e0b;
    --warning-bg: #78350f;
    --warning-text: #fde68a;

    --danger: #ef4444;
    --danger-bg: #7f1d1d;
    --danger-text: #fecaca;

    /* Softer ambient shadows for dark mode to simulate glowing depth */
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-strong: 0 20px 25px -5px rgba(0, 0, 0, 0.8), 0 8px 10px -6px rgba(0, 0, 0, 0.6);

    --focus-ring: rgba(59, 130, 246, 0.5);
}

/* 
   =============================================
   CORE COMPONENT RESET & STYLES
   =============================================
*/

/* Enforce transition smoothly across app & Add Custom Premium Scrollbars */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
    font-family: var(--font-body);
}

/* Visibility Utilities */
.hidden {
    display: none !important;
}

/* Minimal Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* Base Card Level */
.saas-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-light);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.saas-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

/* Primary Action Button */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2) var(--space-5);
    background-color: var(--accent);
    color: var(--text-inverse);
    font-weight: 600;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
    transition: all var(--transition-normal);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.23);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.96);
}

/* Secondary / Subtle Button */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2) var(--space-5);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 600;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    cursor: pointer;
    box-shadow: var(--shadow-light);
    transition: all var(--transition-normal);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-secondary:active:not(:disabled) {
    transform: scale(0.96);
}

/* Inputs & Form Fields */
.saas-input {
    width: 100%;
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    font-size: 1rem;
    box-shadow: var(--shadow-light);
    transition: all var(--transition-fast);
    outline: none;
}

.saas-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.saas-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.saas-label {
    display: block;
    margin-bottom: var(--space-1);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

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

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

.badge-neutral {
    background: var(--bg-surface-hover);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* Premium Depth / Glassmorphism utility */
.glass-panel {
    background-color: color-mix(in srgb, var(--bg-surface) 70%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}

/* Custom Uiverse Animated Button */
.animated-button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 36px;
    border: 3px solid;
    border-color: transparent;
    font-size: 1.15rem;
    background-color: var(--bg-surface);
    border-radius: 100px;
    font-weight: 700;
    color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent), var(--shadow-medium);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.animated-button svg {
    position: absolute;
    width: 24px;
    fill: var(--accent);
    z-index: 9;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button .arr-1 {
    right: 16px;
}

.animated-button .arr-2 {
    left: -25%;
}

.animated-button .circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background-color: var(--accent);
    border-radius: 50%;
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 0;
}

.animated-button .text {
    position: relative;
    z-index: 1;
    transform: translateX(-12px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button:hover {
    box-shadow: 0 0 0 12px transparent;
    color: var(--text-inverse);
    border-radius: var(--radius-lg);
}

.animated-button:hover .arr-1 {
    right: -25%;
}

.animated-button:hover .arr-2 {
    left: 16px;
}

.animated-button:hover .text {
    transform: translateX(12px);
}

.animated-button:hover svg {
    fill: var(--text-inverse);
}

.animated-button:active {
    transform: scale(0.96);
    box-shadow: 0 0 0 4px var(--accent);
}

.animated-button:hover .circle {
    width: 300px;
    height: 300px;
    opacity: 1;
}