/* ==================== THEME SYSTEM ==================== */

/* Light Theme (Default) */
:root[data-theme="light"] {
    /* Background Colors */
    --bg-primary: #F5F7FA;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #E8ECF1;
    --bg-elevated: #FFFFFF;
    --bg-surface: #FFFFFF;
    --bg-input: #FFFFFF;
    --bg-card: #FFFFFF;

    /* Text Colors */
    --text-primary: #1A1D23;
    --text-secondary: #5F6B7A;
    --text-tertiary: #8B95A5;
    --text-muted: #B0BAC8;
    --text-inverse: #FFFFFF;
    --text-link: #E55A2D;

    /* Border Colors */
    --border-primary: #E0E5EC;
    --border-secondary: #D0D7E2;
    --border-tertiary: #C5CDD8;
    --border-focus: #FF6A3D;

    /* Accent Colors */
    --accent-primary: #FF6A3D;
    --accent-primary-hover: #E55A2D;
    --accent-primary-light: rgba(255, 106, 61, 0.08);
    --accent-primary-glow: rgba(255, 106, 61, 0.25);

    --accent-secondary: #1F9D7C;
    --accent-secondary-hover: #1A8A6C;
    --accent-secondary-light: rgba(31, 157, 124, 0.08);
    --accent-secondary-glow: rgba(31, 157, 124, 0.25);

    /* Report Type Colors */
    --color-call: #FF6A3D;
    --color-call-light: rgba(255, 106, 61, 0.08);
    --color-whatsapp: #10B981;
    --color-whatsapp-light: rgba(16, 185, 129, 0.08);
    --color-sms: #F59E0B;
    --color-sms-light: rgba(245, 158, 11, 0.08);
    --color-all: #3B82F6;
    --color-all-light: rgba(59, 130, 246, 0.08);

    /* Status Colors */
    --success: #10B981;
    --success-light: rgba(16, 185, 129, 0.08);
    --warning: #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.08);
    --danger: #EF4444;
    --danger-light: rgba(239, 68, 68, 0.08);
    --info: #3B82F6;
    --info-light: rgba(59, 130, 246, 0.08);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #FF6A3D 0%, #FF8C64 100%);
    --gradient-primary-hover: linear-gradient(135deg, #FF8C64 0%, #FFAA88 100%);
    --gradient-secondary: linear-gradient(135deg, #1F9D7C 0%, #2BB896 100%);
    --gradient-accent: linear-gradient(135deg, #3B82F6 0%, #60A5FA 100%);
    --gradient-success: linear-gradient(135deg, #10B981 0%, #34D399 100%);
    --gradient-bg: linear-gradient(180deg, #F5F7FA 0%, #FFFFFF 100%);
    --gradient-surface: linear-gradient(145deg, #FFFFFF 0%, #F8F9FC 100%);
    --gradient-overlay: linear-gradient(180deg, rgba(245, 247, 250, 0) 0%, rgba(245, 247, 250, 0.95) 100%);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 30px rgba(255, 106, 61, 0.2);
    --shadow-glow-secondary: 0 0 30px rgba(31, 157, 124, 0.2);

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-blur: 16px;

    /* Scrollbar */
    --scrollbar-bg: #E8ECF1;
    --scrollbar-thumb: #D0D7E2;
    --scrollbar-thumb-hover: #C5CDD8;
}

/* Dark Theme */
:root[data-theme="dark"] {
    /* Background Colors */
    --bg-primary: #0F1117;
    --bg-secondary: #1A1D27;
    --bg-tertiary: #242836;
    --bg-elevated: #2A2F3E;
    --bg-surface: #1A1D27;
    --bg-input: #1A1D27;
    --bg-card: #1A1D27;

    /* Text Colors */
    --text-primary: #FFFFFF;
    --text-secondary: #A0A8B8;
    --text-tertiary: #6B7280;
    --text-muted: #4A5060;
    --text-inverse: #0F1117;
    --text-link: #FF8C64;

    /* Border Colors */
    --border-primary: #2A2F3E;
    --border-secondary: #353B4D;
    --border-tertiary: #404860;
    --border-focus: #FF6A3D;

    /* Accent Colors */
    --accent-primary: #FF6A3D;
    --accent-primary-hover: #FF8C64;
    --accent-primary-light: rgba(255, 106, 61, 0.12);
    --accent-primary-glow: rgba(255, 106, 61, 0.35);

    --accent-secondary: #1F9D7C;
    --accent-secondary-hover: #2BB896;
    --accent-secondary-light: rgba(31, 157, 124, 0.12);
    --accent-secondary-glow: rgba(31, 157, 124, 0.35);

    /* Report Type Colors */
    --color-call: #FF6A3D;
    --color-call-light: rgba(255, 106, 61, 0.12);
    --color-whatsapp: #10B981;
    --color-whatsapp-light: rgba(16, 185, 129, 0.12);
    --color-sms: #F59E0B;
    --color-sms-light: rgba(245, 158, 11, 0.12);
    --color-all: #3B82F6;
    --color-all-light: rgba(59, 130, 246, 0.12);

    /* Status Colors */
    --success: #10B981;
    --success-light: rgba(16, 185, 129, 0.12);
    --warning: #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.12);
    --danger: #EF4444;
    --danger-light: rgba(239, 68, 68, 0.12);
    --info: #3B82F6;
    --info-light: rgba(59, 130, 246, 0.12);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #FF6A3D 0%, #FF8C64 100%);
    --gradient-primary-hover: linear-gradient(135deg, #FF8C64 0%, #FFAA88 100%);
    --gradient-secondary: linear-gradient(135deg, #1F9D7C 0%, #2BB896 100%);
    --gradient-accent: linear-gradient(135deg, #3B82F6 0%, #60A5FA 100%);
    --gradient-success: linear-gradient(135deg, #10B981 0%, #34D399 100%);
    --gradient-bg: linear-gradient(180deg, #0F1117 0%, #1A1D27 100%);
    --gradient-surface: linear-gradient(145deg, #1A1D27 0%, #242836 100%);
    --gradient-overlay: linear-gradient(180deg, rgba(15, 17, 23, 0) 0%, rgba(15, 17, 23, 0.95) 100%);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 30px rgba(255, 106, 61, 0.25);
    --shadow-glow-secondary: 0 0 30px rgba(31, 157, 124, 0.25);

    /* Glass Effect */
    --glass-bg: rgba(26, 29, 39, 0.8);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-blur: 16px;

    /* Scrollbar */
    --scrollbar-bg: #242836;
    --scrollbar-thumb: #353B4D;
    --scrollbar-thumb-hover: #404860;
}

/* ==================== GLOBAL STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
    height: 100vh;
    height: 100dvh;
}

#app {
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
}

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

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

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

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

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

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

/* ==================== THEME TOGGLE ==================== */
.theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon-dark,
.theme-icon-light {
    position: absolute;
    font-size: 20px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.theme-icon-dark {
    color: var(--text-primary);
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

.theme-icon-light {
    color: var(--text-primary);
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-icon-dark {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-icon-light {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}