/**
 * Base Styles - Reset, Theme Variables, and Core Body Styles
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global scrollbar — matches sidebar scrollbar style */
html {
    scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
}
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* Theme Variables */
:root {
    /* Dark Theme (Default) */
    --bg-primary: linear-gradient(135deg, #1a2332 0%, #0f1922 100%);
    --bg-secondary: rgba(15, 23, 34, 0.9);
    --bg-card: rgba(30, 41, 59, 0.5);
    --bg-hover: rgba(30, 41, 59, 0.7);
    --border-color: rgba(102, 126, 234, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --toggle-bg: #1e293b;
    --sidebar-bg: rgba(15, 23, 34, 0.98);
    --menu-hover: rgba(102, 126, 234, 0.1);
    --input-bg: #1e293b;
    --shadow: rgba(0, 0, 0, 0.3);
}

body.light-theme {
    /* Light Theme */
    --bg-primary: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --bg-secondary: rgba(255, 255, 255, 0.95);
    --bg-card: rgba(255, 255, 255, 1);
    --bg-hover: rgba(248, 250, 252, 0.9);
    --border-color: rgba(102, 126, 234, 0.25);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --toggle-bg: #f1f5f9;
    --sidebar-bg: rgba(255, 255, 255, 0.98);
    --menu-hover: rgba(102, 126, 234, 0.08);
    --input-bg: #f8fafc;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    padding-left: 300px; /* Offset for sidebar */
    transition: padding-left 0.3s ease, background 0.3s ease, color 0.3s ease;
}

body.menu-collapsed {
    padding-left: 100px;
}

@media (max-width: 768px) {
    body {
        padding-left: 20px; /* Reset for mobile */
        padding-top: 80px; /* Offset for mobile header */
    }

    body.menu-collapsed {
        padding-left: 20px;
    }
}

.container {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes greenGlow {
    0%, 100% {
        text-shadow: 0 0 5px rgba(72, 187, 120, 0.5),
                     0 0 10px rgba(72, 187, 120, 0.3),
                     0 0 15px rgba(72, 187, 120, 0.2);
    }
    50% {
        text-shadow: 0 0 10px rgba(72, 187, 120, 0.8),
                     0 0 20px rgba(72, 187, 120, 0.5),
                     0 0 30px rgba(72, 187, 120, 0.3);
    }
}

@keyframes dotGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(72, 187, 120, 0.5),
                    0 0 10px rgba(72, 187, 120, 0.3);
    }
    50% {
        box-shadow: 0 0 10px rgba(72, 187, 120, 0.8),
                    0 0 15px rgba(72, 187, 120, 0.5);
    }
}

@keyframes dotGlowWhite {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.5),
                    0 0 10px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.8),
                    0 0 15px rgba(255, 255, 255, 0.5);
    }
}

@keyframes dotGlowRed {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 8px 2px rgba(239, 68, 68, 0.4);
    }
}

@keyframes dotGlowYellow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.7);
    }
    50% {
        box-shadow: 0 0 8px 2px rgba(251, 191, 36, 0.4);
    }
}

/* ============================================================================
   Privacy Mode - Redacted text style
   ============================================================================ */

body.privacy-mode .account-number,
body.privacy-mode #detailAccountNumber,
body.privacy-mode #menuUserEmail {
    user-select: none;
    pointer-events: none;
    color: transparent !important;
    position: relative;
}

body.privacy-mode .account-number::before,
body.privacy-mode #detailAccountNumber::before,
body.privacy-mode #menuUserEmail::before {
    content: 'xxxxxxxxxxxxx';
    position: absolute;
    left: 0;
    color: var(--text-primary);
    font-family: monospace;
    letter-spacing: 0.1em;
}

/* ============================================================================
   SQX Tabs and Comparison Styles
   ============================================================================ */

.sqx-tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

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

.sqx-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Comparison Summary Grid */
.comparison-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 1750px) {
    .summary-value {
        font-size: 1.5em;
    }
}

@media (max-width: 768px) {
    .comparison-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-value {
        font-size: 1.2em;
    }
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.summary-label {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-bottom: 8px;
}

.summary-value {
    font-size: 2em;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-subtext {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-top: 4px;
}

/* Comparison Table */
.comparison-table th,
.comparison-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9em;
}

.comparison-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
}

.comparison-row-matched {
    background: rgba(16, 185, 129, 0.05);
}

.comparison-row-missed {
    background: rgba(239, 68, 68, 0.1);
}

.comparison-row-extra {
    background: rgba(59, 130, 246, 0.1);
}

.positive {
    color: #10b981;
}

.negative {
    color: #ef4444;
}

/* ============================================================================
   Detail Page Tabs
   ============================================================================ */

.detail-tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

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

.detail-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

@media (max-width: 768px) {
    .detail-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .detail-tabs::-webkit-scrollbar {
        display: none;
    }

    .detail-tab {
        padding: 10px 16px;
        font-size: 0.9em;
        white-space: nowrap;
    }
}

/* ============================================================================
   Account Color Picker
   ============================================================================ */

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.color-swatch.selected {
    border-color: white;
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 8px rgba(255, 255, 255, 0.5);
}
