html,
body {
  width: 100%;
  overflow-x: hidden;
  max-width: 100vw;
  box-sizing: border-box;
}

/* General Body Styles */
:root {
    --primary-purple: #7C3AED;
    --light-purple-bg: #feeeff;
    --border-purple: #A78BFA;
    --main-bg: #fff5ff;
    --card-bg: #FFFFFF;
    --primary-text: #1F2937;
    --secondary-text: #6B7280;
    --border-color: #E5E7EB;
    --dashed-border: #D1D5DB;
    --success-color: #22c55e;
    --pending-color: #eab308;
    --active-color: var(--primary-purple);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05);
}

body {
    font-family: 'Inter', sans-serif;
    /* Very light subtle purple background */
    background: radial-gradient(circle at 50% 0%, #f8f6ff 0%, #fbf9ff 60%, #fefcff 100%);
    margin: 0;
    color: var(--primary-text);
    display: flex; /* keep flex for auth centering */
    height: 100vh;
    overflow-y: auto; /* Allow scrolling to prevent header clipping */
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Auth container remains for login page */
#auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Main App Layout */
#app-container {
    display: flex;
    flex-direction: column; /* Stack header and main content */
    width: 100%;
    height: 100%;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0; /* Prevent header from shrinking */
    position: relative;
    z-index: 100; /* Ensure header stays above content */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Add subtle shadow for better visibility */
}

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

.logo { display: flex; align-items: center; font-size: 20px; font-weight: 600; gap: 12px; }
.logo img {
    height: auto;
    width: 150px;
    border-radius: 6px;
}

.app-nav {
    margin-left: 0;
    display: flex;
    gap: 8px;
}

.nav-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.nav-btn:hover {
    background-color: var(--background-color);
    color: var(--text-primary);
}

.user-profile {
    margin-left: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative; /* For dropdown positioning */
}
#user-photo { 
    width: 36px; 
    height: 36px; 
    border-radius: 50%; 
    cursor: pointer;
}
#user-name { font-weight: 500; font-size: 14px; }
.btn-logout { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 14px; padding: 8px; transition: color 0.2s; }
.btn-logout:hover { color: var(--primary-color); }

/* Main Content & Views */
.app-main-content {
    display: flex;
    justify-content: center;
    padding: 32px 24px;
    padding-top: 96px; /* Space for fixed header (64px) + spacing */
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--main-bg);
    width: 100%;
    box-sizing: border-box;
}

.main-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    width: 100%;
    max-width: 1400px; /* Limit width on large screens */
    align-items: start;
    box-sizing: border-box;
    padding: 0;
    margin: 0 auto; /* Center on large screens */
}

.left-column, .right-column {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.left-column h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--primary-text);
}

.right-column h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--primary-text);
}

.subtitle {
    font-size: 14px;
    color: var(--secondary-text);
    margin: 0 0 24px 0;
}

.view-container {
    width: 100%;
}

/* Step-by-Step Mode Styles */
.prompt-option-container {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.prompt-option {
    flex: 1;
}

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

.prompt-option label {
    display: block;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--card-bg);
}

.prompt-option input[type="radio"]:checked + label {
    border-color: var(--primary-purple);
    background-color: var(--light-purple-bg);
}

.prompt-section {
    margin-top: 20px;
}

.custom-prompt-item {
    margin-bottom: 16px;
}

.custom-prompt-item label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--primary-text);
}

.custom-prompt-item textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
}

.custom-prompt-item textarea:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.prompt-item {
    background-color: #f9fafb;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary-purple);
}

.prompt-item strong {
    color: var(--primary-text);
    font-size: 14px;
}

.prompt-item p {
    margin: 8px 0 0 0;
    color: var(--secondary-text);
    font-size: 14px;
    line-height: 1.5;
}

/* Individual Items Interface */
.individual-items-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.individual-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.individual-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-purple);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.item-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-text);
}

.item-status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.pending {
    background-color: #fef3c7;
    color: #d97706;
}

.status-badge.generated {
    background-color: #d1fae5;
    color: #065f46;
}

.item-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.prompt-preview,
.image-preview,
.video-preview {
    background-color: #f9fafb;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-purple);
}

.prompt-preview p,
.script-text {
    margin: 0;
    font-size: 14px;
    color: var(--secondary-text);
    line-height: 1.5;
}

.image-result,
.video-result {
    text-align: center;
}

.generated-image,
.generated-video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.placeholder-content {
    text-align: center;
    padding: 40px 20px;
    color: var(--secondary-text);
}

.placeholder-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    opacity: 0.5;
}

.placeholder-content p {
    margin: 0;
    font-size: 14px;
}

.item-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 6px;
    font-weight: 500;
}

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

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

.btn-danger {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.delete-prompt-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-prompt-btn:hover {
    background: #dc2626;
    color: white;
    transform: scale(1.1);
}

.prompt-editor,
.video-prompt-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.prompt-textarea,
.video-prompt-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
}

.prompt-textarea:focus,
.video-prompt-textarea:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.prompt-actions,
.video-prompt-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.prompt-display,
.video-prompt-display {
    background-color: #f9fafb;
    padding: 16px;
    border-radius: 8px;
}

.prompt-text,
.video-prompt-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--primary-text);
    margin-bottom: 12px;
}

/* Voiceover Script Styles */
.script-editor-container {
    margin-top: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.script-editor-container label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary-text);
}

.script-info {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--secondary-text);
}

.script-display {
    margin-bottom: 20px;
}

.script-display h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-text);
}

/* Duration Selector */
.duration-selector {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.duration-selector h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-text);
}

.duration-description {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--secondary-text);
    line-height: 1.5;
}

.duration-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.duration-option {
    position: relative;
}

.duration-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.duration-option label {
    display: block;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--card-bg);
}

.duration-option input[type="radio"]:checked + label {
    border-color: var(--primary-purple);
    background: var(--light-purple-bg);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.duration-option label:hover {
    border-color: var(--primary-purple);
    background: var(--light-purple-bg);
}

.duration-time {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-text);
    margin-bottom: 4px;
}

.duration-segments {
    display: block;
    font-size: 12px;
    color: var(--secondary-text);
}

.duration-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.duration-display {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-text);
    padding: 8px 12px;
    background: var(--light-purple-bg);
    border-radius: 6px;
}

/* Responsive adjustments for duration selector */
@media (max-width: 768px) {
    .duration-options {
        grid-template-columns: 1fr;
    }

    .duration-actions {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .duration-display {
        text-align: center;
    }
}

/* Voiceover Preview */
.voiceover-preview {
    margin-top: 20px;
}

.voiceover-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.audio-controls {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

/* Step Navigation */
.step-navigation {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .individual-item {
        padding: 16px;
    }

    .voiceover-settings {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .item-actions {
        justify-content: center;
    }

    .btn-small {
        flex: 1;
        text-align: center;
    }
}

/* View 1: Initial Upload Box */
#initial-upload-view {
    display: flex;
    justify-content: center;
    /* align-items and padding-top are no longer needed due to parent centering */
    width: 100%;
}

.upload-box {
    width: 100%;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    height: 420px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    align-items: stretch;
    overflow: hidden;
}

.upload-box-input { display: none; }
.upload-box-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    gap: 12px;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}
.upload-box-label:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-color-light);
}
.upload-box-icon { color: var(--text-secondary); }
.upload-box-title { font-size: 24px; font-weight: 600; margin: 0; }
.upload-box-subtitle { font-size: 16px; color: var(--text-secondary); margin: 0; }
.upload-box .btn {
    font-size: 16px;
    padding: 12px 24px;
}
.upload-box-info { font-size: 14px; color: var(--text-secondary); margin: 0; }


/* View 2: Post-Upload Mode Selection */
#post-upload-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Center content vertically */
    gap: 30px;
    width: 100%;
    max-width: 65vh; /* Match the size of the upload box */
    margin: 0 auto; /* Center the container itself */
}
#uploaded-image-preview {
    width: 100%; /* Fill the container */
    height: auto;
    object-fit: contain; /* Ensure the whole image is visible */
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    max-height: 80%; /* Limit image height to leave space for buttons */
}
.mode-selection-buttons { 
    display: flex; 
    gap: 20px; 
    justify-content: center; /* Ensure buttons are centered */
    width: 100%; /* Take full width to allow centering */
}
.mode-selection-buttons .btn { 
    font-size: 18px; /* Larger font */
    padding: 16px 32px; /* More padding */
    min-width: 200px; /* Give them a minimum width */
    text-align: center;
}

.mode-btn {
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 220px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mode-btn.btn-primary {
    background: linear-gradient(to right, #6D28D9, #4F46E5);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mode-btn.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    background: linear-gradient(to right, #7C3AED, #6366F1);
}

.mode-btn.btn-secondary {
    background-color: #F3F4F6;
    color: #1F2937;
    border: 1px solid #E5E7EB;
}

.mode-btn.btn-secondary:hover:not(:disabled) {
    background-color: #E5E7EB;
    border-color: #D1D5DB;
    transform: translateY(-2px);
}

/* View 5: Library */
.library-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
}

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

.library-item {
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.library-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.library-item video {
    width: 100%;
    height: auto;
    aspect-ratio: 9 / 16;
    background-color: #f0f0f0;
}

.library-item-footer {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.library-item-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.library-item .btn {
    padding: 6px 1px;
    font-size: 12px;
}

/* Repository View */
.repository-header {
    text-align: center;
    margin-bottom: 40px;
}

.repository-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--primary-text);
}

.repository-subtitle {
    font-size: 16px;
    color: var(--secondary-text);
    margin-bottom: 24px;
}

.repository-filters {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 20px;
    border: 2px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--secondary-text);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--primary-purple);
    color: var(--primary-purple);
}

.filter-btn.active {
    background-color: var(--primary-purple);
    border-color: var(--primary-purple);
    color: white;
}

.repository-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 0 20px;
}

.repo-item {
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.repo-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.repo-item-media {
    width: 100%;
    height: auto;
    min-height: 200px;
    background-color: #f0f0f0;
    object-fit: cover;
}

.repo-item video {
    aspect-ratio: 9 / 16;
}

.repo-item img {
    aspect-ratio: 1 / 1;
}

.repo-item-type-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.repo-item-type-badge.video {
    background-color: rgba(124, 58, 237, 0.9);
    color: white;
}

.repo-item-type-badge.image {
    background-color: rgba(34, 197, 94, 0.9);
    color: white;
}

.repo-item-delete-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(239, 68, 68, 0.9);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.2s ease;
    z-index: 10;
}

.repo-item-delete-btn:hover {
    background-color: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

.delete-confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.delete-confirm-modal.show {
    display: flex;
}

.delete-confirm-content {
    background-color: white;
    border-radius: 12px;
    padding: 32px;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.delete-confirm-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--primary-text);
}

.delete-confirm-message {
    font-size: 14px;
    color: var(--secondary-text);
    margin-bottom: 24px;
}

.delete-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.delete-confirm-actions .btn {
    padding: 10px 20px;
    font-size: 14px;
}

.repo-item-footer {
    padding: 16px;
}

.repo-item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.repo-item-date {
    font-size: 12px;
    color: var(--secondary-text);
}

.repo-item-project {
    font-size: 12px;
    color: var(--primary-purple);
    font-weight: 500;
}

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

.repo-item-actions .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
}

/* Repository responsive */
@media (max-width: 768px) {
    .repository-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }
    
    .repository-title {
        font-size: 24px;
    }
    
    .repo-item-actions {
        flex-direction: column;
    }
}

/* View 3: 1-Click Progress */
#one-click-view {
    text-align: center;
}
#one-click-status { font-size: 18px; color: var(--text-secondary); margin-bottom: 20px; }
#one-click-status.fallback-active {
    color: #d97706; /* amber-600 */
    font-weight: 500;
}
#one-click-status.fallback-active::before {
    content: "⚠️ ";
    margin-right: 8px;
}

.progress-bar {
    width: 100%;
    max-width: 500px;
    height: 24px;
    background-color: var(--border-color);
    border-radius: 12px;
    margin: 20px auto;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #6D28D9, #4F46E5);
    border-radius: 12px;
    transition: width 1s linear;
}

#lucky-progress-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
    mix-blend-mode: exclusion;
    line-height: 1;
}

.timer-text {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

/* View 4: Manual Mode (Stepper) */
.stepper-container { display: flex; flex-direction: column; gap: 20px; }
.step { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; transition: all 0.3s ease; }
.step-header {
    display: flex;
    align-items: center;
    padding: 20px;
    border-radius: 12px;
    transition: background-color 0.3s ease;
}

.step.active .step-header, .step.completed .step-header { cursor: pointer; }
.step.completed .step-header:hover { background-color: #f9fafb; }

.step-indicator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--primary-color-light);
    color: var(--primary-color);
    display: grid;
    place-items: center;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-right: 16px; /* Added margin */
}
.step-title { font-size: 18px; font-weight: 600; margin: 0; flex-grow: 1; }
.step-status { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; margin-left: 16px; }
.step-status[data-status="pending"] { color: var(--pending-color); background-color: #fffbeb; }
.step-status[data-status="active"] { color: var(--active-color); background-color: var(--primary-color-light); }
.step-status[data-status="completed"] { color: var(--success-color); background-color: #ecfdf5; }
.step-content { padding: 0 20px 20px; display: none; }
.step.open .step-content { display: block; }
.step.active .step-indicator { background-color: var(--primary-color); color: white; }
.step-chevron { width: 20px; height: 20px; color: var(--text-secondary); transition: transform 0.3s ease; margin-left: 16px; }
.step.open .step-chevron, .step.active .step-chevron { transform: rotate(180deg); }


/* Shared components */
.media-generation-container { display: flex; gap: 20px; }
.media-column { flex: 1; }

.model-selection {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 14px;
    align-items: center;
    color: var(--text-secondary);
}
.model-selection label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* Button Styles */
.btn { background-color: #ffffff; color: #333; border: 1px solid #ccc; padding: 10px 18px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.2s; position: relative; box-shadow: var(--shadow-sm); }
.btn:hover:not(:disabled) { border-color: #999; background-color: #f7f7f7; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-danger { background-color: #dc2626; color: #ffffff; border-color: #dc2626; }
.btn-danger:hover:not(:disabled) { background-color: #b91c1c; border-color: #b91c1c; }
.btn-primary { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }
.btn-primary:hover:not(:disabled) { background-color: #7c3aed; border-color: #5244e0; }
.btn-secondary {
    background-color: var(--card-bg);
    color: #FC3AED;
    border-color: var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

/* Results Display */
.results-box { margin-top: 15px; }
#prompts-container p { background-color: #f9fafb; padding: 8px 12px; border-radius: 6px; font-size: 14px; }
.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 15px; margin-top: 15px; }
.results-grid img, .results-grid video { width: 100%; border-radius: 8px; aspect-ratio: 9/16; object-fit: cover; }
#audio-player { width: 100%; margin-top: 15px; }
#video-prompts-display { background-color: #f9fafb; border-radius: 8px; padding: 15px; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.status-text { text-align: center; margin-top: 15px; color: var(--text-secondary); }
.final-video-wrapper { 
    margin: 20px auto 0 auto; 
    max-width: 420px; /* Increased from 320px */
    text-align: center; 
}
#final-video-player { width: 100%; margin-inline: auto; display: block; border-radius: 8px; }


/* Spinner for buttons */
.spinner { display: none; width: 18px; height: 18px; border: 2px solid; border-radius: 50%; border-right-color: transparent !important; animation: spin 1s linear infinite; position: absolute; left: 50%; top: 50%; margin-left: -9px; margin-top: -9px; }
.btn .spinner { border-color: var(--text-secondary); }
.btn-primary .spinner { border-color: white; }
.btn .btn-text { transition: opacity 0.2s; }

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

.step-content, .view-container { animation: fadeIn 0.4s ease-in-out; }

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

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    padding: 8px;
    z-index: 10;
    min-width: 120px;
}
.dropdown-menu button { display: block; width: 100%; text-align: left; }
.dropdown-menu select {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    background-color: var(--card-bg);
    color: var(--text-primary);
}
.dropdown-menu select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color-light);
}

.product-description-input {
    width: 100%;
    min-height: 120px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    box-sizing: border-box;
    resize: vertical;
}
.product-description-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color-light);
}

/* NEW: Generation Options Row */
.generation-options{
  display:flex;
  gap:16px;
  margin:12px 0;
  flex-wrap:wrap;
}
.generation-options .opt-label{
  font-size:14px;
  display:flex;
  flex-direction:column;
}
.generation-options select,.generation-options input[type="checkbox"]{
  margin-top:4px;
  padding:4px 6px;
  font-size:14px;
}

/* Thumbnail grid */
#uploaded-thumbnails{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  justify-content:center;
  width: 100%;
  box-sizing: border-box;
  align-items: stretch;
}
.thumb{
  width:150px;
  height:150px;
  position:relative;
  overflow:hidden;
  border-radius:8px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
}
.delete-thumb{
  position:absolute;
  top:4px;
  right:4px;
  background:#ffffffcc;
  border:none;
  border-radius:50%;
  width:24px;
  height:24px;
  font-size:16px;
  line-height:24px;
  cursor:pointer;
  transition:background 0.2s;
}
.delete-thumb:hover{background:#ff5555cc; color:#fff;}

/* Button polish */
.btn{
  padding:10px 20px;
  font-size:16px;
  border:none;
  border-radius:6px;
  cursor:pointer;
  transition:background 0.2s, transform 0.1s;
}
.btn-primary{background:#2563eb; color:#fff;}
.btn-primary:hover{background:#1e4fbe; transform:translateY(-1px);}
.btn-secondary{background:#f3f4f6; color:#111827;}
.btn-secondary:hover{background:#e5e7eb; transform:translateY(-1px);}

/* Center helper */
.flex-center{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
}

@media (max-width: 768px) {
    .app-header { flex-direction: column; gap: 16px; padding: 16px; }
    .user-profile { margin-left: 0; }
    .app-main-content { padding: 20px; }
    .results-grid { grid-template-columns: repeat(2, 1fr); }
    .media-generation-container { flex-direction: column; }
}

@media (max-width: 640px) {
    .app-header {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 16px;
        gap: 16px;
    }

    .header-actions {
        justify-content: center;
        width: 100%;
    }

    .logo img { height: 48px; }
    .app-nav {
        display: flex;
        align-items: center;
        gap: 24px;
        margin-left: 0;
    }

    .nav-btn {
        font-weight: 600;
    }

    .user-profile {
        margin-left: 0;
        gap: 0;
    }
    #user-name { display: none; }
    #user-photo { margin-right: 0; order: -1; }
    .btn-logout { display: none; } /* Hidden, shown in dropdown */
    .app-main-content{
        padding: 16px;
    }
    .mode-selection-buttons{
        flex-direction: column;
    }
    #uploaded-image-preview {
        max-width: 50%;
        margin-inline: auto;
        display: block;
    }
    /* Shrink upload box on small screens */
    .upload-box {
        max-width: 90%;
        margin: 0 auto;
        aspect-ratio: unset;
        height: auto;
        padding: 16px;
    }
    .upload-box-label {
        padding: 16px;
    }
    /* Library grid: smaller columns */
    .library-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .library-item video {
        max-height: 200px;
    }
    /* Enable scrolling */
    body {
        overflow-y: auto;
    }
    /* Ensure library item footer elements remain visible on small screens */
    .library-item-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .library-item-footer .btn {
        width: 100%;
    }
}

/* --- Fix mobile scrolling and spacing issues --- */
@media (max-width: 640px) {
    body {
        height: auto; /* Allow full scrolling on small screens */
    }
    .app-main-content {
        align-items: flex-start;
        justify-content: flex-start;
    }
}

/* Ensure gap between header and library content on larger screens */
#library-view {
    /* Ensure the whole grid starts at the top of the scrollable area */
    align-self: flex-start;
    margin-top: 32px;
}

/* -------- Modern design overhaul -------- */
:root{
  --slate-800:#1f2937;
  --slate-700:#374151;
  --slate-300:#d1d5db;
  --indigo-500:#7c3aed;
  --violet-500:#8b5cf6;
  --bg-light:#f9fafb;
}
body{background:var(--bg-light); color:var(--slate-800); font-family:"Inter",sans-serif;}

/* Buttons */
.btn{
  padding:12px 26px;
  font-size:16px;
  font-weight:500;
  border-radius:8px;
  border:1px solid transparent;
  cursor:pointer;
  transition:transform .15s,box-shadow .15s;
  display:inline-flex; align-items:center; justify-content:center;
}
.btn:disabled{opacity:.6;cursor:not-allowed;}
.btn-primary{
  background-image:linear-gradient(90deg,var(--indigo-500) 0%,var(--violet-500) 100%);
  color:#ffffff;
  box-shadow:0 1px 2px rgba(0,0,0,.05);
}
.btn-primary:hover:not(:disabled){
  transform:translateY(-2px);
  box-shadow:0 4px 14px rgba(0,0,0,.12);
}
.btn-secondary{
  background:transparent;
  border-color:var(--slate-300);
  color:var(--slate-700);
}
.btn-secondary:hover:not(:disabled){
  transform:translateY(-2px);
  box-shadow:0 4px 14px rgba(0,0,0,.06);
}

/* Generation options layout */
.generation-options{display:flex;gap:32px;flex-wrap:wrap;justify-content:center;margin:20px 0;}
.opt-label{font-weight:500;color:var(--slate-700);display:flex;flex-direction:column;gap:4px;}

/* Select */
.opt-label select{
  appearance:none;-webkit-appearance:none;
  background:var(--bg-light) url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iOCIgdmlld0JveD0iMCAwIDE0IDgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNzUgMS41TDcgNi41TDEyLjI1IDEuNSIgc3Ryb2tlPSIjNjM2NmYxIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==') no-repeat right 12px center;
  border:1px solid var(--slate-300);border-radius:8px;padding:10px 40px 10px 14px;font-size:15px;color:var(--slate-800);
  transition:border .2s,box-shadow .2s;
}
.opt-label select:focus{outline:none;border-color:var(--indigo-500);box-shadow:0 0 0 3px rgba(99,102,241,.35);}   

/* Checkbox */
.opt-label input[type="checkbox"]{width:20px;height:20px;appearance:none;border:2px solid var(--slate-300);border-radius:4px;cursor:pointer;transition:background .2s,border .2s;}
.opt-label input[type="checkbox"]:checked{background:var(--indigo-500);border-color:var(--indigo-500);} 
.opt-label input[type="checkbox"]:checked::after{content:"";position:absolute;width:5px;height:10px;border:solid #fff;border-width:0 2px 2px 0;transform:translate(6px,2px) rotate(45deg);}  

/* Textarea */
.product-description-input{width:100%;max-width:700px;min-height:140px;padding:14px 16px;border:1px solid var(--slate-300);border-radius:8px;font-size:15px;font-family:"Inter",sans-serif;resize:vertical;transition:border .2s,box-shadow .2s;}
.product-description-input:focus{outline:none;border-color:var(--indigo-500);box-shadow:0 0 0 3px rgba(99,102,241,.35);}  

/* Thumbnail grid improvements */
#uploaded-thumbnails{display:grid;grid-template-columns:repeat(5,165px);gap:16px;max-width:none;margin:0;}
.thumb,.thumb-placeholder{width:165px;height:165px;position:relative;overflow:hidden;border-radius:10px;background:var(--bg-light);box-shadow:0 1px 3px rgba(0,0,0,.08);transition:transform .15s,box-shadow .15s;}
.thumb:hover{transform:scale(1.02);box-shadow:0 4px 12px rgba(0,0,0,.12);}  

.delete-thumb{position:absolute;top:6px;right:6px;background:#ffffffee;border:none;border-radius:50%;width:24px;height:24px;font-size:16px;line-height:24px;text-align:center;color:var(--slate-700);cursor:pointer;transition:background .2s,color .2s,transform .15s;}
.delete-thumb:hover{background:#ef4444;color:#fff;transform:scale(1.05);}  

/* Adjust option label spacing */
.opt-label{
  font-weight:500;
  color:#374151;
}
.opt-label + .opt-label{margin-left:24px;}

/* --- UI Kit Inspired Buttons (applied globally) --- */
/* Uses existing CSS variables defined above */

/* Base button */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 24px;
  font-size:15px;
  font-weight:500;
  border-radius:999px; /* pill shape */
  cursor:pointer;
  transition:all 0.2s ease;
  border:none;
  box-shadow:0 2px 8px rgba(0,0,0,0.06);
}

/* Primary filled */
.btn-primary{background:var(--indigo-500);color:#fff;}
.btn-primary:hover{background:var(--violet-500);box-shadow:0 4px 14px rgba(0,0,0,0.12);transform:translateY(-2px);} 

/* Secondary outlined */
.btn-secondary{background:var(--bg-light);color:var(--indigo-500);border:1px solid var(--indigo-500);} 
.btn-secondary:hover{background:var(--indigo-500);color:#fff;box-shadow:0 4px 14px rgba(0,0,0,0.1);transform:translateY(-2px);} 

/* Disabled state */
.btn:disabled{opacity:0.5;cursor:not-allowed;transform:none;box-shadow:none;}

/* Icon (circular) */
.btn-icon{width:40px;height:40px;border-radius:50%;padding:0;display:inline-flex;align-items:center;justify-content:center;background:var(--bg-light);color:var(--indigo-500);border:1px solid var(--indigo-500);} 
.btn-icon:hover{background:var(--indigo-500);color:#fff;box-shadow:0 4px 14px rgba(0,0,0,0.12);} 

/* Navigation pills */
.nav-btn{padding:8px 20px;border-radius:999px;font-weight:500;background:transparent;color:var(--indigo-500);transition:background 0.2s,color 0.2s;} 
.nav-btn:hover{background:var(--bg-light);}

/* New Header Styles */
.new-header {
    background-color: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 32px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.header-left, .header-right, .logo {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Hide header-nav on mobile by default (will be shown via JavaScript) */
@media (max-width: 640px) {
    .header-nav {
        display: none !important;
    }
}

.header-right{display:none;}

/* Show header-right on mobile */
@media (max-width: 640px) {
    .header-right {
        display: flex !important;
    }
}

.logo img {
    height: auto;
    width: 150px; /* make logo bigger and wider */
    border-radius: 6px;
}

.logo span {
    font-weight: 600;
    font-size: 18px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280; /* text-secondary */
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-item .icon {
    width: 20px;
    height: 20px;
}

.nav-item.active, .nav-item:hover {
    color: #6366f1; /* primary-color */
}

.nav-item.active {
    color: #4f46e5;
}

.header-right button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #374151; /* slate-700 */
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.header-right button .icon {
    width: 20px;
    height: 20px;
    color: #6b7280;
}

.header-right button:hover {
    background-color: #f9fafb; /* bg-light */
}



.settings-container {
    position: relative;
}

.settings-container .dropdown-menu {
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    position: absolute;
    z-index: 9999;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.user-info-section {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
}

.user-info-section img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-info-section span {
    font-weight: 600;
    color: var(--primary-text);
    font-size: 14px;
}

.settings-menu-items {
    padding: 8px;
}

.settings-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: none;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-text);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.settings-menu-item:hover {
    background-color: #f3f4f6;
    color: var(--primary-purple);
}

.settings-menu-item .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #6b7280;
}

.settings-menu-item:hover .icon {
    color: var(--primary-purple);
}

.settings-divider {
    border: none;
    height: 1px;
    background-color: #e5e7eb;
    margin: 4px 0;
}

.language-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-text);
}

.language-selector select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: var(--primary-text);
}

.language-selector select:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.logout-item {
    color: #dc2626;
    margin-top: 4px;
}

.logout-item:hover {
    background-color: #fef2f2;
    color: #b91c1c;
}

.logout-item .icon {
    color: #dc2626;
}

.logout-item:hover .icon {
    color: #b91c1c;
}

.btn-logout {
    display: none; /* Hide the old logout button */
}

/* Account Management Modal Styles */
.account-modal-content {
    max-width: 600px;
}

.account-info-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.account-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.account-details h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-text);
}

.account-details p {
    margin: 0;
    font-size: 14px;
    color: var(--secondary-text);
}

.account-status {
    color: #059669 !important;
    font-weight: 500;
}

.account-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

/* For screens wider than 480px, show 4 buttons in 2x2 grid */
@media (min-width: 480px) {
    .account-actions {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

.account-actions .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 16px;
    min-height: 80px;
    text-align: center;
}

.account-actions .btn-danger {
    background-color: #dc2626;
    color: white;
    border-color: #dc2626;
}

.account-actions .btn-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

.account-actions .btn-danger .icon {
    color: white;
}

.account-actions .icon {
    width: 24px;
    height: 24px;
    color: var(--primary-purple);
}

.account-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.stat-item {
    text-align: center;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-purple);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--secondary-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* App Settings Modal Styles */
.settings-modal-content {
    max-width: 600px;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-text);
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.setting-item label {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-text);
    flex: 1;
}

.setting-item select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: var(--primary-text);
    min-width: 140px;
}

.setting-item select:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.toggle-item {
    justify-content: space-between;
}

.toggle-item label {
    flex: none;
    margin-right: 16px;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* Settings Page Styles */
.settings-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.settings-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-text);
    margin-bottom: 32px;
    text-align: center;
}

.settings-section-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.10), 0 4px 16px rgba(0, 0, 0, 0.06);
}

.settings-section-card h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-text);
    margin: 0 0 24px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* Mobile responsiveness for settings modals */
@media (max-width: 640px) {
    .account-actions {
        grid-template-columns: 1fr;
    }

    .account-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .account-info-section {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .settings-actions {
        flex-direction: column-reverse;
    }

    .settings-actions .btn {
        width: 100%;
    }

    .settings-page-container {
        padding: 16px;
    }

    .settings-title {
        font-size: 24px;
        margin-bottom: 24px;
    }

    .settings-section-card {
        padding: 16px;
        margin-bottom: 16px;
    }

    /* Additional mobile header fixes */
    .new-header {
        padding: 0 16px;
        overflow-x: hidden;
    }

    .header-content {
        width: 100%;
        overflow-x: hidden;
        height: 60px; /* Slightly shorter on mobile */
    }

    .header-left, .header-right {
        min-width: 0;
        flex-shrink: 1;
    }

    .logo {
        min-width: 0;
        overflow: hidden;
    }
    
    .logo img {
        max-width: 130px;
        height: auto;
    }
}

/* All Cards */
.upload-section,
.video-description-section,
.voice-settings-section,
.subtitles-section,
.uploaded-images-section {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color);
    /* Soft neutral grey drop-shadow */
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.10), 0 4px 16px rgba(0, 0, 0, 0.06);
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    overflow-x: hidden;
    /* Ensure inner content doesn't overflow */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: relative;
}
.uploaded-images-section {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color);
}
 
 .upload-box {
     display: flex;
}

/* Upload Section */
.upload-box-label {
    border: 2px dashed var(--border-purple);
    border-radius: 12px;
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--light-purple-bg);
}

.upload-box-label:hover {
    border-color: var(--primary-purple);
    background-color: #FBF9FF;
}

.upload-icon-container {
    width: 48px;
    height: 48px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 16px auto;
}

.upload-icon {
    width: 24px;
    height: 24px;
    color: var(--primary-purple);
}

.upload-box-title { font-size: 16px; font-weight: 600; margin: 0; color: var(--primary-text); }
.upload-box-subtitle { color: var(--secondary-text); font-size: 14px; margin: 4px 0 16px 0; }
.upload-box .btn-primary {
    background: var(--primary-purple);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
}
.upload-box-info { font-size: 12px; color: var(--secondary-text); text-align: center; margin-top: 16px; }

.upload-section.has-images .upload-box {
    padding-bottom: 0;
}

.upload-section.has-images .upload-box-label {
    padding: 24px;
    min-height: auto;
}

/* Keep upload box size constant even after images uploaded */
.upload-section.has-images .upload-box{padding-bottom:24px;height:420px;}
.upload-section.has-images .upload-box-label{padding:48px;}

/* Uploaded Images Section */
.uploaded-images-section-inner {
    margin-top: 24px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
}

.uploaded-images-section-inner h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: var(--primary-text);
}
.thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
    padding: 0 24px;
}
.thumb, .thumb-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.thumb .delete-thumb {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.thumb:hover .delete-thumb {
    opacity: 1;
}
.thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--dashed-border);
    color: var(--dashed-border);
    font-size: 36px;
    font-weight: bold;
    background-color: #F9FAFB;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
}

.thumb-placeholder {
    display: grid;
    place-items: center;
    border: 2px dashed var(--dashed-border);
    color: var(--dashed-border);
    font-size: 36px;
    font-weight: bold;
    background-color: #F9FAFB;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
}
.thumb:hover {
    box-shadow: 0 0 0 3px var(--border-purple);
}

/* Right Column Sections */
.video-description-section label, .voice-settings-section > div > label {
    font-weight: 500;
    font-size: 14px;
    display: block;
    margin-bottom: 8px;
    color: var(--primary-text);
}

.video-description-section textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
}
.video-description-section textarea:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 2px var(--light-purple-bg);
}

.char-counter {
    font-size: 12px;
    color: var(--secondary-text);
    text-align: right;
    margin: 8px 0 0 0;
}

/* Voice Settings */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    width: 100%;
    box-sizing: border-box;
    align-items: start;
    padding: 0 24px;
}

.gender-and-subtitles {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
}

.voice-settings-section .language-options, .voice-settings-section .gender-options {
    margin-bottom: 0;
}
.language-grid, .gender-grid, .model-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
}

.model-options {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
}

.radio-card {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: stretch;
}

.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-card label {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    min-height: 0;
    flex: 1;
}

.radio-card input[type="radio"]:checked + label {
    border-color: var(--primary-purple);
    background-color: var(--light-purple-bg);
}

.radio-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.radio-card.disabled label {
    cursor: not-allowed;
}

/* Custom radio button dots removed */

/* Custom radio button checked state removed */


.radio-card .radio-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #FEE2E2; /* Example for Female */
    display: grid;
    place-items: center;
    margin-right: 12px;
    color: #EF4444;
}
.radio-card .gender-icon--female {
     background-color: #FEE2E2;
     color: #EF4444;
}
.radio-card .gender-icon--male {
     background-color: #DBEAFE;
     color: #3B82F6;
}
.radio-card .lang-icon {
    font-weight: 500;
    color: var(--primary-text);
    border: 1px solid var(--border-color);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin-right: 12px;
}

.radio-card .radio-text p {
    font-weight: 500;
    margin: 0;
    color: var(--primary-text);
}
.radio-card .radio-text span {
    font-size: 12px;
    color: var(--secondary-text);
}

.radio-card .play-icon {
    width: 20px;
    height: 20px;
    color: var(--primary-purple);
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.radio-card input[type="radio"]:checked + label .play-icon {
    opacity: 1;
}


/* Subtitles Section */
.subtitles-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background-color: var(--light-purple-bg);
    border-radius: 16px; /* Add back border-radius */
    border: 1px solid transparent; /* To prevent layout shift on hover if needed */
    width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
    gap: 12px;
}
.subtitle-icon {
    width: 40px;
    height: 40px;
    background-color: #fff;
    color: var(--primary-purple);
    border-radius: 8px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-color);
}
.subtitle-icon svg { width: 24px; height: 24px; }
.subtitle-text { flex-grow: 1; margin: 0 16px; }
.subtitle-text p { font-weight: 600; margin: 0; color: var(--primary-text); }
.subtitle-text span { font-size: 14px; color: var(--secondary-text); }

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider { background-color: var(--primary-purple); }
input:checked + .slider:before { transform: translateX(20px); }

.action-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.action-buttons .btn-primary {
    background: var(--primary-purple);
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 500;
}

.fab-container{
    margin-top:32px;
    display:flex;
    justify-content:center;
    gap:24px;
}
.fab{padding:18px 32px;border-radius:999px;font-size:18px;font-weight:600;cursor:pointer;box-shadow:0 4px 12px rgba(0,0,0,.15);transition:transform .15s,box-shadow .15s;}
.fab:hover{transform:translateY(-2px);box-shadow:0 6px 18px rgba(0,0,0,.2);}
.fab.btn-primary:hover{background:var(--indigo-500);color:#fff;box-shadow:0 6px 18px rgba(0,0,0,.2);}
.fab.btn-secondary:hover{background:var(--bg-light);color:var(--indigo-500);border-color:var(--indigo-500);box-shadow:0 6px 18px rgba(0,0,0,.2);}

/* ===== COMPACT NO-SCROLL REDESIGN STYLES ===== */

.redesigned-main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 24px;
    box-sizing: border-box;
    height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Drag and Drop Styles */
.drag-over {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
    border: 2px dashed #0ea5e9 !important;
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.15) !important;
}

.drag-over .upload-label-compact {
    border-color: #0ea5e9 !important;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
}

.drag-over .thumb-placeholder {
    border-color: #0ea5e9 !important;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
}

/* Hero Section - Compact */
.hero-section-new {
    text-align: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.hero-title-new {
    font-size: 36px;
    font-weight: 700;
    background: linear-gradient(135deg, #7C3AED 0%, #EC4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 6px 0;
    line-height: 1.2;
}

.hero-subtitle-new {
    font-size: 14px;
    color: var(--secondary-text);
    margin: 0;
    line-height: 1.4;
}

/* Content Grid - 2 Columns */
.content-grid-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex: 1;
    min-height: 0;
    margin-bottom: 16px;
}

.left-col-compact, .right-col-compact {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

/* Compact Panel Styles */
.panel-compact {
    background: white;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel-compact:hover {
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.12);
    border-color: #e9d5ff;
}

.panel-header-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f5f5f5;
    flex-shrink: 0;
}

.panel-icon-badge-compact {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.panel-icon-badge-compact svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5px;
}

.panel-header-compact h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-text);
    margin: 0;
}

/* Upload Panel Compact */
.upload-panel-compact {
    flex: 0 0 auto;
    height: 500px;
    display: flex;
    flex-direction: column;
}

.upload-zone-compact {
    margin-bottom: 12px;
}

.upload-label-compact {
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #faf5ff 0%, #fef3f9 100%);
}

.upload-label-compact:hover {
    border-color: #c084fc;
    background: linear-gradient(135deg, #f5edff 0%, #fce7f3 100%);
}

.upload-icon-compact {
    width: 32px;
    height: 32px;
    color: #a855f7;
}

.upload-label-compact strong {
    font-size: 15px;
    color: var(--primary-text);
    font-weight: 600;
    margin: 0;
}

.upload-label-compact span {
    font-size: 14px;
    color: var(--secondary-text);
    max-width: 280px;
    text-align: center;
    line-height: 1.4;
}

/* Preview Section Compact */
.preview-section-compact {
    flex-shrink: 0;
}

.preview-count-compact {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-text);
    display: block;
    margin-bottom: 12px;
    text-align: center;
}

.preview-grid-compact {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    justify-items: center;
    max-width: 300px;
    margin: 0 auto;
}

.preview-grid-compact .thumb,
.preview-grid-compact .thumb-placeholder {
    width: 98%;
    max-width: 480px;
    aspect-ratio: 1;
    border-radius: 10px;
    border: 2px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 600;
    color: #d0d0d0;
    background: #fafafa;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.preview-grid-compact .thumb {
    border-color: #c084fc;
}

.preview-grid-compact .thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

.preview-grid-compact .thumb-placeholder:hover {
    border-color: #c084fc;
    background: linear-gradient(135deg, #faf5ff 0%, #fef3f9 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

.preview-grid-compact .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Description Panel Compact */
.description-panel-compact {
    flex: 0 0 auto;
    height: 300px;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.desc-textarea-compact {
    width: 100%;
    flex: 1;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    padding: 12px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    transition: all 0.3s ease;
    line-height: 1.5;
    box-sizing: border-box;
    min-height: 0;
}

.desc-textarea-compact:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

/* Voice Panel Compact */
.voice-panel-compact {
    flex: 0 0 auto;
    height: 550px;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.voice-content-compact {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.setting-group-compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.setting-label-compact {
    font-weight: 600;
    font-size: 14px;
    color: var(--primary-text);
}

.options-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.gender-grid-compact {
    grid-template-columns: repeat(2, 1fr);
}

.option-card-compact {
    position: relative;
}

.option-card-compact input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.option-card-compact label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 2px solid #e5e5e5;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    min-height: 40px;
    box-sizing: border-box;
}

.option-card-compact input[type="radio"]:checked + label {
    border-color: #a855f7;
    background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 100%);
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.15);
}

.option-card-compact.disabled label {
    opacity: 0.4;
    cursor: not-allowed;
}

.option-card-compact label:hover:not(.option-card-compact.disabled label) {
    border-color: #c084fc;
}

.option-flag-compact {
    font-size: 20px;
    flex-shrink: 0;
}

.option-icon-compact {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.female-icon-compact {
    background: #fce7f3;
    color: #ec4899;
}

.male-icon-compact {
    background: #dbeafe;
    color: #3b82f6;
}

.option-card-compact label strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-text);
    flex: 1;
}

.play-icon-compact {
    width: 16px;
    height: 16px;
    color: #a855f7;
    opacity: 0;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.option-card-compact input[type="radio"]:checked + label .play-icon-compact {
    opacity: 1;
}

/* Toggle Setting Compact */
.toggle-setting-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 100%);
    border-radius: 10px;
    border: 2px solid #f0f0f0;
    min-height: 48px;
    box-sizing: border-box;
}

.toggle-info-compact {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-icon-compact {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a855f7;
    flex-shrink: 0;
}

.toggle-icon-compact svg {
    width: 20px;
    height: 20px;
}

.toggle-info-compact strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-text);
}

/* Progress Container Compact */
.progress-container-compact {
    margin: 16px 0;
}

.progress-panel-compact {
    text-align: center;
}

.progress-title-compact {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-text);
    margin-bottom: 16px;
}

/* Action Buttons Compact */
.action-buttons-compact {
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 16px;
}

.btn-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    flex: 1;
    box-sizing: border-box;
}

.btn-compact svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.btn-primary-compact {
    background: linear-gradient(135deg, #7C3AED 0%, #EC4899 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.btn-primary-compact:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.5);
}

.btn-secondary-compact {
    background: white;
    color: #7C3AED;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.btn-secondary-compact:hover {
    border-color: #c084fc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

/* Responsive for Compact Design */
@media (max-width: 1200px) {
    .content-grid-compact {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    
    .redesigned-main {
        height: auto;
        overflow-y: auto;
    }
    
    .hero-title-new {
        font-size: 30px;
    }
}

@media (max-width: 768px) {
    .redesigned-main {
        padding: 16px;
    }
    
    .hero-section-new {
        margin-bottom: 12px;
    }
    
    .hero-title-new {
        font-size: 26px;
    }
    
    .hero-subtitle-new {
        font-size: 13px;
    }
    
    .panel-compact {
        padding: 14px;
    }
    
    .content-grid-compact {
        gap: 14px;
    }
    
    .preview-grid-compact {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .options-grid-compact {
        grid-template-columns: 1fr;
    }
    
    .action-buttons-compact {
        flex-direction: column;
    }
}
  
/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Large Tablets and Small Laptops (900px - 1200px) */
@media (max-width: 1200px) {
    .main-container {
        gap: 24px;
        padding: 0 20px;
    }
    
    .app-main-content {
        padding: 24px 20px;
        padding-top: 88px;
    }
}

/* Tablets and Half-Screen (641px - 900px) - Switch to single column */
@media (max-width: 900px) {
    .main-container {
        grid-template-columns: 1fr;
        gap: 24px;
        max-width: 700px;
        padding: 0 24px;
    }
    
    .app-main-content {
        padding: 24px;
        padding-top: 88px;
    }
    
    .left-column, .right-column {
        gap: 24px;
    }
    
    .upload-section,
    .video-description-section,
    .voice-settings-section {
        padding: 24px;
    }
}

/* Mobile Devices (up to 640px) */
@media (max-width:640px){
    .main-container{
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 0 16px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .fab-container{
        flex-direction: column;
        gap: 12px;
        margin-top: 24px;
    }
    
    .fab {
        width: 100%;
        padding: 16px 24px;
        font-size: 16px;
        min-height: 52px; /* Better touch targets */
    }
    
    #main-nav{
        display: none;
        flex-direction: column;
        gap: 12px;
        position: absolute;
        top: 64px;
        right: 16px;
        background: #ffffff;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 12px 16px;
        box-shadow: 0 8px 24px rgba(0,0,0,.12);
        max-width: calc(100vw - 32px);
        box-sizing: border-box;
        z-index: 10000;
    }
    
    #main-nav.show {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .nav-item {
        padding: 12px 0;
        border-bottom: 1px solid var(--border-color);
        font-size: 16px;
    }

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

    .nav-item:hover {
        background-color: var(--light-purple-bg);
        border-radius: 6px;
        margin: 2px 0;
        padding-left: 12px;
        padding-right: 12px;
    }

    .mobile-menu-btn{
        display: flex !important;
        background: none;
        border: none;
        color: #374151;
        padding: 8px;
        cursor: pointer;
        border-radius: 6px;
        transition: background-color 0.2s;
        position: relative;
        z-index: 10001;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
    }
    .mobile-menu-btn:hover{
        background-color: #f3f4f6;
    }
    .mobile-menu-btn svg {
        width: 24px;
        height: 24px;
    }

    /* Ensure no horizontal overflow */
    .left-column, .right-column {
        width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    /* Adjust main content padding for small screens */
    .app-main-content {
        padding: 20px 16px;
        padding-top: 88px; /* Header height + spacing */
    }

    /* Make cards more compact on mobile */
    .upload-section,
    .video-description-section,
    .voice-settings-section,
    .subtitles-section,
    .uploaded-images-section {
        padding: 20px;
        margin-bottom: 0;
    }

    /* Mobile form elements */
    .video-description-section textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 100px;
        padding: 12px 16px;
    }

    /* Fix inner elements to use full width on mobile */
    .upload-box {
        width: 100%;
        height: 360px; /* Slightly shorter on mobile */
    }

    .thumbnails-grid {
        width: 100%;
    }

    .settings-grid {
        width: 100%;
        padding: 0;
    }

    .radio-card label {
        padding: 12px;
        font-size: 14px;
        min-height: 48px; /* Better touch targets */
    }

    .model-options {
        gap: 8px;
    }

    .radio-card {
        min-width: 0;
    }

    /* Ensure buttons don't overflow */
    .fab {
        padding: 14px 20px;
        font-size: 16px;
        min-width: 0;
        white-space: nowrap;
    }

    .btn {
        font-size: 14px;
        padding: 10px 16px;
        min-width: 0;
    }
}

@media(min-width:641px){.mobile-menu-btn{display:none;}}

/* Ensure mobile menu button is visible on mobile */
@media (max-width: 640px) {
    .mobile-menu-btn {
        display: flex !important;
        position: fixed !important;
        top: 16px !important;
        right: 16px !important;
        z-index: 10001 !important;
    }
}

@media (max-width:640px) {
    #uploaded-thumbnails{
        grid-template-columns: repeat(3, 1fr);
        gap:8px;
        width:100%;
        overflow-x: hidden;
    }
    .thumb,.thumb-placeholder{
        height:70px;
        min-width: 0;
    }
    .main-container{
        width:100%;
        overflow-x: hidden;
    }

    /* Additional small screen fixes */
    .thumbnails-grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .thumbnails-grid::-webkit-scrollbar {
        display: none;
    }

    /* Ensure header remains visible on mobile step-by-step page */
    .app-header {
        position: sticky;
        top: 0;
        z-index: 100;
    }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
    .new-header {
        padding: 0 12px;
    }

    .app-main-content {
        padding: 16px 12px;
        padding-top: 80px;
    }

    .main-container {
        gap: 20px;
        padding: 0 12px;
    }

    #uploaded-thumbnails {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
        padding: 0;
    }

    .thumb, .thumb-placeholder {
        height: 60px;
    }

    /* Even more compact cards */
    .upload-section,
    .video-description-section,
    .voice-settings-section,
    .subtitles-section,
    .uploaded-images-section {
        padding: 16px;
        margin-bottom: 0;
        border-radius: 12px;
    }

    .fab {
        padding: 14px 20px;
        font-size: 15px;
    }

    .btn {
        font-size: 14px;
        padding: 10px 16px;
        min-height: 44px; /* Better touch targets */
    }

    /* Adjust logo size */
    .logo img {
        max-width: 120px;
    }

    /* Compact navigation */
    .nav-item {
        padding: 8px 10px;
        font-size: 14px;
        min-height: 44px; /* Better touch targets */
    }

    /* Fix inner elements to use full width on extra small screens */
    .upload-box {
        width: 100%;
        height: 320px;
    }

    .thumbnails-grid {
        width: 100%;
        gap: 6px;
    }

    .video-description-section textarea {
        width: 100%;
        padding: 12px 16px;
        min-height: 80px;
        font-size: 16px; /* Prevent iOS zoom */
    }

    .settings-grid {
        width: 100%;
        padding: 0;
        gap: 12px;
    }
}

/* Feedback Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}


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

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--secondary-text);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

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

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
}

.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 2px var(--light-purple-bg);
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.feedback-modal-content {
    max-width: 500px;
}

/* Mobile responsiveness for feedback modal */
@media (max-width: 640px) {
    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
        max-width: none;
    }

    /* Override for settings modal specifically */
    .modal-content.settings-modal-content {
        max-height: none !important;
        overflow-y: visible !important;
        height: auto !important;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* Payment Modal Styles */
.payment-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.payment-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.payment-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-text);
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--secondary-text);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.close-modal-btn:hover {
    background-color: var(--light-purple-bg);
    color: var(--primary-text);
}

.payment-modal-body {
    padding: 24px;
}

.pricing-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.pricing-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    position: relative;
    transition: all 0.2s;
}

.pricing-card:hover {
    border-color: var(--primary-purple);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pricing-card.featured {
    border-color: var(--primary-purple);
    background: linear-gradient(135deg, #fef7ff 0%, #fdf4ff 100%);
}

.pricing-card h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-text);
}

.price {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-purple);
    margin: 0 0 8px 0;
}

.description {
    color: var(--secondary-text);
    margin: 0 0 20px 0;
    font-size: 14px;
}

.badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-purple);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.buy-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-purple);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.buy-btn:hover {
    background: #6d28d9;
}

/* Token Display Styles */
.token-display {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.token-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-text);
}

.token-info.subscription {
    background: linear-gradient(135deg, #fef7ff 0%, #fdf4ff 100%);
    border-color: var(--primary-purple);
    color: var(--primary-purple);
}

.token-info svg {
    width: 16px;
    height: 16px;
}

.buy-tokens-btn {
    background: var(--primary-purple);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.buy-tokens-btn:hover {
    background: #6d28d9;
}

/* Mobile Token Section */
.mobile-token-section {
    display: none;
    padding: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 16px;
}

.mobile-token-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--primary-text);
}

.mobile-token-info svg {
    width: 16px;
    height: 16px;
    color: var(--primary-purple);
    flex-shrink: 0;
}

.mobile-buy-tokens-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--primary-purple);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.mobile-buy-tokens-btn:hover {
    background: #6d28d9;
}

/* Show mobile token section on mobile devices */
@media (max-width: 640px) {
    .mobile-token-section {
        display: block;
    }

    /* Hide desktop token display on mobile */
    .token-display {
        display: none !important;
    }
}

/* Mobile menu styles */
@media (max-width: 640px) {
    #main-nav {
        display: none !important;
    }

    #main-nav.show {
        display: flex !important;
        flex-direction: column;
        gap: 12px;
        position: absolute;
        top: 64px;
        right: 16px;
        background: #ffffff;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 12px 16px;
        box-shadow: 0 8px 24px rgba(0,0,0,.12);
        max-width: calc(100vw - 32px);
        box-sizing: border-box;
        z-index: 10000;
    }

    .nav-item {
        padding: 12px 0;
        border-bottom: 1px solid var(--border-color);
        font-size: 16px;
    }

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

    .nav-item:hover {
        background-color: var(--light-purple-bg);
        border-radius: 6px;
        margin: 2px 0;
        padding-left: 12px;
        padding-right: 12px;
    }

    .mobile-menu-btn {
        display: flex !important;
        position: fixed !important;
        top: 16px !important;
        right: 16px !important;
        z-index: 10001 !important;
    }
}

@media (max-width: 640px) {
    .pricing-options {
        grid-template-columns: 1fr;
    }

    .payment-modal {
        margin: 20px;
        width: calc(100% - 40px);
    }
}

/* Script Editor Styles */
.script-editor-container {
    margin-top: 20px;
}

.script-editor, .script-display {
    margin-bottom: 15px;
}

.script-editor textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    margin-bottom: 10px;
}

.script-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.script-display p {
    background-color: var(--light-bg);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.script-info {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Voiceover script textarea full width */
.voiceover-script-section textarea {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
}

/* Make gender and language buttons less wide */
.voice-settings-section .model-options {
    display: flex !important;
    flex-direction: row !important;
    gap: 12px;
    justify-content: flex-start;
}

.voice-settings-section .radio-card {
    width: auto !important;
    min-width: 120px;
    max-width: 200px;
    flex: none !important;
}

.voice-settings-section .radio-card label {
    width: auto !important;
    min-width: 120px;
    max-width: 200px;
    flex: none !important;
}

/* Voiceover header row - position label and counter side by side */
.voiceover-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.voiceover-header-row .step-label {
    margin: 0;
    flex: 1;
}

.voiceover-header-row .script-info {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 15px;
}

/* New Step-by-Step Layout Styles */
.step-by-step-content {
    max-width: 1800px; /* Increased max-width to utilize more browser width */
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}


/* Segment Columns */
.segments-container {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.segments-wrapper {
    display: flex;
    gap: 16px;
    flex: 1;
}

.segment-column {
    min-width: 280px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.segment-column.collapsed {
    min-width: 60px;
    max-width: 60px;
}

.segment-column.collapsed .segment-content {
    display: none;
}

.segment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--primary-color-light);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

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


.segment-header.collapsed {
    justify-content: center;
    padding: 12px;
}

.segment-number {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    min-width: 24px;
    text-align: center;
}

.segment-toggle {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.segment-column.collapsed .segment-toggle {
    transform: rotate(180deg);
}

.segment-content {
    padding: 16px;
}

.segment-step {
    margin-bottom: 20px;
}

.segment-step:last-child {
    margin-bottom: 0;
}

.step-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-text);
    margin-bottom: 8px;
    display: block;
}

.prompt-input-group {
    margin-bottom: 12px;
}

.prompt-textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color-light);
}

.step-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.media-placeholder {
    width: 100%;
    height: 120px;
    background: #f9fafb;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.media-display {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 12px;
    display: none;
}

.media-display img,
.media-display video {
    width: 100%;
    border-radius: 8px;
}

/* Force visibility for media display when it has content */
.media-display[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.media-display img[style*="display: block"],
.media-display video[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

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

/* Add More Seconds Button */
.add-segment-column {
    min-width: 280px;
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-segment-column:hover {
    border-color: var(--primary-color);
    background: var(--primary-color-light);
}

.add-segment-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
}

.add-icon {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.add-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Voiceover Section */
.voiceover-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.voiceover-section h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.voiceover-subtitle {
    margin: 0 0 16px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.voiceover-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.voice-settings-section {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.voiceover-preview {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.voiceover-preview .btn {
    margin-bottom: 16px;
}

/* Final Video Section */
.final-video-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.final-video-section .btn {
    margin-bottom: 16px;
}

#final-video-container {
    margin-top: 16px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .segments-container {
        flex-wrap: wrap;
    }

    .segment-column {
        min-width: 100%;
    }

    .add-segment-column {
        min-width: 100%;
    }

    .voice-settings-section {
        flex-direction: column;
        gap: 16px;
    }
}

/* Mobile floating menu panel */
@media (max-width: 640px) {
    #mobile-menu-overlay {
        background: rgba(0,0,0,0.35);
        backdrop-filter: blur(2px);
    }

    #mobile-menu-panel {
        position: fixed;
        top: 64px;
        right: 16px;
        left: auto;
        background: #ffffff;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 12px;
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
        z-index: 10000;
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-width: 220px;
        max-width: calc(100vw - 32px);
        animation: mobileMenuSlideIn .18s ease-out;
    }

    #mobile-menu-panel .nav-item {
        display: flex;
        align-items: center;
        gap: 8px;
        text-decoration: none;
        font-size: 16px;
        font-weight: 500;
        color: #374151; /* slate-700 */
        padding: 10px 12px;
        border-radius: 8px;
        transition: background-color 0.2s ease, color 0.2s ease;
    }

    #mobile-menu-panel .nav-item .icon {
        width: 20px;
        height: 20px;
        color: #6b7280;
        flex-shrink: 0;
    }

    #mobile-menu-panel .nav-item:hover,
    #mobile-menu-panel .nav-item.active {
        background-color: var(--light-purple-bg);
        color: #6366f1; /* primary */
    }

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



/* ===== Step-by-step/Edit view layout fixes ===== */
/* Keep minimal left spacing and align content flush-left */
#step-by-step-view .main-container,
#edit-view .main-container {
    max-width: 100% !important;
    margin: 0 !important;
    padding-left: 12px !important; /* minimal left space */
}

#step-by-step-view .step-by-step-content,
#edit-view .step-by-step-content {
    max-width: 100% !important;
    margin: 0 !important;
    padding-left: 12px !important; /* minimal left space */
}

#step-by-step-view .segments-container,
#edit-view .segments-container {
    padding-left: 0 !important;
    margin-left: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap; /* keep columns in a single row */
}

/* ===== Voiceover sizing rules ===== */
/* Keep the voiceover panel at a stable viewport-based size and avoid page growth */
#step-by-step-view .voiceover-section,
#edit-view .voiceover-section {
    max-height: calc(100vh - 160px);
    overflow: auto;
    max-width: 100%;
    overflow-x: hidden;
}

/* Ensure inner groups don't stretch the panel height */
#step-by-step-view .voiceover-script-section,
#edit-view .voiceover-script-section,
#step-by-step-view .voice-settings-section,
#edit-view .voice-settings-section,
#step-by-step-view .voiceover-preview,
#edit-view .voiceover-preview {
    min-height: 0;
}

/* Keep textarea from auto-expanding the panel height */
#step-by-step-view #voiceover-script-textarea,
#edit-view #voiceover-script-textarea {
    max-height: 240px;
    overflow: auto;
}

/* Ensure media controls never overflow width */
#step-by-step-view .voiceover-section audio,
#edit-view .voiceover-section audio {
    width: 100%;
    max-width: 100%;
}
