/* Universal Theme System - Shared Components */
/* Can be used across all your websites */

/* CSS Variables for Theme System */
:root {
    /* Light Theme (Default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-accent: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --text-accent: #667eea;
    --text-inverse: #ffffff;
    
    --border-primary: #e2e8f0;
    --border-secondary: #cbd5e1;
    --border-accent: #667eea;
    
    --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
    --shadow-accent: 0 8px 25px rgba(102, 126, 234, 0.3);
    
    --success-bg: #ecfdf5;
    --success-text: #059669;
    --success-border: #86efac;
    
    --error-bg: #fef2f2;
    --error-text: #dc2626;
    --error-border: #fca5a5;
    
    --warning-bg: #fffbeb;
    --warning-text: #d97706;
    --warning-border: #fcd34d;
    
    --info-bg: #eff6ff;
    --info-text: #2563eb;
    --info-border: #93c5fd;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-accent: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --bg-surface: #1e293b;
    --bg-card: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-accent: #818cf8;
    --text-inverse: #0f172a;
    
    --border-primary: #475569;
    --border-secondary: #64748b;
    --border-accent: #818cf8;
    
    --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-accent: 0 8px 25px rgba(129, 140, 248, 0.4);
    
    --success-bg: #064e3b;
    --success-text: #34d399;
    --success-border: #059669;
    
    --error-bg: #7f1d1d;
    --error-text: #f87171;
    --error-border: #dc2626;
    
    --warning-bg: #78350f;
    --warning-text: #fbbf24;
    --warning-border: #f59e0b;
    
    --info-bg: #1e3a8a;
    --info-text: #60a5fa;
    --info-border: #3b82f6;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Universal Theme Toggle Button */
.theme-toggle {
    background: var(--bg-surface);
    border: 2px solid var(--border-primary);
    border-radius: 25px;
    width: 50px;
    height: 28px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-sm);
    transform: scale(1.05);
}

.theme-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    transition: all 0.3s ease;
}

.theme-icon.sun {
    left: 4px;
    opacity: 1;
}

.theme-icon.moon {
    right: 4px;
    opacity: 0;
}

[data-theme="dark"] .theme-icon.sun {
    opacity: 0;
    left: -20px;
}

[data-theme="dark"] .theme-icon.moon {
    opacity: 1;
    right: 4px;
}

/* Universal Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--bg-accent);
    color: var(--text-inverse);
    box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-primary);
}

.btn-secondary:hover {
    border-color: var(--border-accent);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 2px solid var(--success-border);
}

.btn-success:hover {
    background: var(--success-text);
    color: var(--text-inverse);
}

.btn-error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 2px solid var(--error-border);
}

.btn-error:hover {
    background: var(--error-text);
    color: var(--text-inverse);
}

/* Universal Card Styles */
.card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-primary);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-accent);
}

.card-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-primary);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Universal Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
}

/* Universal Alert Styles */
.alert {
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid var(--warning-border);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

/* Universal Layout Helpers */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.grid {
    display: grid;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Universal Text Styles */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--text-accent); }
.text-success { color: var(--success-text); }
.text-error { color: var(--error-text); }
.text-warning { color: var(--warning-text); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Universal Spacing */
.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: 2rem; }

.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: 2rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 2rem; }

/* Animation and transition helpers */
.transition {
    transition: all 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Responsive breakpoints */
@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }
}

/* Theme transition smoothing */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *:before,
.theme-transitioning *:after {
    transition: background-color 0.3s ease, 
               border-color 0.3s ease, 
               color 0.3s ease, 
               box-shadow 0.3s ease !important;
    transition-delay: 0s !important;
}
