/* =====================================================
   AI WEBSITE BUILDER - MAIN STYLES
   ===================================================== */

/* CSS Variables */
:root {
    /* Colors - Warm Gradient Style */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: #16161f;
    --bg-hover: #1f1f2e;
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;
    
    --accent-primary: #8B5CF6;
    --accent-secondary: #06B6D4;
    --accent-gradient: linear-gradient(135deg, #8B5CF6 0%, #06B6D4 100%);
    --accent-gradient-hover: linear-gradient(135deg, #9D6FFF 0%, #22D3EE 100%);
    
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;
    
    /* Typography */
    --font-main: 'Roboto', sans-serif;
    --font-heading: 'Roboto Condensed', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.3);
    
    /* Border */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.15);
    
    /* Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
    
    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 60px;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography - Headings use Roboto Condensed */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Code and mono elements */
code, pre, textarea.code-editor {
    font-family: var(--font-mono);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Links */
a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-secondary);
}

/* Buttons Base */
button {
    font-family: inherit;
    border: none;
    background: none;
    cursor: pointer;
    outline: none;
}

/* Inputs Base */
input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;
    background: none;
}

/* =====================================================
   LOADING SCREEN
   ===================================================== */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.loader-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    opacity: 0.8;
    animation: pulse-logo 2s ease-in-out infinite;
}

.loader-content h2 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-primary);
    margin: 0;
}

.loader-content p {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0;
}

@keyframes pulse-logo {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}

/* =====================================================
   APP CONTAINER
   ===================================================== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.app-container.hidden {
    opacity: 0;
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ffffff;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all var(--transition-fast);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
    border-left: none;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-indicator.active {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* =====================================================
   MAIN CONTENT
   ===================================================== */
.main-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.view {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
    overflow-y: auto;
}

.view.active {
    opacity: 1;
    visibility: visible;
}

/* =====================================================
   PROMPT VIEW
   ===================================================== */
.prompt-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

.prompt-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.prompt-header h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.prompt-header p {
    font-family: var(--font-main);
    color: var(--text-secondary);
    font-size: 1rem;
}

/* AI Provider Section */
.ai-provider-section {
    margin-bottom: 1rem;
}

.ai-provider-section h3,
.templates-section h3 {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 600;
}

.provider-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.provider-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-normal);
    position: relative;
    cursor: pointer;
}

.provider-card:hover {
    border-color: var(--border-color-hover);
    transform: translateY(-2px);
}

.provider-card.active {
    border-color: var(--accent-primary);
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.provider-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.provider-card:hover .provider-icon,
.provider-card.active .provider-icon {
    color: white;
}

.provider-icon svg {
    width: 16px;
    height: 16px;
}

.provider-icon.anthropic {
    background: linear-gradient(135deg, #D4A574, #C19660);
    color: white;
}

.provider-icon.gemini {
    background: linear-gradient(135deg, #4285F4, #34A853);
    color: white;
}

.provider-icon.grok {
    background: linear-gradient(135deg, #1DA1F2, #000000);
    color: white;
}

.provider-icon.mistral {
    background: linear-gradient(135deg, #4D6BFE, #2548D9);
    color: white;
}

.provider-badge.free {
    background: var(--success);
}

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

.provider-info h4 {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.provider-info span {
    font-size: 0.625rem;
    color: var(--text-muted);
}

.provider-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.5rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Templates Section */
.templates-section {
    margin-bottom: 1rem;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    transition: all var(--transition-fast);
}

.template-card:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.template-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    margin-bottom: 0.125rem;
}

.template-icon svg {
    width: 16px;
    height: 16px;
}

.template-card:hover .template-icon {
    background: transparent;
    color: var(--accent-primary);
    transform: scale(1.1);
}

.template-card span {
    font-size: 0.75rem; /* Increased from 0.625rem */
    color: var(--text-primary); /* Changed from var(--text-secondary) to white */
    font-weight: 500;
}

/* Prompt Input Section */
.prompt-input-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.prompt-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.prompt-textarea-wrapper {
    position: relative;
}

.prompt-textarea-wrapper textarea {
    width: 100%;
    min-height: 180px;
    padding: 1.25rem;
    padding-right: 60px;
    background: transparent;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
}

.prompt-textarea-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.prompt-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.btn-icon svg {
    width: 14px;
    height: 14px;
}

.prompt-options {
    display: flex;
    gap: 1.25rem;
    padding: 0.5rem 0.75rem;
    padding-top: 0.8125rem; /* 13px = 0.5rem + 5px */
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    align-items: center;
}

@media (max-width: 768px) {
    .prompt-options {
        gap: 0.5rem;
    }
}

.option-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.option-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.option-group select {
    padding: 0.3rem 1.75rem 0.3rem 0.5rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    
    /* Custom Arrow */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a0a0b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.35rem center;
    background-size: 12px;
}

.color-picker {
    display: flex;
    gap: 0.25rem;
}

.color-picker input[type="color"] {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid var(--border-color);
    padding: 0;
    background: transparent;
    overflow: hidden;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.color-picker input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.color-picker input[type="color"]:hover {
    transform: scale(1.1);
    border-color: var(--text-primary);
}

/* Generate Button */
.generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem 2rem;
    background: var(--accent-gradient);
    color: white;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.125rem;
    font-weight: 700;
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.generate-btn:hover {
    transform: translateY(-2px);
    background: var(--accent-gradient-hover);
    box-shadow: var(--shadow-glow), var(--shadow-lg);
}

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

.generate-btn.loading .btn-text,
.generate-btn.loading .btn-icon-right {
    opacity: 0;
}

.generate-btn.loading .btn-loader {
    opacity: 1;
}

.btn-loader {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    opacity: 0;
    animation: spin 1s linear infinite;
}

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

.btn-icon-right svg {
    width: 20px;
    height: 20px;
}

/* Generation Progress */
.generation-progress {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.generation-progress.hidden {
    display: none;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.progress-header span {
    color: var(--accent-primary);
    font-weight: 600;
}

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

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* =====================================================
   SETTINGS VIEW
   ===================================================== */
.settings-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.settings-header {
    margin-bottom: 2rem;
}

.settings-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.settings-header p {
    color: var(--text-secondary);
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.section-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* API Key Cards */
.api-key-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
}

.api-key-card:last-of-type {
    margin-bottom: 1.5rem;
}

.api-key-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.api-key-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.api-key-icon svg {
    width: 20px;
    height: 20px;
}

.api-key-info h3 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.api-key-info a {
    font-size: 0.75rem;
}

.api-key-input {
    display: flex;
    gap: 0.5rem;
}

.api-key-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
}

.api-key-input input::placeholder {
    color: var(--text-muted);
}

.toggle-visibility {
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.toggle-visibility:hover {
    color: var(--text-primary);
}

.toggle-visibility svg {
    width: 18px;
    height: 18px;
}

/* Save Button */
.save-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem;
    background: var(--accent-gradient);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.save-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.save-btn svg {
    width: 18px;
    height: 18px;
}

/* Preferences */
.preference-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.preference-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.preference-item:first-child {
    padding-top: 0;
}

.preference-info h4 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.preference-info p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

/* Fix for switches inside API Key cards (which have bg-tertiary background) */
.api-key-card .toggle-slider {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

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

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

/* =====================================================
   TOAST NOTIFICATIONS
   ===================================================== */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--error);
}

.toast.warning {
    border-color: var(--warning);
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--error); }
.toast.warning .toast-icon { color: var(--warning); }

.toast-message {
    flex: 1;
    font-size: 0.875rem;
}

.toast-close {
    color: var(--text-muted);
    padding: 0.25rem;
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: var(--text-primary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* =====================================================
   MODAL
   ===================================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: all var(--transition-normal);
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-container,
.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 900px; /* Increased for 3 columns */
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    font-size: 1.5rem;
    color: var(--text-muted);
    line-height: 1;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-body textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    resize: vertical;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-secondary {
    padding: 0.625rem 1.25rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all var(--transition-fast);
}

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

.btn-primary {
    padding: 0.625rem 1.25rem;
    background: var(--accent-gradient);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all var(--transition-fast);
}

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

/* =====================================================
   RESPONSIVE
   ===================================================== */
/* Provider Settings Button */
.provider-settings-btn {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    z-index: 2;
    opacity: 0.6;
}

.provider-settings-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    opacity: 1;
}

.provider-settings-btn svg {
    width: 16px;
    height: 16px;
}

/* Logo Styles */
.logo-img-small {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-img-large {
    height: 120px;
    width: auto;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.3));
}

@media (max-width: 1024px) {
    .provider-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .templates-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }

    .app-container {
        flex-direction: column;
    }

    .sidebar {
        order: 2;
        width: 100%;
        height: auto;
        min-height: 65px;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border-color);
        padding: 0;
        background: var(--bg-secondary);
        z-index: 50;
        padding-bottom: env(safe-area-inset-bottom); /* Support for iPhone home bar */
    }
    
    .sidebar-header {
        display: none;
    }
    
    .sidebar-footer {
        display: none;
    }
    
    /* Hide OTTO BUILDER text in logo on mobile */
    .logo-text {
        display: none;
    }
    
    .sidebar-nav {
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        gap: 0;
    }
    
    .nav-item {
        flex-direction: column;
        justify-content: center;
        padding: 8px 0;
        border-radius: 0;
        flex: 1;
        gap: 5px;
        height: 100%;
    }

    .nav-item span {
        display: block;
        font-size: 10px;
        line-height: 1;
        font-weight: 500;
    }
    
    .nav-item svg {
        width: 22px;
        height: 22px;
    }

    .nav-item.active {
        background: transparent;
        color: var(--accent-primary);
        box-shadow: none;
        border-top: 3px solid var(--accent-primary);
        border-radius: 0;
    }
    
    .main-content {
        order: 1;
        height: calc(100vh - 65px); /* Adjust based on sidebar height */
        width: 100%;
    }
    
    .provider-grid {
        grid-template-columns: 1fr;
    }
    
    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .prompt-options {
        flex-wrap: wrap;
    }
    
    .prompt-header h1 {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .prompt-container {
        padding: 1.5rem 1rem;
    }
    
    .templates-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .template-card {
        padding: 0.75rem;
    }
}

/* Theme Toggle Button */
.theme-toggle-btn {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
}

.theme-toggle-btn:hover {
    background: var(--bg-hover);
    transform: rotate(15deg);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* =====================================================
   TEMPLATE SELECTION MODAL (UPDATED)
   ===================================================== */

.template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 Columns as requested */
    gap: 1rem;
}

.template-card-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center; /* Align icon and text horizontally */
    gap: 1rem;
}

.template-card-select:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.template-icon-large {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.template-card-select:hover .template-icon-large {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.template-icon-large svg {
    width: 24px;
    height: 24px;
}

.template-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.template-card-select h4 {
    font-size: 0.9375rem; /* Small but readable */
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.template-card-select p {
    font-size: 0.75rem; /* Small text as requested */
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

@media (max-width: 640px) {
    .template-grid {
        grid-template-columns: 1fr; /* Stack on mobile */
    }
}



/* Shake Animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

/* FAQ Styles */
.faq-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem 0;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.2s;
}

.faq-question:hover {
    color: var(--text-primary);
}

.faq-icon {
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
    transition: transform 0.3s ease;
}

.faq-answer {
    display: none;
    padding-top: 0.5rem;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* FAQ Answer Content Styling */
.faq-answer strong {
    color: var(--text-primary);
    font-weight: 600;
}

.faq-answer code {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-primary);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: var(--font-mono);
}

.faq-answer pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    overflow-x: auto;
    margin: 0.75rem 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.faq-answer pre code {
    background: none;
    padding: 0;
    color: var(--text-secondary);
}

.faq-answer em {
    color: var(--accent-secondary);
    font-style: italic;
}

.faq-answer ul {
    list-style: none;
    padding-left: 0;
    margin: 0.5rem 0;
}

.faq-answer ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.25rem;
}

.faq-answer ul li::before {
    content: "•";
    position: absolute;
    left: 0.5rem;
    color: var(--accent-primary);
    font-weight: bold;
}

/* Emoji icons in FAQ */
.faq-question span:first-child {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Large modal variant for FAQ */
.modal-content.large {
    max-width: 1100px;
    max-height: 85vh;
}

.modal-content.large .modal-body {
    overflow-y: auto;
    max-height: calc(85vh - 100px);
}

.faq-item.active .faq-answer {
    display: block !important;
    animation: fadeIn 0.3s ease;
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
}

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

/* =====================================================
   SIDEBAR TOGGLE & COLLAPSED STATE
   ===================================================== */

.sidebar {
    transition: width 0.3s ease;
    position: relative;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Ensure header content fits */
}

.sidebar-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.sidebar-toggle-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

/* Collapsed Sidebar Styles */
.sidebar.collapsed {
    width: 80px; /* Reduced width */
}

.sidebar.collapsed .logo-text {
    display: none; /* Hide logo text */
}

.sidebar.collapsed .nav-item span {
    display: none; /* Hide nav labels */
}

.sidebar.collapsed .nav-item {
    justify-content: center; /* Center icons */
    padding-left: 0;
    padding-right: 0;
}

.sidebar.collapsed .footer-content {
    display: none; /* Hide footer info text */
}

.sidebar.collapsed .sidebar-footer {
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sidebar.collapsed .sidebar-header {
    padding: 1rem 0.5rem;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.sidebar.collapsed .logo {
    justify-content: center;
    margin-right: 0;
    width: 100%;
}

.sidebar.collapsed .sidebar-toggle-btn svg {
    transform: rotate(180deg); /* Flip arrow */
}

/* Adjust toggle button in footer */
.sidebar-footer .sidebar-toggle-btn {
    width: 100%;
    height: 32px;
    margin-bottom: 1rem;
    border-color: var(--border-color);
}

.sidebar.collapsed .sidebar-footer .sidebar-toggle-btn {
    width: 32px; /* Square when collapsed */
    margin-bottom: 0;
}

/* FAQ Grid Layout */
.faq-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.faq-column h3 {
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .faq-grid {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }
}

