/* PureTalk Dashboard - Refactored Theme Styles */

/* ================================================
   1. CSS VARIABLES & ROOT STYLES
   ================================================ */
:root {
    /* Brand Colors */
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #9b59b6;
    --success-color: #1abc9c;
    
    /* Light Theme Defaults */
    --bg-color: #f8f9fa;
    --surface-color: white;
    --surface-alt-color: #ecf0f1;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: rgba(0,0,0,0.08);
    --shadow-color: rgba(0,0,0,0.1);
    --grid-color: rgba(200,200,200,0.2);
    
    /* Transitions */
    --transition: all 0.3s ease;
}

/* ================================================
   2. DARK MODE VARIABLES
   ================================================ */
body.dark-mode {
    --bg-color: #121212;
    --surface-color: #2c2c2c;
    --surface-alt-color: #1a1a1a;
    --text-primary: #f8f9fa;
    --text-secondary: #b0b0b0;
    --border-color: rgba(255,255,255,0.1);
    --shadow-color: rgba(0,0,0,0.5);
    --grid-color: rgba(255,255,255,0.1);
}

/* ================================================
   3. BASE STYLES
   ================================================ */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    transition: var(--transition);
}

/* ================================================
   4. TYPOGRAPHY
   ================================================ */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    margin-top: 0;
    transition: color 0.3s ease;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

/* ================================================
   5. THEMED COMPONENTS
   ================================================ */

/* Themed Cards */
.themed-card {
    background-color: var(--surface-color);
    border-radius: 10px;
    box-shadow: 0 2px 4px var(--shadow-color);
    padding: 30px;
    transition: var(--transition);
}

.themed-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

/* Themed KPI Cards */
.themed-kpi-card {
    background-color: var(--surface-color);
    color: var(--text-primary);
    border-radius: 15px;
    box-shadow: 0 4px 6px var(--shadow-color);
    text-align: center;
    padding: 25px;
    transition: var(--transition);
    cursor: pointer;
}

.themed-kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px var(--shadow-color);
}

.themed-kpi-card h3 {
    color: var(--text-secondary);
}

/* Themed Graph Containers */
.themed-graph-container {
    background-color: var(--surface-alt-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    transition: var(--transition);
}

/* Themed Section Headers */
.themed-section-header h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
}

.themed-section-header hr {
    border-color: var(--border-color);
    margin-bottom: 30px;
}

/* ================================================
   6. TABS STYLING
   ================================================ */
.custom-tab {
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 15px 30px;
    margin-right: 10px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-size: 16px;
    color: var(--text-secondary);
    position: relative;
}

.custom-tab:hover {
    color: var(--primary-color);
    background-color: rgba(52, 152, 219, 0.1);
}

.custom-tab--selected {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: rgba(52, 152, 219, 0.05);
}

/* Dark mode tab adjustments */
body.dark-mode .custom-tab {
    color: var(--text-secondary);
    border-color: #444;
}

body.dark-mode .custom-tab:hover {
    background-color: rgba(52, 152, 219, 0.2);
}

body.dark-mode .custom-tab--selected {
    border-bottom-color: var(--primary-color);
}

/* ================================================
   7. TABLE STYLES
   ================================================ */
.dash-table-container {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.dash-spreadsheet {
    border: none !important;
}

.dash-header {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.dash-cell {
    background-color: var(--surface-color);
    color: var(--text-primary);
    border-color: var(--border-color) !important;
    padding: 15px !important;
    font-size: 14px;
}

.dash-cell:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

/* Dark mode table overrides */
body.dark-mode .dash-header {
    background-color: var(--surface-alt-color);
}

body.dark-mode .dash-cell {
    background-color: var(--surface-color);
    color: var(--text-primary);
}

/* ================================================
   8. PLOTLY GRAPH STYLES
   ================================================ */
.js-plotly-plot {
    border-radius: 10px;
    overflow: hidden;
}

/* Light mode modebar styling */
body:not(.dark-mode) .modebar {
    background-color: rgba(248, 249, 250, 0.9) !important;
    border-radius: 5px;
    padding: 5px;
}

body:not(.dark-mode) .modebar-btn {
    color: #2c3e50 !important;
}

body:not(.dark-mode) .modebar-btn:hover {
    background-color: rgba(52, 152, 219, 0.1) !important;
}

/* ================================================
   9. FORM CONTROLS
   ================================================ */
.Select-control {
    background-color: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.Select-menu-outer {
    background-color: var(--surface-color);
    border-color: var(--border-color);
}

.Select-option {
    background-color: var(--surface-color);
    color: var(--text-primary);
}

.Select-option:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

/* Dark mode form control adjustments */
body.dark-mode .Select-control {
    background-color: var(--surface-color);
    border-color: var(--border-color);
}

body.dark-mode .Select-value-label {
    color: var(--text-primary);
}

/* ================================================
   10. UTILITY CLASSES
   ================================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

/* ================================================
   11. ANIMATIONS
   ================================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* ================================================
   12. RESPONSIVE DESIGN
   ================================================ */
@media (max-width: 1200px) {
    .container-fluid {
        max-width: 100%;
        padding: 15px;
    }
}

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .custom-tab {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .themed-kpi-card {
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .custom-tab {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* ================================================
   13. PRINT STYLES
   ================================================ */
@media print {
    body {
        background-color: white;
        color: black;
    }
    
    .modebar {
        display: none !important;
    }
    
    .themed-card,
    .themed-kpi-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}