/* Global Theme System - IQ.Solar */
/* Centralized design tokens for consistent dark/light theming across all pages */

:root {
    /* Dark Mode Colors (Default) - Pure Black Background */
    --bg: #000000;
    --page-bg: #000000;
    --card: #111111;
    --input-bg: #0a0a0a;
    --card-hover: #1a1a1a;
    
    /* Background aliases for templates - use bg colors in dark mode */
    --navy: #000000;
    --graphite: #1a1a1a;
    --tungsten: #262626;
    --cloud: #f9fafb;
    
    /* Brand Colors - Stay consistent across themes */
    --cobalt: #2563EB;
    --primary: #2563EB;
    --emerald: #1B9A77;
    --success: #1B9A77;
    --amber: #D99121;
    --warning: #D99121;
    --red: #C63737;
    --danger: #C63737;
    
    /* Text Colors */
    --text: #ffffff;
    --text-primary: #ffffff;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    
    /* Border & Shadow */
    --border: #2a2a2a;
    --input-border: #2a2a2a;
    --border-hover: #404040;
    --border-light: #404040;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.4);
    
    /* Additional Aliases */
    --background: #000000;
    --card-bg: #111111;
    --muted: #9CA3AF;
    --error: #C63737;
    --green: #1B9A77;
    --accent-light: #3B82F6;
    
    /* Literal Colors - Same in Both Themes */
    --white: #FFFFFF;
    --light-gray: #F5F5F5;
}

/* Light Theme - Pure White Background */
[data-theme="light"] {
    --bg: #ffffff;
    --page-bg: #ffffff;
    --card: #f9fafb;
    --input-bg: #ffffff;
    --card-hover: #f3f4f6;
    
    /* Text colors inverted for light mode */
    --text: #111827;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    
    /* Borders lighter in light mode */
    --border: #e5e7eb;
    --input-border: #e5e7eb;
    --border-hover: #d1d5db;
    --border-light: #d1d5db;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.1);
    
    /* Additional Aliases */
    --background: #ffffff;
    --card-bg: #f9fafb;
    --muted: #6B7280;
    --accent-light: #60A5FA;
    
    /* Literal Colors - Same in Both Themes */
    --white: #FFFFFF;
    --light-gray: #F5F5F5;
    
    /* Background aliases for templates - use light colors in light mode */
    --navy: #F5F7FA;
    --graphite: #FFFFFF;
    --tungsten: #E5E7EB;
    --cloud: #F5F7FA;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    transition: background 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Button System */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--cobalt);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1.5;
}

.btn:hover {
    background: #1D4ED8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--card-hover);
    border-color: var(--cobalt);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-outline {
    background: transparent;
    color: var(--cobalt);
    border: 2px solid var(--cobalt);
}

.btn-outline:hover {
    background: var(--cobalt);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-danger {
    background: var(--red);
    color: #ffffff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-success {
    background: var(--emerald);
    color: #ffffff;
}

.btn-success:hover {
    background: #166534;
}

/* Card System */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    transition: all 0.2s ease;
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

/* Form Inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--cobalt);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input:hover,
textarea:hover,
select:hover {
    border-color: var(--border-hover);
}

input:disabled,
textarea:disabled,
select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Form Group */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.theme-toggle:hover {
    background: var(--card-hover);
    border-color: var(--cobalt);
    transform: scale(1.05);
}

.theme-icon {
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

/* Utility Classes */
.text-center {
    text-align: center;
}

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

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-wide {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Text Overflow Fix */
.text-wrap {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--text);
    background: var(--card);
}

tr:hover {
    background: var(--card-hover);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container,
    .container-wide,
    .container-narrow {
        padding: 0 16px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
        top: 16px;
        right: 16px;
    }
    
    .card {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .btn-large {
        padding: 14px 24px;
        font-size: 15px;
    }
}
