/* ============================================
   PAGE SECTIONS & NAVIGATION
   ============================================ */

.page-section {
    display: none;
}

/* Higher specificity ensures inactive sections stay hidden even if other classes set display */
.page-section:not(.active) {
    display: none;
}

.page-section.active {
    display: block;
}

/* Code/Dev Cockpit page: fill height so file tree can scroll */
#page-code.page-section.active {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Train page: fill height, no padding, dark background */
#page-train.page-section.active {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 !important;
}

/* Code page: remove creator-area padding/max-width so editor fills full width */
.creator-area:has(#page-code.active) {
    padding: 0;
    max-width: 100%;
    margin: 0;
    width: 100%;
    overflow: hidden;
}

/* Train page: same treatment as Code page */
.creator-area:has(#page-train.active) {
    padding: 0;
    max-width: 100%;
    margin: 0;
    width: 100%;
    overflow: hidden;
}

/* Book page: fill viewport like Code/Train pages */
#page-book.page-section.active {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.creator-area:has(#page-book.active) {
    padding: 0 48px 0 48px;
    max-width: 100%;
    margin: 0;
    width: 100%;
    overflow: hidden;
}

/* All content pages: fill available width */
#page-home.page-section.active,
#page-video.page-section.active,
#page-image.page-section.active,
#page-voiceover.page-section.active,
#page-music.page-section.active,
#page-enhance.page-section.active,
#page-assets.page-section.active,
#page-envato-music.page-section.active,
#page-envato-sfx.page-section.active,
#page-prompt.page-section.active,
#page-marketing.page-section.active {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.creator-area:has(#page-home.active),
.creator-area:has(#page-video.active),
.creator-area:has(#page-image.active),
.creator-area:has(#page-voiceover.active),
.creator-area:has(#page-music.active),
.creator-area:has(#page-enhance.active),
.creator-area:has(#page-assets.active),
.creator-area:has(#page-envato-music.active),
.creator-area:has(#page-envato-sfx.active),
.creator-area:has(#page-prompt.active),
.creator-area:has(#page-marketing.active) {
    padding: 0 48px;
    max-width: 100%;
    margin: 0;
    width: 100%;
}

@media (max-width: 768px) {
    .creator-area:has(#page-code.active) {
        padding: 0;
    }
    .creator-area:has(#page-train.active) {
        padding: 0;
    }
}

/* Mode spacer */
.mode-spacer {
    flex: 1;
}

/* Enhance Button */
.btn-enhance {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    border: none;
    border-radius: var(--tc-radius-md);
    padding: 8px 16px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-enhance:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.enhance-icon {
    font-size: 1rem;
}

/* ============================================
   AI VOICEOVER PAGE STYLES
   ============================================ */

.voiceover-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(139, 92, 246, 0.05));
    border-radius: var(--tc-radius-xl);
    margin-bottom: 40px;
    backdrop-filter: blur(var(--tc-glass-blur-light));
    border: var(--tc-glass-border);
}

.hero-content {
    max-width: 550px;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
    color: var(--text);
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
}

.btn-hero {
    background: var(--accent);
    border: none;
    border-radius: var(--tc-radius-md);
    padding: 14px 32px;
    color: #000;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-hero:hover {
    background: #d4a00a;
    transform: translateY(-2px);
}

.btn-hero-outline {
    background: transparent;
    border: 2px solid var(--text-muted);
    border-radius: var(--tc-radius-md);
    padding: 12px 28px;
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 12px;
}

.btn-hero-outline:hover {
    border-color: var(--text);
    background: var(--tc-glass-bg-input);
}

.hero-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-wave {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 80px;
}

.voice-wave span {
    width: 8px;
    background: linear-gradient(to top, var(--primary), var(--accent));
    border-radius: 4px;
    animation: voiceWave 1.2s ease-in-out infinite;
}

.voice-wave span:nth-child(1) { height: 30%; animation-delay: 0s; }
.voice-wave span:nth-child(2) { height: 60%; animation-delay: 0.1s; }
.voice-wave span:nth-child(3) { height: 100%; animation-delay: 0.2s; }
.voice-wave span:nth-child(4) { height: 60%; animation-delay: 0.3s; }
.voice-wave span:nth-child(5) { height: 30%; animation-delay: 0.4s; }

@keyframes voiceWave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

/* Voice Type Tabs */
.voice-type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.voice-type-tab {
    background: var(--tc-glass-bg);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    padding: 12px 24px;
    backdrop-filter: blur(var(--tc-glass-blur));
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s;
}

.voice-type-tab:hover {
    background: var(--tc-glass-bg-hover);
    color: var(--text);
}

.voice-type-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Voice Explorer */
.voice-explorer {
    background: var(--tc-glass-bg);
    border-radius: var(--tc-radius-lg);
    padding: 32px;
    border: var(--tc-glass-border);
    backdrop-filter: blur(var(--tc-glass-blur));
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 24px;
}

.voice-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.filter-select {
    background: var(--tc-glass-bg-input);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    padding: 10px 14px;
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 140px;
}

.filter-spacer {
    flex: 1;
}

.btn-clone-voice {
    background: var(--tc-glass-bg-input);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    padding: 10px 20px;
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-clone-voice:hover {
    background: var(--tc-glass-bg-hover);
    border-color: var(--primary);
}

.badge-new {
    background: var(--accent);
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Voice Cards */
.voice-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.voice-card {
    background: var(--tc-glass-bg);
    border: 2px solid transparent;
    border-radius: var(--tc-radius-lg);
    padding: 16px;
    backdrop-filter: blur(var(--tc-glass-blur));
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.voice-card:hover {
    background: var(--tc-glass-bg-hover);
    border-color: rgba(148,163,184,0.12);
}

.voice-card.selected {
    border-color: var(--primary);
    background: rgba(168, 85, 247, 0.1);
}

.voice-avatar {
    width: 48px;
    height: 48px;
    background: rgba(168, 85, 247, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.voice-info {
    flex: 1;
    min-width: 0;
}

.voice-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.voice-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.voice-tags {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.voice-selected {
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-preview {
    width: 40px;
    height: 40px;
    background: var(--tc-glass-bg-hover);
    border: none;
    border-radius: 50%;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

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

/* ============================================
   MUSIC PAGE STYLES
   ============================================ */

.music-hero {
    padding: 60px 40px;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.1), rgba(168, 85, 247, 0.05));
    border-radius: var(--tc-radius-xl);
    margin-bottom: 32px;
    text-align: center;
    backdrop-filter: blur(var(--tc-glass-blur-light));
    border: var(--tc-glass-border);
}

.music-hero .hero-content {
    max-width: 700px;
    margin: 0 auto;
}

.hero-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

/* Brand Logos */
.brand-logos {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 24px 0;
    margin-bottom: 32px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.brand-logos .logos {
    display: flex;
    gap: 32px;
}

.brand {
    font-weight: 600;
    opacity: 0.5;
    font-size: 1.1rem;
}

/* Music Filters */
.music-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px;
    background: var(--tc-glass-bg);
    border-radius: var(--tc-radius-lg);
    border: var(--tc-glass-border);
    backdrop-filter: blur(var(--tc-glass-blur));
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
}

.filter-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.filter-select-small {
    background: var(--tc-glass-bg-input);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    padding: 8px 12px;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-filters {
    background: var(--tc-glass-bg-input);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    padding: 8px 16px;
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-filters:hover {
    background: var(--tc-glass-bg-hover);
}

/* Track List */
.track-list {
    background: var(--tc-glass-bg);
    border-radius: var(--tc-radius-lg);
    border: var(--tc-glass-border);
    overflow: hidden;
    margin-bottom: 100px; /* Space for audio player bar */
    backdrop-filter: blur(var(--tc-glass-blur));
}

.track-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: var(--tc-glass-border);
    transition: background 0.2s;
}

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

.track-item:hover {
    background: var(--tc-glass-bg-input);
}

.track-play {
    width: 40px;
    height: 40px;
    background: var(--tc-glass-bg-input);
    border: none;
    border-radius: 50%;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.track-play:hover {
    background: var(--primary);
    color: white;
}

.track-thumb {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--tc-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.track-info {
    flex: 1;
    min-width: 150px;
}

.track-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.track-artist {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.track-genre {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 120px;
}

.track-duration {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 50px;
    text-align: right;
}

.track-waveform {
    flex: 1;
    max-width: 200px;
    height: 32px;
    background: var(--tc-glass-bg-input);
    border-radius: var(--tc-radius-sm);
    overflow: hidden;
    position: relative;
}

.waveform-bars {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, 
        rgba(168, 85, 247, 0.3) 0%,
        rgba(168, 85, 247, 0.5) 30%,
        rgba(168, 85, 247, 0.3) 100%
    );
}

.track-actions {
    display: flex;
    gap: 8px;
}

.track-actions button {
    width: 36px;
    height: 36px;
    background: transparent;
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.track-actions button:hover {
    background: var(--tc-glass-bg-hover);
    color: var(--text);
}

/* Audio Player Bar (Fixed Bottom) */
.audio-player-bar {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    background: var(--tc-glass-bg-topbar);
    border-top: var(--tc-glass-border);
    padding: 12px 24px;
    backdrop-filter: blur(var(--tc-glass-blur-heavy));
    display: flex;
    align-items: center;
    gap: 24px;
    z-index: 90;
}

.player-track {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.player-thumb {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--tc-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.player-info {
    display: flex;
    flex-direction: column;
}

.player-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.player-artist {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-controls button {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.player-controls .btn-play {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: 50%;
    font-size: 1.2rem;
}

.player-controls .btn-play:hover {
    background: var(--primary-dark);
}

.player-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 500px;
}

.player-progress span {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 40px;
}

.progress-track {
    flex: 1;
    height: 4px;
    background: var(--tc-glass-bg-input);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
}

.progress-track .progress-fill {
    width: 40%;
    height: 100%;
    background: var(--primary);
}

.player-volume {
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-volume button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
}

.player-volume input[type="range"] {
    width: 80px;
    height: 4px;
    accent-color: var(--primary);
}

/* ============================================
   ASSETS PAGE STYLES
   ============================================ */

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

.asset-category {
    background: var(--tc-glass-bg);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    padding: 32px;
    backdrop-filter: blur(var(--tc-glass-blur));
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.asset-category:hover {
    background: var(--tc-glass-bg-hover);
    border-color: rgba(148,163,184,0.12);
    transform: translateY(-4px);
}

.asset-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.asset-category h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.asset-category p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ============================================
   RESPONSIVE - PAGE SECTIONS
   ============================================ */

@media (max-width: 768px) {
    .voiceover-hero,
    .music-hero {
        padding: 40px 24px;
        flex-direction: column;
        text-align: center;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-visual {
        margin-top: 32px;
    }

    .voice-type-tabs {
        justify-content: center;
    }

    .voice-cards {
        grid-template-columns: 1fr;
    }

    .track-waveform,
    .track-genre {
        display: none;
    }

    .audio-player-bar {
        left: 60px;
        flex-wrap: wrap;
        padding: 12px 16px;
    }

    .player-progress {
        order: 3;
        width: 100%;
        max-width: none;
    }

    .player-volume {
        display: none;
    }

    .assets-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .asset-category {
        padding: 20px;
    }

    .asset-icon {
        font-size: 2rem;
    }
}

/* ============================================
   HOME PAGE STYLES
   ============================================ */

.home-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 60px 48px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(234, 179, 8, 0.08));
    border-radius: var(--tc-radius-xl);
    margin-bottom: 48px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(var(--tc-glass-blur-light));
    border: var(--tc-glass-border);
}

.home-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(168, 85, 247, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.home-hero .hero-content {
    max-width: 550px;
    position: relative;
    z-index: 1;
}

.home-hero .hero-title {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 20px;
    color: var(--text);
}

.home-hero .hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 32px;
}

.hero-image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    position: relative;
    z-index: 1;
}

.hero-preview {
    width: 120px;
    height: 120px;
    background: var(--tc-glass-bg);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    backdrop-filter: blur(var(--tc-glass-blur));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    transition: all 0.3s;
}

.hero-preview:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.hero-preview.video {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(168, 85, 247, 0.05));
}

.hero-preview.image {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
}

.hero-preview.voice {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(234, 179, 8, 0.05));
    grid-column: span 2;
    width: 100%;
}

/* Features Section */
.home-features {
    margin-bottom: 48px;
}

.home-features .section-title {
    text-align: center;
    margin-bottom: 32px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--tc-glass-bg);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    padding: 28px;
    backdrop-filter: blur(var(--tc-glass-blur));
    cursor: pointer;
    transition: all 0.3s;
}

.feature-card:hover {
    background: var(--tc-glass-bg-hover);
    border-color: rgba(148,163,184,0.12);
    transform: translateY(-4px);
}

.feature-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
}

.feature-link {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s;
}

.feature-card:hover .feature-link {
    color: var(--accent);
}

/* Credit Cost Badges */
.credit-cost-badge {
    display: inline-block;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    color: #a78bfa;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.credit-cost-badge.free-badge {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.2) 100%);
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.3);
}

.section-credit-cost {
    display: inline-flex;
    align-items: center;
    background: rgba(168, 85, 247, 0.15);
    color: #a78bfa;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(167, 139, 250, 0.25);
}

.section-credit-cost.free-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.25);
}

.page-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.mode-credit-cost {
    display: inline-block;
    background: rgba(168, 85, 247, 0.1);
    color: #818cf8;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}

/* Stats Section */
.home-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    padding: 40px;
    background: var(--tc-glass-bg);
    border-radius: var(--tc-radius-lg);
    border: var(--tc-glass-border);
    backdrop-filter: blur(var(--tc-glass-blur));
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 8px;
}

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

/* Responsive Home Page */
@media (max-width: 900px) {
    .home-hero {
        flex-direction: column;
        text-align: center;
        padding: 40px 24px;
    }

    .home-hero .hero-title {
        font-size: 2rem;
    }

    .home-hero .hero-buttons {
        justify-content: center;
    }

    .hero-image-grid {
        margin-top: 32px;
    }

    .home-stats {
        flex-wrap: wrap;
        gap: 32px;
        padding: 32px 24px;
    }

    .stat-item {
        flex: 1 1 40%;
    }
}

@media (max-width: 480px) {
    .hero-preview {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }

    .stat-number {
        font-size: 1.75rem;
    }
}

/* ---- Expanded Home Page Sections ---- */

.home-section {
    margin-bottom: 48px;
}

.home-section .section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.section-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

.features-grid-2col {
    grid-template-columns: repeat(2, 1fr) !important;
}

/* Hero capability badges (2x2 grid) */
.hero-capabilities-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    position: relative;
    z-index: 1;
}

.hero-cap-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 130px;
    height: 110px;
    background: var(--tc-glass-bg);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    backdrop-filter: blur(var(--tc-glass-blur));
    transition: all 0.3s;
}

.hero-cap-badge:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.cap-icon {
    font-size: 2.4rem;
}

.cap-number {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.cap-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* Platform highlight cards */
.highlight-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.highlight-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 28px 24px;
    background: var(--tc-glass-bg);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    border-left: 4px solid transparent;
    backdrop-filter: blur(var(--tc-glass-blur));
}

.highlight-card.highlight-gold {
    border-left-color: var(--accent);
}

.highlight-card.highlight-green {
    border-left-color: #22c55e;
}

.highlight-icon {
    font-size: 2.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.highlight-body h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.highlight-body p {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Responsive: expanded home sections */
@media (max-width: 900px) {
    .features-grid-2col {
        grid-template-columns: 1fr !important;
    }

    .highlight-grid {
        grid-template-columns: 1fr;
    }

    .hero-capabilities-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .hero-cap-badge {
        width: 100%;
        height: 90px;
    }
}

@media (max-width: 480px) {
    .hero-cap-badge {
        height: 80px;
    }

    .cap-number {
        font-size: 1.3rem;
    }

    .cap-label {
        font-size: 0.7rem;
    }

    .highlight-card {
        flex-direction: column;
        gap: 12px;
    }
}

/* Image Preview with Clear Button */
.upload-dropzone {
    position: relative;
}

.btn-clear-image {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    background: #ef4444;
    border: 3px solid white;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.btn-clear-image:hover {
    background: #dc2626;
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(0,0,0,0.6);
}

/* Prompt input with enhance button */
.prompt-input-wrapper {
    position: relative;
}

/* Prompt header with label and enhance button */
.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.prompt-header label {
    font-size: 0.9rem;
    color: var(--text-secondary, #94a3b8);
    font-weight: 500;
    white-space: nowrap;
}

.prompt-header .btn-enhance {
    padding: 4px 12px;
    font-size: 0.8rem;
    width: auto;
    margin: 0;
    flex-shrink: 0;
}

/* Mode tabs clickable */
.mode-tab {
    cursor: pointer;
}

/* ============================================
   PROJECTS LIST STYLES
   ============================================ */

.projects-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 0;
}

.projects-empty {
    padding: 12px 14px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

.project-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: var(--tc-radius-sm);
    margin: 2px 8px;
}

.project-item:hover {
    background: var(--tc-glass-bg-input);
}

.project-item.active {
    background: rgba(168, 85, 247, 0.15);
    border-left: 3px solid var(--primary);
}

.project-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.project-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-item.active .project-name {
    color: var(--text);
}

.project-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--error);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    transition: opacity 0.2s;
}

.project-item:hover .project-delete {
    opacity: 0.6;
}

.project-delete:hover {
    opacity: 1 !important;
}

/* ============================================
   MODAL STYLES (Generic)
   ============================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--tc-glass-bg);
    border-radius: var(--tc-radius-lg);
    border: var(--tc-glass-border);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    backdrop-filter: blur(var(--tc-glass-blur-heavy));
}

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

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

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

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: var(--tc-glass-border);
}

/* Form Elements for Modals */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--tc-glass-bg-input);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    padding: 12px 14px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Button Styles */
.btn-primary {
    background: var(--primary);
    border: none;
    border-radius: var(--tc-radius-md);
    padding: 12px 24px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: transparent;
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    padding: 11px 24px;
    color: var(--text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--tc-glass-bg-input);
    border-color: rgba(148,163,184,0.15);
}

/* Radio Pill Styles (for toggle buttons) */
.radio-pill {
    display: inline-flex;
    cursor: pointer;
}

.radio-pill input[type="radio"] {
    display: none;
}

.radio-pill span {
    padding: 8px 16px;
    background: var(--tc-glass-bg-input);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-xl);
    font-size: 13px;
    color: var(--text-muted);
    transition: all 0.2s;
}

.radio-pill input[type="radio"]:checked + span {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.radio-pill span:hover {
    background: var(--tc-glass-bg-hover);
    border-color: rgba(148,163,184,0.12);
}

.radio-pill input[type="radio"]:checked + span:hover {
    background: var(--primary-dark);
}

/* ============================================
   ARTLIST-STYLE IMPROVEMENTS
   ============================================ */

/* Sidebar favorites section */
.sidebar-favorites {
    padding: 8px;
    border-top: var(--tc-glass-border);
}

.favorites-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--tc-radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.favorites-item:hover {
    background: var(--tc-glass-bg-input);
    color: var(--text);
}

.favorites-icon {
    color: var(--accent);
}

/* Mini player (for video preview) */
.mini-player {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 320px;
    background: var(--tc-glass-bg);
    border-radius: var(--tc-radius-lg);
    border: var(--tc-glass-border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    backdrop-filter: blur(var(--tc-glass-blur-heavy));
    z-index: 80;
    overflow: hidden;
    display: none;
}

.mini-player.active {
    display: block;
}

.mini-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--tc-glass-bg-sidebar);
}

.mini-player-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.mini-player-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
}

.mini-player-video {
    width: 100%;
    display: block;
}

/* Scrollbar styling */
.projects-list::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.projects-list::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.projects-list::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: var(--tc-glass-bg-hover);
    border-radius: 3px;
}

.projects-list::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--tc-glass-bg-active);
}

/* ==================== OVERLAY NOTIFICATIONS ==================== */
.overlay-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: overlayFadeIn 0.2s ease;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.overlay-notification-content {
    background: var(--tc-glass-bg);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    padding: 24px 32px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(var(--tc-glass-blur-heavy));
    animation: overlaySlideIn 0.25s ease;
}

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

.overlay-notification-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.overlay-notification-message {
    font-size: 16px;
    color: var(--text, #e2e8f0);
    margin-bottom: 24px;
    line-height: 1.5;
}

.overlay-notification-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.overlay-notification-buttons button {
    min-width: 100px;
    padding: 10px 24px;
    border-radius: var(--tc-radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.overlay-notification-buttons .btn-primary {
    background: var(--primary, #a855f7);
    color: white;
    border: none;
}

.overlay-notification-buttons .btn-primary:hover {
    background: var(--primary-hover, #9333ea);
    transform: translateY(-1px);
}

.overlay-notification-buttons .btn-secondary {
    background: transparent;
    color: var(--text-muted, #94a3b8);
    border: var(--tc-glass-border);
}

.overlay-notification-buttons .btn-secondary:hover {
    background: var(--tc-glass-bg-input);
    color: var(--text, #e2e8f0);
}

.overlay-notification-buttons .btn-danger {
    background: #ef4444;
    color: white;
    border: none;
}

.overlay-notification-buttons .btn-danger:hover {
    background: #dc2626;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--tc-glass-bg);
    border: var(--tc-glass-border);
    border-left: 4px solid #64748b;
    border-radius: var(--tc-radius-md);
    padding: 12px 16px;
    color: #f1f5f9;
    font-size: 13.5px;
    line-height: 1.4;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(var(--tc-glass-blur-heavy));
    animation: toastSlideIn 0.25s ease;
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 380px;
    min-width: 240px;
    word-break: break-word;
}

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

.toast.toast-out {
    animation: toastSlideOut 0.25s ease forwards;
}

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

.toast-success {
    border-left-color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
}

.toast-error {
    border-left-color: #f87171;
    background: rgba(248, 113, 113, 0.08);
}

.toast-warning {
    border-left-color: #fbbf24;
    background: rgba(251, 191, 36, 0.08);
}

.toast-info {
    border-left-color: #60a5fa;
    background: rgba(96, 165, 250, 0.08);
}

.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-message {
    flex: 1;
    color: #f1f5f9;
}

/* Fix dropdown option text color - ALL dropdowns across the app */
select option,
.form-select option,
select.form-select option {
    background: white !important;
    color: black !important;
}

/* ============================================
   MOBILE OPTIMIZATION
   ============================================ */

/* Mobile Menu Toggle Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 44px;
    height: 44px;
    background: var(--tc-glass-bg);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    backdrop-filter: blur(var(--tc-glass-blur));
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-size: 1.5rem;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn:active {
    background: var(--tc-glass-bg-active);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
}

/* Mobile Header Bar */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--tc-glass-bg-sidebar);
    border-bottom: var(--tc-glass-border);
    z-index: 150;
    backdrop-filter: blur(var(--tc-glass-blur-heavy));
    align-items: center;
    justify-content: center;
    padding: 0 60px;
}

.mobile-header .logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}

.mobile-header .logo-icon {
    margin-right: 8px;
}

/* ============================================
   MOBILE BREAKPOINT (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Show mobile elements */
    .mobile-menu-btn {
        display: flex;
    }
    
    .mobile-header {
        display: flex;
    }
    
    .mobile-overlay {
        display: block;
        pointer-events: none;
    }
    
    .mobile-overlay.active {
        pointer-events: auto;
    }
    
    /* Hide sidebar by default, slide in when active */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: var(--sidebar-width);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    /* Show labels when sidebar is open on mobile */
    .sidebar.mobile-open .nav-label,
    .sidebar.mobile-open .logo-text,
    .sidebar.mobile-open .sidebar-section-header span,
    .sidebar.mobile-open .sidebar-add-btn,
    .sidebar.mobile-open .user-email-short {
        display: inline;
    }
    
    .sidebar.mobile-open .nav-item {
        justify-content: flex-start;
        padding: 12px 16px;
    }
    
    .sidebar.mobile-open .sidebar-logo {
        justify-content: flex-start;
        padding: 20px 16px;
    }
    
    /* Main content takes full width */
    .main-content {
        margin-left: 0;
        padding-top: 56px;
    }
    
    /* Header adjustments */
    .top-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .search-bar {
        order: 3;
        width: 100%;
        max-width: 100%;
    }
    
    .header-actions {
        gap: 6px;
    }
    
    .header-actions .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    /* Hide less important header buttons on mobile */
    .header-actions .btn-icon:not(#screenshotBtn) {
        display: none;
    }
    
    /* Creator area */
    .creator-area {
        padding: 16px 12px;
    }
    
    /* Home hero section */
    .home-hero {
        flex-direction: column;
        padding: 24px 16px;
        gap: 24px;
    }
    
    .hero-content {
        text-align: center;
    }
    
    .home-hero .hero-title {
        font-size: 2rem;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .hero-image-grid {
        justify-content: center;
    }
    
    /* Feature cards */
    .features-grid {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 16px;
    }
    
    /* Form controls */
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 16px;
    }
    
    /* Settings bar */
    .settings-bar {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .settings-bar .setting-item {
        width: 100%;
    }
    
    .settings-bar select,
    .settings-bar input {
        width: 100%;
    }
    
    /* Buttons - larger touch targets */
    .btn {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .btn-generate {
        width: 100%;
    }
    
    /* Gallery grid */
    .gallery-grid,
    .video-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    /* Upload area */
    .upload-area {
        padding: 24px 16px;
    }
    
    /* Textarea */
    textarea {
        min-height: 120px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Input fields - prevent zoom on iOS */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    select {
        font-size: 16px;
    }
    
    /* Modal adjustments */
    .modal-content,
    .lightbox-modal-content {
        width: 95vw;
        max-width: 95vw;
        margin: 10px;
        max-height: 90vh;
    }
    
    /* Progress section */
    .progress-section {
        padding: 16px;
    }
    
    /* Video result */
    .result-section video {
        max-height: 50vh;
    }
    
    /* Tabs */
    .mode-toggle {
        flex-wrap: wrap;
    }
    
    .mode-toggle .btn {
        flex: 1 1 auto;
        min-width: 100px;
    }
}

/* ============================================
   SMALL MOBILE (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    .mobile-header {
        padding: 0 50px;
    }
    
    .home-hero .hero-title {
        font-size: 1.6rem;
    }
    
    .home-hero .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
    
    .hero-image-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .hero-preview {
        width: 80px;
        height: 80px;
    }
    
    /* Single column gallery on very small screens */
    .gallery-grid,
    .video-gallery-grid {
        grid-template-columns: 1fr;
    }
    
    /* Header actions */
    .header-actions {
        gap: 4px;
    }
    
    .credits-display {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
    
    /* Adjust tab buttons */
    .tab-nav-grouped {
        gap: 6px;
    }
    
    .gallery-tab-btn {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    /* Feature cards */
    .feature-card {
        padding: 16px;
    }
    
    .feature-card h3 {
        font-size: 1.1rem;
    }
    
    /* Chat widget */
    .chat-widget {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 10px;
        max-height: 70vh;
    }
}

/* ============================================
   TOUCH OPTIMIZATION
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-item,
    .nav-group {
        min-height: 48px;
    }
    
    .btn,
    button {
        min-height: 44px;
    }
    
    /* Remove hover effects that don't work on touch */
    .nav-item:hover {
        background: transparent;
    }
    
    .nav-item:active {
        background: var(--tc-glass-bg-hover);
    }
    
    .btn:hover {
        transform: none;
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    /* Scrollable areas */
    .sidebar-nav,
    .main-content {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Prevent text selection on buttons */
    .btn,
    .nav-item,
    .tab-btn {
        -webkit-user-select: none;
        user-select: none;
    }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */
@media (max-width: 900px) and (orientation: landscape) {
    .mobile-header {
        height: 48px;
    }
    
    .main-content {
        padding-top: 48px;
    }
    
    .home-hero {
        flex-direction: row;
        padding: 16px;
    }
    
    .modal-content {
        max-height: 85vh;
    }
}

/* ============================================
   SAFE AREA INSETS (notch support)
   ============================================ */
@supports (padding: max(0px)) {
    .mobile-header {
        padding-top: max(0px, env(safe-area-inset-top));
        height: calc(56px + env(safe-area-inset-top));
    }
    
    .main-content {
        padding-top: calc(56px + env(safe-area-inset-top));
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .sidebar {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============================================
   AGGRESSIVE MOBILE OVERHAUL
   ============================================ */
@media (max-width: 768px) {
    /* Hide desktop header elements */
    .top-header .search-bar {
        display: none;
    }
    
    .header-actions .btn:not(.credits-display):not(#screenshotBtn) {
        display: none;
    }
    
    .top-header {
        justify-content: flex-end;
        padding: 8px 12px;
        min-height: 48px;
    }
    
    /* Stack all two-column layouts */
    .prompt-layout,
    .two-column-layout,
    .split-layout,
    .creator-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }

    /* Stack video + ref image on mobile */
    .result-video-wrapper {
        flex-direction: column !important;
    }
    .result-video {
        width: 100% !important;
        max-height: 280px !important;
    }
    .result-ref-image-panel {
        flex: 0 0 200px !important;
        border-left: none !important;
        border-top: 1px solid rgba(148,163,184,0.08) !important;
    }
    
    .prompt-layout > *,
    .two-column-layout > *,
    .split-layout > *,
    .creator-layout > * {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }
    
    /* Page titles */
    .page-title,
    .section-title-large,
    h1 {
        font-size: 1.5rem !important;
        margin-bottom: 8px !important;
    }
    
    .page-subtitle,
    .section-subtitle {
        font-size: 0.9rem !important;
        margin-bottom: 16px !important;
    }
    
    /* Cards - full width, less padding */
    .card,
    .form-card,
    .settings-card,
    .upload-card,
    .result-card {
        padding: 16px !important;
        margin: 0 !important;
        border-radius: 12px !important;
    }
    
    .card h2,
    .card h3,
    .form-card h2,
    .form-card h3 {
        font-size: 1.1rem !important;
        margin-bottom: 12px !important;
    }
    
    /* Form elements - full width */
    .form-group {
        margin-bottom: 16px !important;
    }
    
    .form-group label {
        font-size: 0.85rem !important;
        margin-bottom: 6px !important;
    }
    
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        width: 100% !important;
        padding: 14px 12px !important;
        font-size: 16px !important;
        border-radius: 10px !important;
    }
    
    textarea {
        min-height: 100px !important;
    }
    
    /* Buttons - full width, larger */
    .btn {
        width: 100% !important;
        padding: 14px 16px !important;
        font-size: 1rem !important;
        border-radius: 10px !important;
        justify-content: center !important;
    }
    
    .btn-group,
    .button-group,
    .action-buttons {
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
    }
    
    .btn-group .btn,
    .button-group .btn {
        margin: 0 !important;
    }
    
    /* Mode toggles - wrap and stack */
    .mode-toggle,
    .tab-toggle,
    .toggle-group {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .mode-toggle .btn,
    .tab-toggle .btn,
    .toggle-group .btn {
        flex: 1 1 45% !important;
        min-width: 0 !important;
        padding: 12px 8px !important;
        font-size: 0.85rem !important;
    }
    
    /* Enhancement style buttons */
    .style-buttons,
    .option-buttons {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .style-buttons .btn,
    .option-buttons .btn {
        flex: 1 1 auto !important;
        min-width: 70px !important;
        padding: 10px 12px !important;
        font-size: 0.8rem !important;
    }
    
    /* Upload areas */
    .upload-area,
    .drop-zone,
    .image-upload-area {
        padding: 24px 16px !important;
        min-height: 120px !important;
    }
    
    .upload-area p,
    .drop-zone p {
        font-size: 0.9rem !important;
    }
    
    /* Gallery grids */
    .gallery-grid,
    .video-gallery-grid,
    .photo-gallery-grid,
    .assets-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        padding: 0 !important;
    }
    
    .gallery-item,
    .video-item,
    .photo-item {
        border-radius: 10px !important;
    }
    
    /* Progress sections */
    .progress-section,
    .status-section {
        padding: 16px !important;
    }
    
    .progress-bar {
        height: 8px !important;
        border-radius: 4px !important;
    }
    
    /* Result video */
    .result-section video,
    .video-preview video {
        max-height: 40vh !important;
        border-radius: 12px !important;
    }
    
    /* Settings bars - vertical stack */
    .settings-bar,
    .options-bar,
    .controls-bar {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        padding: 12px !important;
        background: var(--tc-glass-bg) !important;
        border-radius: var(--tc-radius-lg) !important;
    }
    
    .settings-bar > *,
    .options-bar > *,
    .controls-bar > * {
        width: 100% !important;
    }
    
    .setting-item,
    .control-item {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
    }
    
    .setting-item label {
        font-size: 0.8rem !important;
        color: var(--text-muted) !important;
    }
    
    /* Tab navigation */
    .tab-nav,
    .gallery-tabs {
        display: flex !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 8px !important;
        padding-bottom: 8px !important;
        scrollbar-width: none !important;
    }
    
    .tab-nav::-webkit-scrollbar,
    .gallery-tabs::-webkit-scrollbar {
        display: none !important;
    }
    
    .tab-btn,
    .gallery-tab-btn {
        flex-shrink: 0 !important;
        padding: 12px 16px !important;
        font-size: 0.9rem !important;
        white-space: nowrap !important;
        border-radius: 8px !important;
    }
    
    /* Creator area padding */
    .creator-area,
    .page-content,
    .main-section {
        padding: 16px 12px !important;
    }
    
    /* Home page hero */
    .home-hero {
        padding: 20px 16px !important;
        text-align: center !important;
    }
    
    .home-hero .hero-content {
        max-width: 100% !important;
    }
    
    .home-hero .hero-title {
        font-size: 1.8rem !important;
        line-height: 1.2 !important;
    }
    
    .home-hero .hero-subtitle {
        font-size: 1rem !important;
    }
    
    .hero-buttons {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .hero-image-grid {
        display: none !important;
    }
    
    /* Feature cards */
    .features-grid,
    .feature-cards {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        padding: 0 12px !important;
    }
    
    .feature-card {
        padding: 16px !important;
    }
    
    .feature-card .feature-icon {
        font-size: 2.8rem !important;
        margin-bottom: 12px !important;
    }
    
    .feature-card h3 {
        font-size: 1rem !important;
    }
    
    .feature-card p {
        font-size: 0.85rem !important;
    }
    
    /* Modals */
    .modal-content,
    .lightbox-modal-content,
    .dialog-content {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        padding: 16px !important;
    }
    
    .modal-header {
        padding: 12px 0 !important;
        font-size: 1.1rem !important;
    }
    
    .modal-close {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.5rem !important;
    }
    
    /* Chat widget */
    .chat-widget {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
    }
    
    .chat-toggle-btn {
        width: 56px !important;
        height: 56px !important;
        bottom: 16px !important;
        right: 16px !important;
    }
    
    /* Scrollable content */
    .scrollable-content {
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Fix any remaining side padding */
    .container,
    .content-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .mode-toggle .btn,
    .tab-toggle .btn {
        flex: 1 1 100% !important;
        font-size: 0.9rem !important;
    }
    
    .style-buttons .btn,
    .option-buttons .btn {
        flex: 1 1 100% !important;
    }
    
    .gallery-grid,
    .video-gallery-grid {
        grid-template-columns: 1fr !important;
    }
    
    .home-hero .hero-title {
        font-size: 1.5rem !important;
    }
}

/* Fix iOS input zoom */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Bottom navigation bar for mobile */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--tc-glass-bg-sidebar);
    border-top: var(--tc-glass-border);
    z-index: 100;
    backdrop-filter: blur(var(--tc-glass-blur-heavy));
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 64px;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    gap: 4px;
    min-width: 64px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-item .nav-icon {
    font-size: 1.4rem;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: block;
    }
    
    /* Add padding at bottom for nav bar */
    .main-content {
        padding-bottom: calc(64px + env(safe-area-inset-bottom)) !important;
    }
    
    /* Hide sidebar hamburger, use bottom nav instead */
    .mobile-menu-btn {
        display: none !important;
    }
    
    .mobile-header {
        display: none !important;
    }
    
    .sidebar {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding-top: 56px !important;
    }

    .top-bar {
        left: 0 !important;
    }

    /* Mobile: hide most header items, show only status + credits + overflow */
    .header-buy-credits,
    .header-admin,
    .header-logout {
        display: none !important;
    }
    .header-overflow-buy {
        display: flex !important;
    }
    .top-bar-right {
        gap: 8px;
    }
    .user-credits-badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    .header-overflow-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Mobile More Menu */
.mobile-more-menu {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
}

.mobile-more-menu.active {
    display: flex;
}

.mobile-more-menu-content {
    background: var(--tc-glass-bg);
    width: 100%;
    border-radius: var(--tc-radius-xl) var(--tc-radius-xl) 0 0;
    padding: 20px;
    backdrop-filter: blur(var(--tc-glass-blur-heavy));
    border: var(--tc-glass-border);
    border-bottom: none;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    animation: slideUp 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.mobile-more-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: var(--tc-glass-border);
    font-weight: 600;
    font-size: 1.1rem;
}

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

.mobile-more-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--tc-radius-lg);
    font-size: 1rem;
}

.mobile-more-item:active {
    background: var(--tc-glass-bg-hover);
}

.mobile-more-item .nav-icon {
    font-size: 1.5rem;
}

button.mobile-more-item {
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    min-height: 48px;
}

.mobile-more-section {
    margin-bottom: 12px;
}
.mobile-more-section-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 16px 4px;
}
.mobile-more-child {
    padding: 14px 16px 14px 20px;
    min-height: 48px;
}

/* Inner T2V/I2V toggle inside creation card: compact version */
.creation-card > .video-main-mode-toggle {
    margin-bottom: 20px;
}
.creation-card > .video-main-mode-toggle .main-mode-btn {
    padding: 10px 16px;
    font-size: 13px;
}

