/* Modern Premium Styles for AdForge AI */

/* Dark Theme (Default) */
:root {
    /* Premium Color Palette */
    --primary: #6B46C1;
    --primary-dark: #553C9A;
    --primary-light: #9F7AEA;
    --secondary: #2563EB;
    --secondary-dark: #1E40AF;
    --accent: #F59E0B;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    
    /* Dark Theme Colors */
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --border: #475569;
    
    /* Glass effect */
    --glass-bg: rgba(30, 41, 59, 0.5);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* Light Theme */
[data-theme="light"] {
    /* Premium Purple & Blue Accent Colors */
    --primary: #7C3AED;
    --primary-dark: #6B46C1;
    --primary-light: #A78BFA;
    --secondary: #3B82F6;
    --secondary-dark: #2563EB;
    --accent: #F59E0B;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    
    /* Clean Light Theme Colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: #FAFBFC;
    --bg-tertiary: #F3F4F6;
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    
    /* Glass effect for light theme */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.08);
    
    /* Enhanced shadows for light theme */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.15);
}

:root, [data-theme="light"] {
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgba(107, 70, 193, 0.3);
}

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

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

/* Dark theme gradient background */
body:not([data-theme="light"]) {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

/* Light theme gradient background */
[data-theme="light"] body {
    background: linear-gradient(135deg, #FFFFFF 0%, #F0F9FF 100%);
}

/* Glass Morphism Effect */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-xl);
    transition: all 0.3s ease;
}

/* Premium Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: var(--space-lg) var(--space-xl);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Navigation */
.nav {
    display: flex;
    gap: var(--space-sm);
}

.nav-item {
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.nav-item:hover {
    background: rgba(107, 70, 193, 0.1);
    color: var(--primary-light);
}

.nav-item.active {
    background: rgba(107, 70, 193, 0.2);
    color: var(--primary-light);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: var(--primary);
    border-radius: var(--radius-full);
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-xl);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
    border-color: var(--primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Buttons */
.btn {
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(107, 70, 193, 0.3);
}

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

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

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
}

.btn-large {
    padding: var(--space-md) var(--space-xl);
    font-size: 1.1rem;
}

.btn-group {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* Input Fields */
.input-group {
    margin-bottom: var(--space-lg);
}

.input-label {
    display: block;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.input-field {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
}

.textarea-field {
    min-height: 120px;
    resize: vertical;
}

/* Select Dropdown */
.select-field {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23CBD5E1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.5rem;
    padding-right: 2.5rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-light);
    margin-bottom: var(--space-xs);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
    font-size: 0.85rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--error);
}

/* Progress Bar */
.progress-container {
    margin-bottom: var(--space-lg);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.toggle {
    position: relative;
    width: 48px;
    height: 24px;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    transition: 0.4s;
    border-radius: var(--radius-full);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Tabs */
.tabs {
    display: flex;
    gap: var(--space-xs);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-xl);
}

.tab {
    padding: var(--space-md) var(--space-lg);
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

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

.tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--error);
    color: white;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Notification Badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    min-width: 20px;
}

.badge-primary {
    background: var(--primary);
    color: white;
}

.badge-success {
    background: var(--success);
    color: white;
}

.badge-warning {
    background: var(--warning);
    color: white;
}

.badge-error {
    background: var(--error);
    color: white;
}

/* Generation Mode Selector */
.mode-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.mode-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.mode-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.mode-card.selected {
    border-color: var(--primary);
    background: rgba(107, 70, 193, 0.1);
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.mode-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.mode-description {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Provider Status Grid */
.provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.provider-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
    position: relative;
}

.provider-status {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.provider-status.online {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.provider-status.offline {
    background: var(--error);
}

.provider-status.limited {
    background: var(--warning);
}

.provider-name {
    font-weight: 500;
    margin-top: var(--space-sm);
}

.provider-metrics {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: var(--space-md);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .header-content {
        flex-direction: column;
        gap: var(--space-md);
    }
    
    .nav {
        width: 100%;
        justify-content: center;
    }
    
    .mode-selector {
        grid-template-columns: 1fr;
    }
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 999;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(107, 70, 193, 0.5);
}

/* Light theme specific styles */
[data-theme="light"] .card {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border);
}

[data-theme="light"] .card:hover {
    box-shadow: 0 10px 40px rgba(124, 58, 237, 0.12);
    border-color: var(--primary-light);
}

[data-theme="light"] .stat-card {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border);
}

[data-theme="light"] .stat-value {
    color: var(--primary);
}

[data-theme="light"] .mode-card {
    background: white;
    border: 2px solid var(--border);
}

[data-theme="light"] .mode-card:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, white 0%, #FAFAFF 100%);
}

[data-theme="light"] .mode-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, #FAFAFF 0%, #F5F3FF 100%);
}

[data-theme="light"] .input-field {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

[data-theme="light"] .input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

[data-theme="light"] .btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 14px 0 rgba(124, 58, 237, 0.25);
}

[data-theme="light"] .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35);
}

[data-theme="light"] .btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

[data-theme="light"] .btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

[data-theme="light"] .provider-card {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border);
}

[data-theme="light"] .progress-bar {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

[data-theme="light"] .progress-fill {
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
}

[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid var(--border);
}

[data-theme="light"] .nav-item {
    color: var(--text-secondary);
}

[data-theme="light"] .nav-item:hover {
    background: rgba(124, 58, 237, 0.05);
    color: var(--primary);
}

[data-theme="light"] .nav-item.active {
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
}

[data-theme="light"] .nav-item.active::after {
    background: var(--primary);
}

[data-theme="light"] .badge-primary {
    background: var(--primary);
}

[data-theme="light"] .badge-success {
    background: var(--success);
}

[data-theme="light"] .logo-icon {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

[data-theme="light"] .screenshot-feature {
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    border: 1px solid #86EFAC;
}

[data-theme="light"] .toggle-slider {
    background: #CBD5E1;
}

[data-theme="light"] .toggle-input:checked + .toggle-slider {
    background: var(--primary);
}

/* Smooth transitions for theme switching */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Special gradient for light theme buttons */
[data-theme="light"] .btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.25);
}

[data-theme="light"] .btn-success:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

/* Toast notification for light theme */
[data-theme="light"] .toast {
    background: white;
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}