/**
 * Campaign Frameworks - Global Theme
 * Shared styles for all campaign tools and pages
 */

/* ============================================ */
/* CSS VARIABLES - Light & Dark Mode */
/* ============================================ */

:root {
    /* Text Colors */
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-tertiary: #6a6a6a;
    --text-inverse: #ffffff;
    --text-header: #1a1a1a;

    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e5e5e5;
    --bg-header: #ffffff;
    --bg-chat-user: #2563eb;
    --bg-chat-ai: #f0f0f0;

    /* Border Colors */
    --border-primary: #d0d0d0;
    --border-focus: #2563eb;

    /* Semantic Colors */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-success: #16a34a;
    --color-error: #dc2626;
    --color-warning: #f59e0b;

    /* Semantic Badge/Status Colors (for UI components) */
    --bg-primary-light: #eff6ff;
    --border-primary-light: #bfdbfe;

    --bg-success-light: #dcfce7;
    --text-success: #15803d;
    --border-success: #16a34a;

    --bg-warning-light: #fef3c7;
    --text-warning: #b45309;
    --border-warning: #d97706;

    --bg-error-light: #fee2e2;
    --text-error: #b91c1c;
    --border-error: #dc2626;

    /* Color Scales (Tailwind-style) - Primary */
    --color-primary-50: #eff6ff;
    --color-primary-100: #dbeafe;
    --color-primary-200: #bfdbfe;
    --color-primary-300: #93c5fd;
    --color-primary-400: #60a5fa;
    --color-primary-500: #3b82f6;
    --color-primary-600: #2563eb;
    --color-primary-700: #1d4ed8;
    --color-primary-800: #1e40af;
    --color-primary-900: #1e3a8a;

    /* Color Scales - Success */
    --color-success-50: #f0fdf4;
    --color-success-100: #dcfce7;
    --color-success-200: #bbf7d0;
    --color-success-300: #86efac;
    --color-success-400: #4ade80;
    --color-success-500: #22c55e;
    --color-success-600: #16a34a;
    --color-success-700: #15803d;
    --color-success-800: #166534;
    --color-success-900: #14532d;

    /* Color Scales - Error */
    --color-error-50: #fef2f2;
    --color-error-100: #fee2e2;
    --color-error-200: #fecaca;
    --color-error-300: #fca5a5;
    --color-error-400: #f87171;
    --color-error-500: #ef4444;
    --color-error-600: #dc2626;
    --color-error-700: #b91c1c;
    --color-error-800: #991b1b;
    --color-error-900: #7f1d1d;

    /* Color Scales - Warning */
    --color-warning-50: #fffbeb;
    --color-warning-100: #fef3c7;
    --color-warning-200: #fde68a;
    --color-warning-300: #fcd34d;
    --color-warning-400: #fbbf24;
    --color-warning-500: #f59e0b;
    --color-warning-600: #d97706;
    --color-warning-700: #b45309;
    --color-warning-800: #92400e;
    --color-warning-900: #78350f;

    /* Overlays (semi-transparent) */
    --overlay-light-50: rgba(255, 255, 255, 0.5);
    --overlay-light-80: rgba(255, 255, 255, 0.8);
    --overlay-light-90: rgba(255, 255, 255, 0.9);
    --overlay-dark-20: rgba(0, 0, 0, 0.2);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    --shadow-2xl: 0 20px 60px rgba(0, 0, 0, 0.3);
    --shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.1);
    --shadow-primary-sm: 0 2px 8px rgba(37, 99, 235, 0.25);
    --shadow-primary-md: 0 4px 12px rgba(37, 99, 235, 0.35);

    /* Badge Backgrounds (semi-transparent) */
    --badge-success-bg: rgba(22, 163, 74, 0.1);
    --badge-warning-bg: rgba(245, 158, 11, 0.1);
    --badge-error-bg: rgba(220, 38, 38, 0.1);

    /* Modal Overlay */
    --modal-overlay-bg: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] {
    /* Text Colors */
    --text-primary: #e8e8e8;
    --text-secondary: #b8b8b8;
    --text-tertiary: #888888;
    --text-inverse: #1a1a1a;
    --text-header: #e8e8e8;

    /* Background Colors */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-tertiary: #3a3a3a;
    --bg-header: #1a1a1a;
    --bg-chat-user: #3b82f6;
    --bg-chat-ai: #2a2a2a;

    /* Border Colors */
    --border-primary: #404040;
    --border-focus: #3b82f6;

    /* Semantic Colors */
    --color-primary: #3b82f6;
    --color-primary-hover: #60a5fa;
    --color-success: #22c55e;
    --color-error: #ef4444;
    --color-warning: #fbbf24;

    /* Semantic Badge/Status Colors (for UI components) */
    --bg-primary-light: #1e3a8a;
    --border-primary-light: #60a5fa;

    --bg-success-light: #14532d;
    --text-success: #86efac;
    --border-success: #22c55e;

    --bg-warning-light: #78350f;
    --text-warning: #fcd34d;
    --border-warning: #fbbf24;

    --bg-error-light: #7f1d1d;
    --text-error: #fca5a5;
    --border-error: #ef4444;

    /* Color Scales (Tailwind-style) - Primary */
    --color-primary-50: #eff6ff;
    --color-primary-100: #dbeafe;
    --color-primary-200: #bfdbfe;
    --color-primary-300: #93c5fd;
    --color-primary-400: #60a5fa;
    --color-primary-500: #3b82f6;
    --color-primary-600: #2563eb;
    --color-primary-700: #1d4ed8;
    --color-primary-800: #1e40af;
    --color-primary-900: #1e3a8a;

    /* Color Scales - Success */
    --color-success-50: #f0fdf4;
    --color-success-100: #dcfce7;
    --color-success-200: #bbf7d0;
    --color-success-300: #86efac;
    --color-success-400: #4ade80;
    --color-success-500: #22c55e;
    --color-success-600: #16a34a;
    --color-success-700: #15803d;
    --color-success-800: #166534;
    --color-success-900: #14532d;

    /* Color Scales - Error */
    --color-error-50: #fef2f2;
    --color-error-100: #fee2e2;
    --color-error-200: #fecaca;
    --color-error-300: #fca5a5;
    --color-error-400: #f87171;
    --color-error-500: #ef4444;
    --color-error-600: #dc2626;
    --color-error-700: #b91c1c;
    --color-error-800: #991b1b;
    --color-error-900: #7f1d1d;

    /* Color Scales - Warning */
    --color-warning-50: #fffbeb;
    --color-warning-100: #fef3c7;
    --color-warning-200: #fde68a;
    --color-warning-300: #fcd34d;
    --color-warning-400: #fbbf24;
    --color-warning-500: #f59e0b;
    --color-warning-600: #d97706;
    --color-warning-700: #b45309;
    --color-warning-800: #92400e;
    --color-warning-900: #78350f;

    /* Overlays (semi-transparent) */
    --overlay-light-50: rgba(255, 255, 255, 0.5);
    --overlay-light-80: rgba(255, 255, 255, 0.8);
    --overlay-light-90: rgba(255, 255, 255, 0.9);
    --overlay-dark-20: rgba(0, 0, 0, 0.3);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.4);
    --shadow-2xl: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.2);
    --shadow-primary-sm: 0 2px 8px rgba(59, 130, 246, 0.3);
    --shadow-primary-md: 0 4px 12px rgba(59, 130, 246, 0.4);

    /* Badge Backgrounds (semi-transparent) */
    --badge-success-bg: rgba(34, 197, 94, 0.2);
    --badge-warning-bg: rgba(251, 191, 36, 0.2);
    --badge-error-bg: rgba(239, 68, 68, 0.2);

    /* Modal Overlay */
    --modal-overlay-bg: rgba(0, 0, 0, 0.8);
}

/* ============================================ */
/* BASE STYLES */
/* ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ============================================ */
/* LAYOUT */
/* ============================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.container-narrow {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.hidden {
    display: none !important;
}

/* ============================================ */
/* TYPOGRAPHY */
/* ============================================ */

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-header);
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ============================================ */
/* CARDS */
/* ============================================ */

.card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* ============================================ */
/* BUTTONS */
/* ============================================ */

.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-primary);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--color-primary);
}

.btn-success {
    background: var(--color-success);
    color: var(--text-inverse);
}

.btn-success:hover {
    filter: brightness(1.1);
}

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

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 2rem;
}

/* ============================================ */
/* FORMS & INPUTS */
/* ============================================ */

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-primary);
    border-radius: 0.5rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}

select {
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ============================================ */
/* ALERTS */
/* ============================================ */

.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-info {
    background: var(--color-primary);
    color: var(--text-inverse);
}

.alert-success {
    background: var(--color-success);
    color: var(--text-inverse);
}

.alert-error {
    background: var(--color-error);
    color: var(--text-inverse);
}

.alert-warning {
    background: var(--color-warning);
    color: var(--text-inverse);
}

/* ============================================ */
/* THEME TOGGLE */
/* ============================================ */

.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    transform: scale(1.05);
}

/* ============================================ */
/* PROGRESS INDICATORS */
/* ============================================ */

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    margin: 2rem 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* ============================================ */
/* LOADING SPINNER */
/* ============================================ */

.spinner {
    border: 3px solid var(--bg-tertiary);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================ */
/* UTILITY CLASSES */
/* ============================================ */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* ============================================ */
/* RESPONSIVE DESIGN */
/* ============================================ */

@media (max-width: 768px) {
    .container,
    .container-narrow {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9375rem;
    }

    .button-group {
        flex-direction: column;
    }

    .card {
        padding: 1.5rem;
    }
}
