/* 
   DUAL THEME DESIGN SYSTEM
   Professional ProVision AI Branding
*/

:root {
    /* Light Theme (Default) */
    --bg-main: #f9fafb;
    --bg-white: #ffffff;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --text-main: #111827;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --border: #e5e7eb;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --input-focus: rgba(79, 70, 229, 0.1);

    --transition: all 0.3s ease;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-main: #0f172a;
    --bg-white: #1e293b;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --border: #334155;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --input-focus: rgba(99, 102, 241, 0.2);
}

body,
.app-container,
.side-nav,
.main-content,
.section-card,
.rail-card {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    height: 100vh;
    overflow: hidden;
}

h1,
h2,
h3,
h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Side Navigation */
.side-nav {
    width: 280px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
    padding: 0 8px;
}

.logo-box {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    background: transparent;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.menu-item:hover {
    background: var(--bg-main);
    color: var(--text-main);
}

.menu-item.active {
    background: var(--input-focus);
    color: var(--primary);
}

.nav-bottom {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-footer-links {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
}

.nav-footer-links button {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-footer-links button:hover {
    color: var(--primary);
}

.nav-footer-links .dot {
    color: var(--border);
    font-size: 0.75rem;
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-placeholder {
    width: 36px;
    height: 36px;
    background: var(--text-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--bg-white);
    font-size: 0.8rem;
}

.p-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.p-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-header {
    height: 80px;
    background: var(--bg-white);
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.top-header h2 {
    font-size: 1.5rem;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.trending-badge {
    background: var(--input-focus);
    color: var(--primary);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-dot {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}

.btn-theme-toggle {
    background: var(--bg-main);
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}

/* Studio View Grid */
.studio-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
}

.section-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 32px;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    margin-bottom: 40px;
}

.card-header h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

.card-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    opacity: 0.9;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.field-box label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.field-box select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    outline: none;
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 0.9rem;
    transition: var(--transition);
}

.field-box select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--input-focus);
}

/* AI Prompt Enhancer Field */
.field-ai-enhance {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field-ai-enhance textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    outline: none;
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    resize: vertical;
    transition: var(--transition);
}

.field-ai-enhance textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--input-focus);
}

.btn-enhance {
    align-self: flex-start;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-enhance:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
}

.result-container {
    background: var(--bg-main);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border);
}

#output-text {
    width: 100%;
    height: 100px;
    background: transparent;
    border: none;
    resize: none;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-main);
}

.button-row {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
}

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

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

.btn-secondary {
    background: var(--bg-white);
    border-color: var(--border);
    color: var(--text-main);
}

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

/* Discovery Feed */
.discovery-page {
    padding-bottom: 40px;
}

.preview-header {
    margin-top: 40px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-icon {
    background: var(--bg-main);
    border: 1px solid var(--border);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.link-text {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

.card-item {
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.card-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.card-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.card-content {
    padding: 16px;
}

.card-content h5 {
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.card-content p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Utility Rail */
.utility-rail {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.rail-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
}

.rail-card h4 {
    font-size: 0.9rem;
    margin-bottom: 16px;
    color: var(--text-muted);
}

/* Ad Unit Styles */
.ad-unit {
    padding: 12px;
    background: var(--bg-main);
    border: 1px dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ad-placeholder-sidebar {
    width: 100%;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.ad-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-light);
    letter-spacing: 1px;
}

.ad-mock-up {
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.8rem;
    opacity: 0.6;
}

.ad-banner-top {
    width: 100%;
    min-height: 90px;
    max-height: 120px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px dashed var(--border);
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow: hidden;
}

.ad-mock-banner {
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0.6;
}

/* Pro Options Styles */
.field-box.full-width {
    grid-column: span 2;
    margin-top: 8px;
}

.btn-toggle-pro {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(79, 70, 229, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-toggle-pro:hover {
    background: rgba(79, 70, 229, 0.1);
}

.pro-options-grid {
    display: none;
    padding: 20px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    animation: slideDown 0.3s ease-out;
}

.pro-options-grid.active {
    display: block;
}

.pro-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 16px;
    margin-top: 16px;
}

#neg-prompt {
    width: 100%;
    height: 60px;
    padding: 12px;
    font-size: 0.85rem;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    resize: none;
    color: var(--text-main);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Remix Button */
.btn-remix {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Guide Section Styles */
.guide-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.pro-guide {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-sm);
}

.guide-header {
    text-align: center;
    margin-bottom: 40px;
    border-bottom: 2px solid var(--bg-main);
    padding-bottom: 30px;
}

.guide-header .badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    display: inline-block;
}

.guide-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    color: var(--text-main);
    margin-bottom: 12px;
}

.guide-content h3 {
    margin: 32px 0 16px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.guide-content p {
    line-height: 1.7;
    color: var(--text-light);
    margin-bottom: 16px;
}

.structure-card {
    background: var(--bg-main);
    padding: 16px;
    border-radius: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--primary);
    border-left: 4px solid var(--primary);
}

.content-ad {
    margin-top: 40px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    overflow: hidden;
    animation: modalPop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content header {
    padding: 20px 24px;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.modal-body {
    padding: 24px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-light);
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.item-list {
    min-height: 100px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-list {
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: center;
    margin-top: 40px;
}

.saved-bubble {
    background: var(--bg-main);
    padding: 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    line-height: 1.4;
    border: 1px solid var(--border);
    color: var(--text-main);
}

/* Toast */
.toast-system {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    z-index: 2000;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.hidden {
    display: none !important;
}

.view-panel {
    display: none;
}

.view-panel.active {
    display: block;
}

/* Image Prompt Modal */
.prompt-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

.modal-header h3 {
    font-size: 1.2rem;
    color: var(--text-main);
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
}

.modal-body {
    padding: 32px;
}

.modal-img {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 24px;
}

.prompt-display {
    background: var(--bg-main);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.prompt-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.prompt-text {
    color: var(--text-main);
    line-height: 1.6;
    font-size: 0.95rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

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

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.card-item {
    cursor: pointer;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}