/* Design Tokens - Based on OpenAI Apps SDK UI */
:root {
    /* Colors */
    --color-primary: #075488;
    --color-primary-hover: #054a77;
    --color-secondary: #94a8c3;
    --color-success: #10b981;
    --color-success-soft: rgba(16, 185, 129, 0.15);
    --color-danger: #ef4444;
    --color-warning: #f59e0b;

    /* Surfaces */
    --bg-surface: #ffffff;
    --bg-surface-secondary: #f4f4f5;
    --bg-surface-tertiary: #e4e4e7;

    /* Text */
    --text-default: #18181b;
    --text-secondary: #71717a;
    --text-tertiary: #a1a1aa;

    /* Borders */
    --border-default: #e4e4e7;
    --border-subtle: #f4f4f5;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-2xl: 12px;
    --radius-3xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

    /* Sidebar */
    --sidebar-width: 390px;
    --sidebar-collapsed-width: 64px;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-surface: #18181b;
    --bg-surface-secondary: #27272a;
    --bg-surface-tertiary: #3f3f46;

    --text-default: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;

    --border-default: #3f3f46;
    --border-subtle: #27272a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

/* ============================================
   AUTH OVERLAY
   ============================================ */

.auth-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1.5rem;
}

.auth-overlay.hidden {
    display: none;
}

.auth-card {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-2xl);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.auth-logo-wrap {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-xl);
    background: #ffffff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

[data-theme="dark"] .auth-logo-wrap {
    background: var(--bg-surface-tertiary);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.auth-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.auth-title {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-default);
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-bottom: 1.5rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    color: var(--text-default);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(7, 84, 136, 0.15);
}

.auth-input::placeholder {
    color: var(--text-tertiary);
}

.auth-button {
    width: 100%;
    padding: 0.625rem;
    border: none;
    border-radius: var(--radius-lg);
    background: #18181b;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 550;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

[data-theme="dark"] .auth-button {
    background: #fafafa;
    color: #18181b;
}

.auth-button:hover {
    background: #3f3f46;
}

[data-theme="dark"] .auth-button:hover {
    background: #e4e4e7;
}

.auth-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auth-error {
    font-size: 0.8125rem;
    color: var(--color-danger);
    min-height: 1.25rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-surface);
    min-height: 100vh;
    color: var(--text-default);
    padding: 40px;
    line-height: 1.5;
    transition: padding-left 0.3s ease;
}

body.sidebar-visible {
    padding-left: calc(var(--sidebar-width) + 40px);
}

body.sidebar-visible.sidebar-collapsed {
    padding-left: calc(var(--sidebar-collapsed-width) + 40px);
}

/* ============================================
   LEFT SIDEBAR NAVIGATION
   ============================================ */

.left-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-surface-secondary);
    border-right: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: width 0.3s ease;
    overflow: hidden;
}

body.sidebar-collapsed .left-sidebar {
    width: var(--sidebar-collapsed-width);
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
    min-height: 56px;
}

/* Sidebar Brand (Logo + Title) */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-default);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease;
}

body.sidebar-collapsed .sidebar-title {
    opacity: 0;
    width: 0;
}

.sidebar-collapse-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: color 0.15s ease, background 0.15s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    color: var(--color-primary);
    background: rgba(7, 84, 136, 0.1);
}

body.sidebar-collapsed .sidebar-collapse-btn {
    transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 14px 0;
}

body.sidebar-collapsed .sidebar-brand {
    display: none;
}

body.sidebar-collapsed .sidebar-logo {
    display: none;
}

/* Show only logo in collapsed header (optional - if you want logo visible) */
body.sidebar-collapsed .sidebar-header .sidebar-collapse-btn {
    margin: 0;
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 24px;
}

body.sidebar-collapsed .sidebar-content {
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Sidebar Sections */
.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease;
}

body.sidebar-collapsed .sidebar-section-title {
    opacity: 0;
    height: 0;
    margin: 0;
    padding: 0;
}

body.sidebar-collapsed .sidebar-section {
    margin-bottom: 8px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Sidebar Video */
.sidebar-video-container {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface-tertiary);
    cursor: pointer;
    transition: opacity 0.2s ease, height 0.3s ease;
    margin-top: 8px;
}

body.sidebar-collapsed .sidebar-video-container {
    display: none;
}

.sidebar-video-container video {
    width: 100%;
    display: block;
    border-radius: var(--radius-lg);
}

.sidebar-video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(7, 84, 136, 0.9);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.sidebar-video-play:hover {
    background: var(--color-primary);
    transform: translate(-50%, -50%) scale(1.1);
}

.sidebar-video-play.hidden {
    opacity: 0;
    pointer-events: none;
}

.sidebar-video-play svg {
    margin-left: 3px;
}

.sidebar-video-expand {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.sidebar-video-container:hover .sidebar-video-expand {
    opacity: 1;
}

.sidebar-video-expand:hover {
    background: rgba(7, 84, 136, 0.9);
}

/* Sidebar Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav-item:hover {
    background: var(--bg-surface-tertiary);
    color: var(--text-default);
}

.sidebar-nav-item.active {
    background: rgba(7, 84, 136, 0.15);
    color: var(--color-primary);
}

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

.nav-label {
    transition: opacity 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

body.sidebar-collapsed .nav-label {
    opacity: 0;
    width: 0;
}

/* Collapsed state - nav items */
body.sidebar-collapsed .sidebar-nav {
    width: 100%;
    align-items: center;
    gap: 0;
}

body.sidebar-collapsed .sidebar-nav-item {
    position: relative;
    justify-content: center;
    padding: 14px 0;
    margin: 0;
    width: 100%;
    border-radius: 0;
    gap: 0;
}

body.sidebar-collapsed .sidebar-nav-item svg {
    width: 22px;
    height: 22px;
}

body.sidebar-collapsed .sidebar-nav-item:hover {
    background: var(--bg-surface-tertiary);
}

body.sidebar-collapsed .sidebar-nav-item.active {
    background: rgba(7, 84, 136, 0.2);
}

body.sidebar-collapsed .sidebar-nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-surface-tertiary);
    color: var(--text-default);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

body.sidebar-collapsed .sidebar-nav-item:hover::after {
    opacity: 1;
}

/* Sidebar Accordion (Help) */
.sidebar-accordion-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-accordion-btn:hover {
    background: var(--bg-surface-tertiary);
    color: var(--text-default);
}

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

.accordion-arrow {
    margin-left: auto;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

body.sidebar-collapsed .accordion-arrow {
    display: none;
}

.sidebar-accordion-btn.open .accordion-arrow {
    transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar-accordion-btn {
    justify-content: center;
    padding: 14px 0;
    margin: 0;
    width: 100%;
    position: relative;
    border-radius: 0;
    gap: 0;
}

body.sidebar-collapsed .sidebar-accordion-btn svg:first-child {
    width: 22px;
    height: 22px;
}

body.sidebar-collapsed .sidebar-accordion-btn .nav-label {
    display: none;
}

/* Tooltip for accordion in collapsed state */
body.sidebar-collapsed .sidebar-accordion-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-surface-tertiary);
    color: var(--text-default);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

body.sidebar-collapsed .sidebar-accordion-btn:hover::after {
    opacity: 1;
}

/* Accordion Content */
.sidebar-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-accordion-content.open {
    max-height: 800px;
}

body.sidebar-collapsed .sidebar-accordion-content {
    display: none;
}

.help-item {
    padding: 12px;
    margin-top: 8px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.help-item h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.help-item ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-item li {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 2px 0;
    padding-left: 12px;
    position: relative;
}

.help-item li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--text-tertiary);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-default);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

body.sidebar-collapsed .sidebar-footer {
    padding: 8px 0;
    gap: 0;
    align-items: center;
}

/* Theme Toggle Button */
.sidebar-theme-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.sidebar-theme-btn:hover {
    background: var(--bg-surface-tertiary);
    color: var(--text-default);
}

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

/* Show sun in dark mode, moon in light mode */
.theme-icon-sun {
    display: none;
}

.theme-icon-moon {
    display: block;
}

[data-theme="dark"] .theme-icon-sun {
    display: block;
}

[data-theme="dark"] .theme-icon-moon {
    display: none;
}

body.sidebar-collapsed .sidebar-theme-btn {
    justify-content: center;
    padding: 14px 0;
    margin: 0;
    width: 100%;
    border-radius: 0;
    gap: 0;
}

body.sidebar-collapsed .sidebar-theme-btn .nav-label {
    opacity: 0;
    width: 0;
}

body.sidebar-collapsed .sidebar-theme-btn svg {
    width: 22px;
    height: 22px;
}

/* Tooltip for theme toggle in collapsed state */
body.sidebar-collapsed .sidebar-theme-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-surface-tertiary);
    color: var(--text-default);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

body.sidebar-collapsed .sidebar-theme-btn:hover::after {
    opacity: 1;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* Typography */
header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    margin-bottom: 16px;
}

.logo svg {
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

h1 {
    font-size: 24px;
    font-weight: 600;
    line-height: 28px;
    margin-bottom: 8px;
    color: var(--text-default);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 20px;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-2xl);
    padding: 48px 32px;
    text-align: center;
    background: var(--bg-surface-secondary);
    transition: all 0.15s ease;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: var(--color-primary);
    background: rgba(7, 84, 136, 0.05);
}

.drop-zone.drag-over {
    border-color: var(--color-primary);
    border-style: solid;
    background: rgba(7, 84, 136, 0.1);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.upload-icon {
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.drop-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-default);
}

.or-text {
    color: var(--text-tertiary);
    font-size: 14px;
}

/* Button - Primary Solid */
.browse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
    border: none;
}

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

/* Status Bar */
.status-bar {
    margin-top: 20px;
    padding: 12px 16px;
    background: var(--bg-surface-secondary);
    border-radius: var(--radius-lg);
    text-align: center;
    display: none;
    border: 1px solid var(--border-default);
}

.status-bar.visible {
    display: block;
}

#statusText {
    color: var(--text-secondary);
    font-size: 14px;
}

.status-bar.converting #statusText {
    color: var(--color-warning);
}

.status-bar.success #statusText {
    color: var(--color-success);
}

.status-bar.error #statusText {
    color: var(--color-danger);
}

/* Results Section */
.results {
    margin-top: 32px;
}

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

.results-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-default);
}

/* Button - Success */
.download-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-success);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.download-all-btn:hover {
    opacity: 0.9;
}

/* Image Grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

/* Image Card */
.image-card {
    background: var(--bg-surface-secondary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--border-default);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.image-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.image-preview {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-surface-tertiary);
    display: block;
}

.image-info {
    padding: 12px;
}

.image-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-default);
}

/* Button - Secondary Soft */
.download-btn {
    width: 100%;
    background: rgba(7, 84, 136, 0.1);
    color: var(--color-primary);
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.download-btn:hover {
    background: rgba(7, 84, 136, 0.2);
}

/* Loading Indicator */
.converting-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    color: var(--text-tertiary);
    font-size: 14px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-default);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 900px) {
    body.sidebar-visible {
        padding: 24px 16px 24px calc(var(--sidebar-collapsed-width) + 16px);
    }

    body.sidebar-visible.sidebar-collapsed {
        padding-left: calc(var(--sidebar-collapsed-width) + 16px);
    }

    .left-sidebar {
        width: var(--sidebar-collapsed-width);
    }

    .sidebar-title,
    .sidebar-section-title,
    .nav-label,
    .sidebar-video-container,
    .sidebar-accordion-content,
    .accordion-arrow {
        display: none;
    }

    .sidebar-nav-item,
    .sidebar-accordion-btn {
        justify-content: center;
        padding: 10px;
    }

    .sidebar-collapse-btn {
        display: none;
    }
}

@media (max-width: 600px) {
    body,
    body.sidebar-visible,
    body.sidebar-visible.sidebar-collapsed {
        padding: 24px 16px;
    }

    .left-sidebar {
        display: none !important;
    }

    h1 {
        font-size: 20px;
    }

    .drop-zone {
        padding: 32px 20px;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .results-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

/* ============================================
   AUDIO CONVERTER SECTION
   ============================================ */

/* Section Divider */
.section-divider {
    border: none;
    border-top: 1px solid var(--border-default);
    margin: 48px 0;
}

/* Audio Section Header */
.audio-section {
    margin-top: 32px;
}

.section-header {
    text-align: center;
    margin-bottom: 32px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 600;
    line-height: 28px;
    margin-bottom: 8px;
    color: var(--text-default);
}

/* Audio Files Grid (2 columns) */
.audio-files {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
}

/* Audio Card */
.audio-card {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.audio-card.selected {
    border-color: #075488;
    box-shadow: 0 0 0 2px rgba(7, 84, 136, 0.2);
}

/* Editable Name Input */
.audio-name-input {
    background: var(--bg-surface-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-default);
    width: 100%;
}

.audio-name-input:focus {
    outline: none;
    border-color: #075488;
}

/* Duration Display */
.audio-duration {
    color: var(--text-secondary);
    font-size: 14px;
    font-family: monospace;
}

/* Audio Actions Row */
.audio-actions {
    display: flex;
    gap: 8px;
}

/* Play Button */
.play-btn {
    flex: 1;
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.play-btn:hover {
    background: rgba(16, 185, 129, 0.2);
}

.play-btn.playing {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

/* Concat Button */
.concat-btn {
    background: rgba(7, 84, 136, 0.1);
    color: #075488;
    border: none;
    padding: 10px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.concat-btn:hover {
    background: rgba(7, 84, 136, 0.2);
}

.concat-btn.selected {
    background: #075488;
    color: white;
}

/* Combine Section */
.combine-section {
    margin-top: 24px;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 20px;
    text-align: center;
}

.combine-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-default);
}

.combine-order {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.order-item {
    background: var(--bg-surface-tertiary);
    padding: 8px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-default);
}

.order-arrow {
    color: var(--text-tertiary);
    font-size: 18px;
}

.combine-duration {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.combine-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.swap-btn {
    background: var(--bg-surface-tertiary);
    color: var(--text-default);
    border: 1px solid var(--border-default);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

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

/* Responsive for audio section */
@media (max-width: 600px) {
    .audio-files {
        grid-template-columns: 1fr;
    }

    .combine-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .combine-actions button {
        width: 100%;
    }
}

/* ============================================
   VOICE-OVER AI SECTION
   ============================================ */

.voice-section {
    margin-top: 32px;
}

/* Voice Form */
.voice-form {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.voice-select {
    width: 100%;
    background: var(--bg-surface-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-default);
    cursor: pointer;
    transition: border-color 0.15s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.voice-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.script-input {
    width: 100%;
    min-height: 140px;
    background: var(--bg-surface-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-default);
    resize: vertical;
    transition: border-color 0.15s ease;
}

.script-input::placeholder {
    color: var(--text-tertiary);
}

.script-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.char-count {
    text-align: right;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
    margin-bottom: 16px;
}

.char-count.warning {
    color: var(--color-warning);
}

.char-count.danger {
    color: var(--color-danger);
}

.generate-btn {
    width: 100%;
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: var(--radius-full);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.generate-btn:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Voice Status Card */
.voice-status-card {
    margin-top: 20px;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 20px;
}

.status-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

#voiceStatusText {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Voice Download Card */
.voice-download-card {
    margin-top: 20px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-xl);
    padding: 20px;
}

.download-header {
    margin-bottom: 16px;
}

.download-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-success);
}

.audio-preview-container {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}

.audio-preview-container audio {
    width: 100%;
}

.filename-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.filename-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-default);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.filename-input::placeholder {
    color: var(--text-tertiary);
}

.filename-extension {
    padding: 12px 16px;
    background: var(--bg-surface-secondary);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-left: 1px solid var(--border-default);
}

.download-actions {
    display: flex;
    gap: 12px;
}

.reset-btn {
    flex: 1;
    background: var(--bg-surface-tertiary);
    color: var(--text-default);
    border: 1px solid var(--border-default);
    padding: 12px 20px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

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

.voice-download-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-success);
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.voice-download-btn:hover {
    opacity: 0.9;
}

/* Voice Error Card */
.voice-error-card {
    margin-top: 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-xl);
    padding: 16px 20px;
    color: var(--color-danger);
    font-size: 14px;
}

/* Responsive for voice section */
@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .download-actions {
        flex-direction: column;
    }

    .download-actions button,
    .download-actions a {
        width: 100%;
    }
}

/* ============================================
   VIDEO PROMO BUTTON & MODAL
   ============================================ */

/* Header Actions Container */
.header-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 4px;
}

/* Video Button - next to logout */
.video-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-btn:hover {
    color: var(--color-primary);
    background: rgba(7, 84, 136, 0.1);
}

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

/* Nudge Animation */
@keyframes nudge {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    20% {
        transform: scale(1.2) rotate(-8deg);
    }
    40% {
        transform: scale(1.15) rotate(8deg);
    }
    60% {
        transform: scale(1.2) rotate(-5deg);
    }
    80% {
        transform: scale(1.1) rotate(5deg);
    }
}

.video-btn.nudge {
    animation: nudge 0.6s ease;
    color: var(--color-primary);
}

/* Video Modal */
.video-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

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

.video-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    transform: scale(1);
    transition: transform 0.3s ease;
}

.video-modal.hidden .video-modal-content {
    transform: scale(0.9);
}

.video-modal video {
    display: block;
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius-xl);
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}
