/* Generator page: Dark Chat Flow */

/* AI Hero / Bolt Style Section */
.bolt-hero-section {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 950; /* Above regular content */
    overflow: hidden;
    padding: 20px;
    opacity: 1; /* Visible by default to prevent flash */
    pointer-events: auto;
    transition: opacity 0.4s ease;
}

.bolt-hero-section.active {
    opacity: 1;
    pointer-events: auto;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

/* Fixed Menu Button for Generator Page */
.fixed-menu-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    width: 42px;
    height: 42px;
    padding: 0;
    background: var(--surface);
    border-radius: 10px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.fixed-menu-btn span {
    width: 18px;
    height: 2px;
    background-color: var(--text);
    border-radius: 1px;
    transition: all 0.25s ease;
    display: block;
}

.fixed-menu-btn:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.08);
}

.fixed-menu-btn:hover span {
    background-color: var(--primary);
}

/* Ray Background Effects */
.bolt-ray-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.ray-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(20, 136, 252, 0.15) 0%, rgba(20, 136, 252, 0.05) 30%, transparent 70%);
}

[data-theme="light"] .ray-center {
    background: radial-gradient(circle at center, rgba(79, 70, 229, 0.08) 0%, rgba(79, 70, 229, 0.02) 40%, transparent 70%);
}



/* Content */
.bolt-content {
    position: relative;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 700px;
    text-align: center;
    height: 100%; /* Fill height to allow sticky bottom input */
    justify-content: center; /* Center initially */
    padding-bottom: 20px;
}

.bolt-badge {
    margin-bottom: 24px;
}
.bolt-badge .logo {
    color: var(--text) !important;
}

.bolt-badge-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.bolt-title {
    font-family: "Plus Jakarta Sans", "DM Sans", system-ui, sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 32px;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.text-gradient {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Input Area */
.bolt-input-wrapper {
    width: 100%;
    position: relative;
    margin-bottom: 24px;
}

.bolt-input-glow {
    position: absolute;
    inset: -1px;
    background: linear-gradient(180deg, rgba(255,255,255,0.1), transparent);
    border-radius: 20px;
    pointer-events: none;
}

.bolt-input-box {
    position: relative;
    background: var(--input-bg);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: box-shadow 0.2s;
}

.bolt-input-box:focus-within {
    box-shadow: 0 0 0 1px var(--primary-glow), 0 8px 32px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

#aiHeroInput {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: "DM Sans", "Inter", sans-serif;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: -0.005em;
    line-height: 1.6;
    resize: none;
    outline: none;
    min-height: 60px;
}

#aiHeroInput::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

.bolt-input-footer {
    display: flex;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 14px;
    gap: 10px;
}

.bolt-credits {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted, #94a3b8);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: none !important;
    margin-left: auto;
    margin-right: 8px;
    white-space: nowrap;
}

.bolt-icon-small {
    color: #f59e0b;
    font-size: 12px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.bolt-send-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px 24px;
    border-radius: 999px;
    font-family: "DM Sans", "Inter", sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.bolt-send-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.bolt-send-btn:hover::before {
    opacity: 1;
}

.bolt-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.5);
    border-color: rgba(255,255,255,0.25);
}

.bolt-send-btn:active {
    transform: scale(0.98);
}

/* Footer Link */
.bolt-footer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.muted-text {
    color: #71717a;
}

.bolt-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.bolt-link-btn:hover {
    background: var(--glass-border);
    color: var(--text);
    border-color: var(--text);
}

@media (max-width: 768px) {
    .bolt-title {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    .bolt-input-box {
        padding: 12px;
    }
    
    .bolt-hero-section {
        padding: 10px;
    }
}

.wizard-wrapper {
    padding: 0;
}



/* CHAT INTERFACE STYLES */

.chat-interface-wrapper {
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
    /* Hide scrollbar */
    scrollbar-width: none; 
}

.chat-interface-wrapper::-webkit-scrollbar { 
    display: none; 
}

.chat-history {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 85%;
    animation: slideUpFade 0.3s ease-out;
}

.chat-message.ai {
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-bubble {
    padding: 16px 20px;
    border-radius: 18px;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: -0.005em;
    position: relative;
    word-wrap: break-word;
}

.chat-message.ai .chat-bubble {
    background: var(--bubble-ai-bg);
    color: var(--bubble-ai-text);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
}

.chat-message.user .chat-bubble {
    background: var(--primary);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.chat-sender {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* AI Typing Dot Animation */
.typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Niche Options Chips */
.chat-options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.chat-option-chip {
    padding: 8px 16px;
    background: var(--chip-bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--chip-text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-option-chip:hover {
    background: var(--chip-hover);
    border-color: var(--border);
    color: var(--text);
    transform: translateY(-1px);
}

/* Chat Input States UI */
.chat-input-ui {
    width: 100%;
    animation: fadeIn 0.3s ease;
}

.chat-input-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chat-select {
    width: 100%;
    padding: 18px 20px;
    background-color: var(--input-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a78bfa' 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 20px center;
    background-size: 18px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.chat-select:hover {
    background-color: var(--surface-highlight);
    border-color: var(--border);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.chat-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow), 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    background-color: var(--input-bg);
}

.chat-select option {
    background-color: var(--bg);
    color: var(--text);
    padding: 12px;
}

.chat-actions-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.btn-chat-back {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-chat-back:hover {
    color: var(--text);
    border-color: var(--text);
}

.btn-chat-confirm {
    padding: 12px 28px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-chat-confirm::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.btn-chat-confirm:hover::before {
    opacity: 1;
}

.btn-chat-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.5);
    border-color: rgba(255,255,255,0.25);
}

.objective-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 8px;
}

.objective-option {
    padding: 12px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    user-select: none;
}

.objective-option:hover {
    background: var(--surface-highlight);
    border-color: var(--primary);
}

.objective-option.selected {
    background: rgba(124, 58, 237, 0.15);
    border-color: #7c3aed;
    color: #a78bfa;
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.1);
}

.simple-btn-group {
    display: flex;
    gap: 12px;
    width: 100%;
}

.simple-btn-option {
    flex: 1;
    padding: 14px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.simple-btn-option:hover {
    background: var(--surface-highlight);
    border-color: var(--text);
}

.simple-btn-option.primary {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: #c4b5fd;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.simple-btn-option.primary::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.simple-btn-option.primary:hover {
    border-color: rgba(139, 92, 246, 0.6);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
}

.simple-btn-option.primary:hover::before {
    opacity: 1;
}

/* Attached Video Card in Chat */
.attached-video-bubble {
    padding: 6px !important;
    background: transparent !important;
    box-shadow: none !important;
    max-width: 100%;
}

.attached-video-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    min-width: 240px;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.attached-video-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.att-video-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}

.att-video-thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.att-video-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.att-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--primary);
    font-weight: 700;
}

.att-title {
    font-size: 14px;
    color: var(--text);
    line-height: 1.2;
}

.att-meta {
    font-size: 11px;
    color: var(--muted);
}

/* Transition to Chat Mode */
body.chat-active .bolt-hero-section {
    padding-top: 20px;
    justify-content: flex-start;
}

body.chat-active .bolt-title,
body.chat-active #heroLibraryLink {
    display: none;
}

body.chat-active .bolt-input-wrapper {
    /* Sticky bottom input behavior */
    margin-top: auto; 
}

/* Theme-aware Result Card */
[data-theme="dark"] .result-card {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.1);
}

.result-header {
    background: var(--surface-highlight);
    border-bottom: 1px solid var(--border);
}

.editor-wrapper {
    background: transparent;
}

.script-editor-rich {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .script-editor-rich {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

.result-footer {
    background: var(--surface-highlight);
    border-top: 1px solid var(--border);
}

.script-title {
    color: var(--primary);
}
[data-theme="dark"] .script-title {
    color: #a78bfa;
}

/* Version History Bar */
.version-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    margin: 0 16px;
    border-bottom: 1px solid var(--border);
}
.version-bar.hidden { display: none; }
.version-pills {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.version-pills::-webkit-scrollbar { display: none; }
.version-pill {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-family: inherit;
}
.version-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
}
.version-pill.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.version-pill .version-tag {
    font-size: 9px;
    font-weight: 700;
    opacity: 0.7;
    margin-left: 4px;
    text-transform: uppercase;
}
.version-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-family: inherit;
}
.version-arrow:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
}
.version-arrow:disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}
[data-theme="dark"] .version-pill {
    border-color: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
}
[data-theme="dark"] .version-pill:hover {
    border-color: #a78bfa;
    color: #a78bfa;
    background: rgba(167,139,250,0.08);
}
[data-theme="dark"] .version-pill.active {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}
[data-theme="dark"] .version-arrow {
    border-color: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
}
[data-theme="dark"] .version-arrow:hover {
    border-color: #a78bfa;
    color: #a78bfa;
}

.script-section {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.2);
    color: var(--primary);
}
[data-theme="dark"] .script-section {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: #c4b5fd;
}

.script-kv .k {
    color: var(--primary);
}
[data-theme="dark"] .script-kv .k {
    color: #c4b5fd;
}

.script-kv .v {
    color: var(--text);
}

.input-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding-right: 4px;
}

.mt-4 { margin-top: 16px; }

/* Animation Utils */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 768px) {
    /* Optimize output width on mobile */
    .output-section {
        padding: 0;
        width: 100%;
        margin-top: 8px;
        display: block;
    }
    
    .result-card {
        border-radius: 16px;
        overflow: hidden;
    }
    
    .result-header {
        padding: 12px 14px;
    }
    
    /* Remove wrapper padding to maximize width on mobile */
    .editor-wrapper {
        padding: 0;
    }

    .script-title {
        padding: 16px 16px 0 16px;
        font-size: 16px;
        margin-bottom: 8px;
    }

    /* Seamless editor look on mobile - removes 'box in a box' */
    .script-editor-rich {
        padding: 0 16px 16px 16px;
        font-size: 15px;
        min-height: 200px;
        border: none;
        border-radius: 0;
        background: transparent !important;
        box-shadow: none;
    }
    
    /* Stack footer actions nicely */
    .result-footer {
        padding: 12px 14px;
        flex-direction: column;
        gap: 12px;
    }

    .footer-actions-left {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .footer-actions-left button {
        width: 100%;
        justify-content: center;
    }
    
    .action-btn-primary {
        width: 100%;
        justify-content: center;
        padding: 14px;
    }
    
    .footer-info {
        justify-content: center;
        text-align: center;
    }

    /* Legacy Wizard styles (if still used) */
    .wizard-header {
        padding: 16px 20px;
    }
    
    .wizard-content-container {
        padding: 20px;
        align-items: flex-start;
    }
    
    .wizard-controls {
        padding: 16px 20px;
    }
    
    .step-label {
        font-size: 20px;
    }
    
    .step-description {
        font-size: 14px;
        margin-bottom: 24px;
    }
    
    .input-group.large-input input, 
    .wizard-select {
        font-size: 16px;
        padding: 16px;
    }
}

/* Legacy Overrides needed for removal */
.section-header, 
.section-header-right,
.library-nav-btn {
   /* These classes are now handled differently or reused carefully */
}


.section-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.library-nav-btn {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-highlight);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: all 0.16s ease-out;
}

.library-nav-btn:hover {
    border-color: var(--primary);
    color: var(--text);
    background: rgba(139, 92, 246, 0.1);
}

.section-header label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header label::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.generator-split-layout {
    display: block;
    width: 100%;
}

.primary-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.selected-script-card {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius);
    padding: 16px;
    position: relative;
    font-size: 13px;
    color: #6ee7b7;
    animation: fadeIn 0.3s ease;
}

.selected-script-card.default-state {
    background: var(--surface-highlight);
    border-color: var(--border);
    color: var(--muted);
}

.selected-script-card h4 {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.selected-script-card.default-state h4 {
    color: var(--text);
}

.selected-script-card p {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
    color: inherit;
    font-weight: 400;
    opacity: 0.9;
}

.selected-script-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.script-tag {
    background: #dcfce7;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid #bbf7d0;
}

.selected-script-card.default-state .script-tag {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #475569;
}

.remove-script-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #15803d;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    font-size: 16px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.remove-script-btn:hover {
    opacity: 1;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group.full-width {
    grid-column: 1 / -1;
}

.input-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.input-group input, 
.input-group select, 
.input-group textarea {
    padding: 14px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease-out;
    width: 100%;
}

.input-group input:focus, 
.input-group select:focus, 
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--input-bg);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

.input-group select.hidden {
    display: none;
}

.custom-niche-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.custom-niche-container.hidden {
    display: none;
}

.reset-niche-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: var(--surface-highlight);
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.16s ease-out;
}

.reset-niche-btn:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.input-group textarea {
    resize: vertical;
    line-height: 1.5;
    min-height: 80px;
}

/* Legacy styles kept if needed for reference, but overrides above handle the new structure */

.advanced-mode-section {
    margin-bottom: 20px;
}

.advanced-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 14px 16px;
    background: var(--surface-highlight);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s ease-out;
}

.advanced-toggle:hover {
    border-color: var(--primary);
    filter: brightness(1.05);
}

.advanced-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

.toggle-hint {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

.advanced-fields {
    margin-top: 12px;
    padding: 24px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    animation: slideDown 0.2s ease-out;
}

.advanced-fields.hidden {
    display: none;
}

.advanced-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.advanced-field.full-width {
    grid-column: 1 / -1;
}

.advanced-field label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.char-count {
    font-size: 11px;
    color: var(--muted);
    opacity: 0.7;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
}

.advanced-field input[type="text"],
.advanced-field textarea,
.advanced-field select {
    padding: 12px 14px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease-out;
}

.advanced-field input[type="text"]:focus,
.advanced-field textarea:focus,
.advanced-field select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--input-bg);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.advanced-field textarea {
    resize: none;
    line-height: 1.5;
}

.advanced-field input[type="text"]::placeholder {
    color: #9ca3af;
}

.advanced-field select {
    cursor: pointer;
}

.objective-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.checkbox-chip {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.checkbox-chip input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-chip span {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    transition: all 0.2s ease-out;
}

.checkbox-chip:hover span {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text);
}

.checkbox-chip input:checked + span {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.link-bio-field.hidden {
    display: none;
}

/* Web Search Toggle */
.web-search-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.web-search-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
}
.web-search-toggle.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}
.web-search-toggle.active:hover {
    background: var(--primary-hover, #4f46e5);
}
.web-search-toggle svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.output-section {
    padding: 0 32px 32px 32px;
    margin-top: 0;
    animation: slideUpFade 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.output-section.hidden {
    display: none;
}

.result-card {
    background: var(--surface);
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: 
        0 20px 40px -10px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(139, 92, 246, 0.1); /* Primary hint */
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.result-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    opacity: 0.8;
    z-index: 2;
}

@keyframes gradientMove {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.result-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
}

.sparkle-icon {
    font-size: 12px;
}

.result-status {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.editor-wrapper {
    background: var(--surface);
    position: relative;
    padding: 28px 32px 32px;
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.script-title {
    font-family: "Plus Jakarta Sans", "DM Sans", system-ui, sans-serif;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.03em;
    color: var(--primary);
    margin-bottom: 16px;
    text-align: left;
    padding-left: 32px;
}

/* Rich Editor (Visual) */
.script-editor-rich {
    width: 100%;
    min-height: 350px;
    padding: 36px 32px;
    font-family: "DM Sans", "Inter", system-ui, sans-serif;
    font-size: 17.5px;
    font-weight: 500;
    letter-spacing: -0.005em;
    line-height: 1.85;
    color: var(--text);
    outline: none;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    background-image: linear-gradient(to bottom right, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0));
    box-shadow: var(--shadow);
    overflow-wrap: break-word;
    word-wrap: break-word;
    transition: text-shadow 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    text-align: left;
}

.script-editor-rich p,
.script-editor-rich div {
    margin-bottom: 1em;
}

.script-editor-rich p:last-child,
.script-editor-rich div:last-child {
    margin-bottom: 0;
}

[data-theme="dark"] .script-editor-rich {
    background: var(--surface-highlight);
    background-image: none;
    border-color: var(--border);
    color: #e8e9f0;
}

[data-theme="dark"] .editor-wrapper {
    background: var(--surface);
    border-color: var(--border);
}

/* AI Typewriter Cursor */
.ai-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background-color: var(--primary);
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: blink 0.8s step-end infinite;
    box-shadow: 0 0 8px var(--primary);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.script-editor-rich.typing-active {
    pointer-events: none; /* Disable interaction while typing */
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.1), 0 10px 30px -10px rgba(139, 92, 246, 0.15);
}

.script-editor-rich:focus {
    border-color: rgba(139,92,246,0.35);
    box-shadow: 0 0 0 4px rgba(139,92,246,0.10);
    background: var(--surface-highlight);
}

/* Hidden Textarea (Plain Text Source of Truth) */
.script-editor-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

/* Section Badges (e.g., [GANCHO], [CORPO], [CTA]) */
.script-section {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "Plus Jakarta Sans", "Inter", sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
    background: rgba(139,92,246,0.10);
    border: 1px solid rgba(139,92,246,0.22);
    padding: 6px 12px;
    border-radius: 999px;
    margin: 16px 0 10px 0;
    white-space: nowrap;
}

[data-theme="dark"] .script-section {
    background: rgba(139,92,246,0.15);
    border-color: rgba(139,92,246,0.3);
}

/* Key-Value pairs (e.g., TEMA:, NICHO:) */
.script-kv {
    display: flex;
    gap: 8px;
    margin: 12px 0;
    align-items: baseline;
}

.script-kv .k {
    font-family: "Plus Jakarta Sans", "Inter", sans-serif;
    font-weight: 700;
    color: rgba(139,92,246,0.95);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 12px;
    flex-shrink: 0;
}

[data-theme="dark"] .script-kv .k {
    color: rgba(167,139,250,0.95);
}

.script-kv .v {
    font-weight: 500;
    color: var(--text);
    flex: 1;
}

/* Preserve line breaks and spacing */
.script-editor-rich br {
    display: block;
    content: "";
    margin: 0.4em 0;
}

.script-editor-rich p {
    margin: 0.6em 0;
}

.script-editor-rich div {
    margin: 0;
}

.result-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface-highlight);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

/* AI Disclaimer */
.ai-disclaimer {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    padding: 16px 24px 0;
    line-height: 1.4;
    opacity: 0.7;
}

/* Big New Script Button */
.new-script-btn-big {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    margin-top: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-family: "DM Sans", "Inter", sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
}
.new-script-btn-big:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.35);
}
.new-script-btn-big:active {
    transform: translateY(0);
}
.new-script-btn-big svg {
    flex-shrink: 0;
}

.footer-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}

.info-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 10px;
}

.action-btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--text); /* Black on light, White on dark */
    color: var(--bg);
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.action-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.action-btn-primary:active {
    transform: translateY(0);
}

.action-btn-primary.success {
    background: #10b981;
    color: #ffffff;
    pointer-events: none;
}

.action-btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--surface-highlight);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn-secondary:hover {
    background: var(--input-bg);
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.footer-actions-left {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* AI Loading States */
@keyframes pulse-soft {
    0% { opacity: 0.6; transform: scale(0.98); }
    50% { opacity: 1; transform: scale(1); }
    100% { opacity: 0.6; transform: scale(0.98); }
}

.ai-choosing-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 200px;
    background: var(--surface-highlight);
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    padding: 24px;
    gap: 16px;
    animation: pulse-soft 2s infinite ease-in-out;
}

.ai-loader-icon {
    font-size: 32px;
}

.ai-loader-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.5;
    max-width: 90%;
}

.ai-generation-loader {
    padding: 48px 24px;
    text-align: center;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    animation: fadeIn 0.3s ease-out;
}

.ai-generation-loader.hidden {
    display: none;
}

.ai-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(139, 92, 246, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 8px;
}

.ai-generation-loader h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.ai-generation-loader p {
    color: var(--muted);
    font-size: 14px;
    margin: 0;
}

/* Selected Structure Card (Modo Manual) Styles */
.video-card.selected-structure-card {
    border: 1px solid rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.06); /* Subtle tint that works on both dark/light */
    position: relative;
    cursor: default;
    transition: all 0.2s ease;
}

[data-theme="dark"] .video-card.selected-structure-card {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

.video-card.selected-structure-card:hover {
    transform: none;
    box-shadow: none;
    background: rgba(16, 185, 129, 0.08);
}

[data-theme="dark"] .video-card.selected-structure-card:hover {
    background: rgba(16, 185, 129, 0.12);
}

.selected-structure-card .remove-script-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: var(--surface-highlight);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    opacity: 0.8;
    z-index: 5;
    padding: 0;
}

.selected-structure-card .remove-script-btn:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
    opacity: 1;
}

.selected-structure-card .video-header {
    padding-right: 36px;
}

.selected-card-title {
    font-size: 15px;
    margin-top: 8px;
    color: var(--text); /* Automatically adjusts to dark/light theme */
}

.selected-card-desc {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 16px;
    line-height: 1.5;
}

.selected-structure-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed rgba(16, 185, 129, 0.3);
    color: #10b981; /* Emerald 500 */
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.05em;
}

[data-theme="dark"] .selected-structure-footer {
    color: #34d399; /* Emerald 400 for dark mode */
}

/* History Section */
.history-section {
    margin-top: 32px;
    padding: 20px 18px;
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.history-section.hidden {
    display: none;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.history-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.clear-history-btn {
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
}

.clear-history-btn:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.history-item {
    background: var(--surface-highlight);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.16s ease;
}

.history-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.history-item-date {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
}

.history-item-title, .history-theme {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.3;
}

.history-item-preview {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.history-item-meta {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.history-meta-tag {
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    color: #4b5563;
    text-transform: uppercase;
}

/* Label with Info Icon */
.label-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.label-with-icon label {
    margin-bottom: 0;
}

.info-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    border: none;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.info-icon:hover {
    background: #111827;
    color: #fff;
    transform: scale(1.1);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2200; /* Ensure it stays above mobile viewer (1900) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--surface);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(10px);
    transition: transform 0.2s ease, background-color 0.2s ease;
    color: var(--text);
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-highlight);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal-btn:hover {
    color: var(--text);
}

.modal-content {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hook-item {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.hook-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.hook-item h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.hook-item p {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 2px;
}

.hook-item .ex {
    color: var(--muted);
    font-style: italic;
    opacity: 0.8;
}

.modal-content textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
}
.modal-content textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
.modal-content .char-count {
    color: var(--muted);
}


.bolt-actions-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

.bolt-site-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.bolt-site-toggle-btn:hover,
.bolt-site-toggle-btn[aria-expanded="true"] {
    border-color: rgba(99, 102, 241, 0.55);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.15);
}

.bolt-site-url-wrapper {
    position: relative;
    width: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: width 0.25s ease, opacity 0.2s ease;
}

.bolt-site-url-wrapper.is-open {
    width: min(360px, 38vw);
    opacity: 1;
    pointer-events: auto;
}

.bolt-site-url-input {
    width: 100%;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    padding: 0 14px;
    outline: none;
    font-size: 14px;
}

.bolt-site-url-input:focus {
    border-color: rgba(99, 102, 241, 0.7);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.18);
}

.bolt-site-url-hint {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 8px;
    right: 8px;
    z-index: 5;
    padding: 9px 11px;
    border-radius: 12px;
    background: rgba(17, 24, 39, 0.96);
    border: 1px solid rgba(255,255,255,0.08);
    color: #d4d4d8;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
}

.bolt-site-url-input:focus + .bolt-site-url-hint {
    display: block;
}

@media (max-width: 920px) {
    .bolt-input-footer {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
    }

    /* Pesquisa Web toggle: stays left, order 1 */
    .bolt-input-footer > .web-search-toggle {
        order: 1;
    }

    /* Criar button: goes right, order 2 */
    .bolt-input-footer > .bolt-send-btn {
        order: 2;
        margin-left: auto;
    }

    /* Credits: new row below, pill matching Pesquisa Web exactly */
    .bolt-input-footer > .bolt-credits {
        order: 3 !important;
        flex-basis: 100% !important;
        display: inline-flex !important;
        align-items: center !important;
        width: auto !important;
        max-width: fit-content !important;
        margin: 0 !important;
        padding: 6px 14px !important;
        height: auto !important;
        border-radius: 999px !important;
        border: 1px solid var(--border) !important;
        background: var(--surface, rgba(255,255,255,0.04)) !important;
        color: var(--muted, #94a3b8) !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        font-family: inherit !important;
        gap: 6px !important;
        letter-spacing: 0 !important;
        text-transform: none !important;
        white-space: nowrap !important;
        line-height: 1 !important;
        box-shadow: none !important;
    }

    /* Emoji icon: force same visual size as SVG 16px in web-search-toggle */
    .bolt-input-footer > .bolt-credits .bolt-icon-small {
        font-size: 14px !important;
        line-height: 1 !important;
        display: inline-flex !important;
        align-items: center !important;
        width: 16px !important;
        height: 16px !important;
        justify-content: center !important;
    }

    /* Web search toggle active: outline only on mobile */
    .web-search-toggle.active {
        background: transparent !important;
        color: var(--primary) !important;
        border-color: var(--primary) !important;
        box-shadow: none !important;
    }
    .web-search-toggle.active:hover {
        background: rgba(99, 102, 241, 0.06) !important;
    }

    .bolt-site-url-wrapper.is-open {
        order: 4;
        width: 100%;
    }
}