/* 
   W-Media - Design System & Styling
   Premium Dark Glassmorphic Design
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --bg-dark: #07080d;
    --bg-surface: rgba(13, 17, 28, 0.7);
    --bg-surface-solid: #0d111c;
    --border-color: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(138, 43, 226, 0.4);
    
    --primary: #9d4edd;
    --primary-glow: rgba(157, 78, 221, 0.3);
    --primary-light: #c77dff;
    --secondary: #00f5d4;
    --secondary-glow: rgba(0, 245, 212, 0.25);
    --accent: #ff007f;
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.7);
    --glow-primary: 0 0 20px var(--primary-glow);
    --glass-blur: blur(16px);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --page-gutter: clamp(0.8rem, 2.2vw, 2rem);
    --panel-radius: 14px;
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

[hidden] {
    display: none !important;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    min-width: 320px;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

button,
input,
select,
textarea {
    max-width: 100%;
}

/* Decorative Background Gradients */
body::before, body::after {
    content: '';
    position: absolute;
    width: 40vw;
    height: 40vw;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
}

body::before {
    background: var(--primary);
    top: -10vw;
    left: -10vw;
    animation: floatGlow 15s ease-in-out infinite alternate;
}

body::after {
    background: var(--secondary);
    bottom: -10vw;
    right: -10vw;
    animation: floatGlow 20s ease-in-out infinite alternate-reverse;
}

@keyframes floatGlow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 5%) scale(1.1); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* Layout Containers */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem var(--page-gutter);
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(7, 8, 13, 0.8);
    backdrop-filter: var(--glass-blur);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.logo-icon {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 8px;
    display: block;
    object-fit: cover;
    box-shadow: 0 0 15px rgba(157, 78, 221, 0.4);
}

.logo-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #c77dff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.15;
    min-width: 0;
}

.logo-tag {
    font-size: 0.65rem;
    background: rgba(0, 245, 212, 0.1);
    color: var(--secondary);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    border: 1px solid rgba(0, 245, 212, 0.2);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.profile-menu {
    position: relative;
}

.pwa-install-box {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.pwa-install-btn {
    white-space: nowrap;
}

.pwa-install-close {
    width: 34px;
    min-width: 34px;
    height: 34px;
}

.profile-menu-trigger {
    max-width: 240px;
}

.profile-menu-trigger span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 0.55rem);
    right: 0;
    width: 210px;
    padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(13, 17, 28, 0.96);
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 300;
}

.profile-menu.open .profile-dropdown {
    display: block;
}

.profile-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 40px;
    padding: 0.65rem 0.75rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.profile-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.profile-menu-item i {
    width: 16px;
    color: var(--secondary);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.status-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.offline {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

/* Sidebar & Main Layout */
.main-wrapper {
    display: flex;
    flex: 1;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 280px;
    border-right: 1px solid var(--border-color);
    background-color: rgba(7, 8, 13, 0.5);
    backdrop-filter: var(--glass-blur);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    transition: all var(--transition-normal);
}

.sidebar-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Main Dashboard Area */
.dashboard-content {
    flex: 1;
    padding: var(--page-gutter);
    overflow-y: auto;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

/* Glassmorphic Panel/Card */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--panel-radius);
    box-shadow: var(--shadow-md);
    transition: border var(--transition-fast), box-shadow var(--transition-fast);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Search/URL Input Panel */
.url-input-container {
    padding: clamp(1rem, 2.4vw, 2rem);
    margin-bottom: clamp(1rem, 2.2vw, 2rem);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.url-input-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--secondary), transparent);
}

.url-title {
    font-size: clamp(1.35rem, 2.2vw, 1.8rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-family: 'Space Grotesk', sans-serif;
}

.url-subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.input-group {
    display: flex;
    max-width: 750px;
    margin: 0 auto;
    gap: 0.75rem;
    width: 100%;
}

.workflow-guide {
    max-width: 900px;
    margin: 1.25rem auto 0;
    text-align: left;
}

.workflow-next {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    margin-bottom: 0.8rem;
    padding: 0.65rem 1rem;
    border: 1px solid rgba(0, 245, 212, 0.24);
    border-radius: 10px;
    background: rgba(0, 245, 212, 0.08);
    color: var(--secondary);
    font-weight: 700;
    font-size: 0.92rem;
}

.workflow-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
}

.workflow-step {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
}

.workflow-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
}

.workflow-step strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
}

.workflow-step.active {
    border-color: rgba(0, 245, 212, 0.45);
    background: rgba(0, 245, 212, 0.1);
    color: var(--text-primary);
    box-shadow: 0 0 16px rgba(0, 245, 212, 0.14);
}

.workflow-step.active span,
.workflow-step.done span {
    background: var(--secondary);
    color: var(--bg-dark);
}

.workflow-step.done {
    border-color: rgba(16, 185, 129, 0.35);
    color: var(--text-secondary);
}

.mobile-action-tooltip {
    display: none;
}

.input-wrapper {
    position: relative;
    flex: 1;
}

.input-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.text-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all var(--transition-normal);
}

.text-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    background: rgba(0, 0, 0, 0.6);
}

.text-input:-webkit-autofill,
.text-input:-webkit-autofill:hover,
.text-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary);
    box-shadow: 0 0 0 1000px #05070d inset;
    border-color: rgba(0, 245, 212, 0.28);
    caret-color: var(--text-primary);
}

.text-input:focus + .input-icon {
    color: var(--primary-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all var(--transition-normal);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #7b2cbf);
    color: white;
    box-shadow: 0 4px 15px rgba(157, 78, 221, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(157, 78, 221, 0.6), var(--glow-primary);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-accent {
    background: linear-gradient(135deg, var(--secondary), #00bbf9);
    color: var(--bg-dark);
    box-shadow: 0 4px 15px rgba(0, 245, 212, 0.3);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 245, 212, 0.5), 0 0 15px var(--secondary-glow);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.55);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.next-action-callout {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(0, 245, 212, 0.24);
    border-radius: 10px;
    background: rgba(0, 245, 212, 0.08);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

.next-action-callout i {
    color: var(--secondary);
}

.next-action-callout.ready {
    border-color: rgba(0, 245, 212, 0.48);
    background: rgba(0, 245, 212, 0.13);
    color: var(--text-primary);
}

.btn.action-pulse {
    animation: actionPulse 1.35s ease-in-out infinite;
}

@keyframes actionPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 245, 212, 0.42), 0 4px 15px rgba(0, 245, 212, 0.22);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(0, 245, 212, 0), 0 8px 24px rgba(0, 245, 212, 0.45);
    }
}

@keyframes tooltipFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* Two-Column Workspace Layout */
.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.15fr);
    gap: clamp(1rem, 2vw, 2rem);
    min-height: 500px;
}

@media (max-width: 1024px) {
    :root {
        --page-gutter: 1.25rem;
    }

    header {
        flex-wrap: wrap;
    }

    .header-actions {
        margin-left: auto;
    }

    .workspace-grid {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .left-column,
    .right-column {
        gap: 1.25rem !important;
    }

    .transcript-card,
    .output-card {
        height: auto;
        min-height: 0;
    }

    .transcript-body,
    .output-body {
        max-height: 52vh;
    }

    .profile-modal-content {
        max-width: min(94vw, 760px);
    }

    .user-row-main {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    }

    .user-role-select {
        grid-column: 1 / -1;
    }

    .user-row-actions {
        justify-content: center;
    }
}

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

.panel-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-title i {
    color: var(--primary-light);
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Media/Video Player Container */
.video-preview-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.external-video-preview {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: white;
    text-decoration: none;
    background: #05070d;
}

.external-video-preview img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.72;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.external-video-preview span {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(8px);
    font-weight: 800;
}

.external-video-preview:hover img {
    opacity: 0.85;
    transform: scale(1.03);
}

.video-meta-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.video-title-text {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
}

.video-details-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.video-detail-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.video-detail-item i {
    color: var(--primary-light);
}

/* Transcript Panel */
.transcript-card {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 420px);
    min-height: 350px;
}

.transcript-search-row {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
}

.transcript-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.transcript-segment {
    display: flex;
    gap: 1rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 0.4rem;
}

.transcript-segment:hover {
    background: rgba(255, 255, 255, 0.03);
}

.transcript-segment.active {
    background: rgba(157, 78, 221, 0.08);
    border-left: 3px solid var(--primary);
}

.transcript-time {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    padding-top: 0.15rem;
}

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

.transcript-text mark {
    background: rgba(0, 245, 212, 0.3);
    color: white;
    padding: 0 0.1rem;
    border-radius: 2px;
}

.transcript-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 1rem;
    text-align: center;
    padding: 2rem;
}

.transcript-empty i {
    font-size: 2.5rem;
    color: var(--border-color);
}

/* Right Column: Prompt & Generation Studio */
.studio-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
}

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

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.form-select {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.prompt-editor-container {
    position: relative;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.prompt-textarea {
    width: 100%;
    height: 160px;
    padding: 1rem;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    line-height: 1.6;
}

.prompt-editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.placeholder-pill {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: monospace;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.placeholder-pill:hover {
    background: var(--primary-glow);
    color: var(--primary-light);
    border-color: var(--primary-light);
}

/* Parameter Grid */
.params-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 900px) {
    .params-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .params-grid {
        grid-template-columns: 1fr;
    }
}

/* Slider Controls */
.slider-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-light);
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary);
    transition: transform var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Output Area */
.output-card {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 400px);
    min-height: 400px;
}

.output-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
}

/* Markdown styling inside output */
.output-body h1, .output-body h2, .output-body h3 {
    font-family: 'Space Grotesk', sans-serif;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: white;
}

.output-body h1 { font-size: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.4rem; }
.output-body h2 { font-size: 1.25rem; }
.output-body h3 { font-size: 1.1rem; }

.output-body p {
    margin-bottom: 1rem;
}

.output-body ul, .output-body ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.output-body li {
    margin-bottom: 0.4rem;
}

.output-body code {
    background: rgba(255, 255, 255, 0.06);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.85rem;
    color: var(--secondary);
}

.output-body pre {
    background: rgba(0, 0, 0, 0.5);
    padding: 1rem;
    border-radius: 10px;
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.output-body pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

.output-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

.output-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Refinement chat section */
.refinement-container {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.3);
}

/* Settings Drawer / Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 90%;
    max-width: 550px;
    transform: translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.auth-modal {
    max-width: 360px;
}

/* Auth modal floats as a small window anchored to top-right */
#modal-auth {
    align-items: flex-start;
    justify-content: flex-end;
    padding-top: 68px;
    padding-right: 1rem;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
}

#modal-auth .modal-content {
    width: 340px;
    max-width: 96vw;
    padding: 1.35rem !important;
    transform: translateY(-12px) scale(0.97);
    transform-origin: top right;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
    border-radius: 18px;
}

#modal-auth.active .modal-content {
    transform: translateY(0) scale(1);
}

/* Hide verbose note in compact window */
#modal-auth .auth-note {
    display: none;
}

/* Tighter spacing inside compact auth form */
#modal-auth .auth-form {
    gap: 0.7rem;
}

#modal-auth .panel-header {
    padding-bottom: 0.85rem !important;
}

#modal-auth .auth-tabs {
    margin-bottom: 0.75rem;
}


.welcome-modal-content {
    max-width: 620px;
    padding: 1.5rem;
}

.welcome-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.welcome-hero img {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
}

.welcome-hero h3 {
    margin: 0 0 0.3rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    line-height: 1.3;
}

.welcome-hero p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.welcome-contact-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.welcome-contact-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-primary);
    text-decoration: none;
}

.welcome-contact-item:hover {
    border-color: rgba(0, 245, 212, 0.35);
    background: rgba(0, 245, 212, 0.06);
}

.welcome-contact-item i {
    color: var(--secondary);
    font-size: 1.15rem;
}

.welcome-contact-item span {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.welcome-contact-item strong {
    overflow-wrap: anywhere;
    font-size: 0.95rem;
}

.welcome-section {
    margin-bottom: 1.25rem;
}

.welcome-section h4 {
    margin: 0 0 0.65rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.welcome-link-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.welcome-link-list a {
    min-width: 0;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.22);
    color: var(--secondary);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.welcome-link-list a:hover {
    border-color: rgba(157, 78, 221, 0.45);
    color: var(--primary-light);
}

.welcome-countdown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.35rem;
    margin-left: 0.35rem;
    padding: 0.12rem 0.42rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.22);
    font-size: 0.78rem;
    line-height: 1;
}

.profile-modal-content {
    width: min(94vw, 900px);
    max-width: 900px;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    padding: 0;
    border-radius: 18px;
}

.profile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.025);
}

.profile-dialog-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 420px;
}

.profile-sidebar {
    padding: 1.25rem;
    border-right: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.16);
}

.profile-panel-area {
    min-width: 0;
    padding: 1.25rem;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.24);
}

.auth-tab {
    min-height: 38px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.auth-tab.active {
    background: rgba(0, 245, 212, 0.12);
    color: var(--secondary);
}

.auth-note {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.86rem;
}

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

.profile-summary {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
}

.profile-avatar {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--bg-dark);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.55rem;
    font-weight: 800;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.profile-identity {
    min-width: 0;
}

.profile-summary h4 {
    margin: 0 0 0.2rem;
    font-size: 1.05rem;
    overflow-wrap: anywhere;
}

.profile-summary p {
    margin: 0 0 0.45rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

.profile-role-badge {
    display: inline-flex;
    padding: 0.2rem 0.5rem;
    border: 1px solid rgba(0, 245, 212, 0.22);
    border-radius: 999px;
    background: rgba(0, 245, 212, 0.08);
    color: var(--secondary);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.profile-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0;
    padding: 0.35rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.profile-tab {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.65rem;
    min-width: 0;
    min-height: 44px;
    padding: 0 0.85rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.profile-tab.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    box-shadow: inset 3px 0 0 var(--secondary);
}

.profile-tab:hover {
    background: rgba(255, 255, 255, 0.055);
    color: var(--text-primary);
}

.profile-tab-panel {
    display: none;
}

.profile-tab-panel.active {
    display: block;
    animation: profilePanelIn 160ms ease-out;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.compact-input {
    padding: 0.75rem 1rem;
    border-radius: 10px;
}

.profile-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.profile-form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.25rem;
}

.profile-section-divider {
    height: 1px;
    margin: 1.35rem 0;
    background: var(--border-color);
}

.user-management-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.user-management-toolbar h4 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.user-management-toolbar p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.user-management-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    transition: border var(--transition-fast), background var(--transition-fast);
}

.user-management-row:hover {
    border-color: rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.045);
}

.user-row-main {
    display: grid;
    grid-template-columns: minmax(130px, 0.85fr) minmax(220px, 1.35fr) minmax(110px, 0.45fr);
    gap: 0.6rem;
    min-width: 0;
}

.user-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.user-row-actions .btn {
    min-width: 96px;
    white-space: nowrap;
}

.empty-state {
    padding: 1rem;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    text-align: center;
}

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

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    height: 1px;
    flex: 1;
    background: var(--border-color);
}

/* History List Items */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    max-height: 250px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.history-item-thumb {
    width: 60px;
    height: 34px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.history-item-details {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.history-item-channel {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.history-item-delete {
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 4px;
    transition: color var(--transition-fast);
}

.history-item-delete:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Custom Template Editor List */
.template-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 1rem;
}

.template-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

/* Banner Notifications */
.notification-banner {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    transform: translateY(100px);
    opacity: 0;
    transition: all var(--transition-normal);
}

.notification-banner.active {
    transform: translateY(0);
    opacity: 1;
}

.notification-banner.success {
    background: rgba(16, 185, 129, 0.9);
    border: 1px solid var(--success);
    backdrop-filter: var(--glass-blur);
}

.notification-banner.error {
    background: rgba(239, 68, 68, 0.9);
    border: 1px solid var(--danger);
    backdrop-filter: var(--glass-blur);
}

.notification-banner.info {
    background: rgba(59, 130, 246, 0.9);
    border: 1px solid #3b82f6;
    backdrop-filter: var(--glass-blur);
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pulsate-glow {
    animation: pulsateGlow 2s infinite alternate;
}

@keyframes pulsateGlow {
    0% {
        box-shadow: 0 0 5px var(--primary-glow);
    }
    100% {
        box-shadow: 0 0 20px var(--primary);
    }
}

/* Phone and small tablet layout */
@media (max-width: 768px) {
    :root {
        --page-gutter: 0.75rem;
        --panel-radius: 12px;
    }

    html,
    body {
        width: 100%;
        overflow-x: hidden;
    }

    .app-container {
        overflow-x: hidden;
    }

    body::before,
    body::after {
        width: 70vw;
        height: 70vw;
        filter: blur(90px);
    }

    header {
        align-items: center;
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.85rem var(--page-gutter);
        position: static;
        text-align: center;
    }

    .logo-container {
        width: 100%;
        justify-content: center;
        min-width: 0;
    }

    .logo-icon {
        width: 2rem;
        height: 2rem;
        flex: 0 0 auto;
    }

    .logo-text {
        font-size: clamp(1rem, 4.4vw, 1.15rem);
        min-width: 0;
    }

    .logo-tag {
        display: inline-block;
        margin-left: 0.25rem;
        vertical-align: middle;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
        gap: 0.55rem;
        flex-direction: column;
    }

    .status-badge {
        justify-content: center;
        min-width: 0;
        width: 100%;
        padding: 0.35rem 0.55rem;
        font-size: 0.75rem;
    }

    .header-actions .btn {
        width: 100%;
        flex: 0 0 auto;
    }

    .pwa-install-box {
        width: 100%;
    }

    .pwa-install-btn {
        flex: 1;
    }

    .pwa-install-close {
        width: 44px;
        min-width: 44px;
        height: 44px;
    }

    .profile-menu {
        width: 100%;
    }

    .profile-menu-trigger {
        width: 100%;
        max-width: none;
    }

    .profile-dropdown {
        left: 0;
        right: 0;
        width: 100%;
    }

    .main-wrapper {
        display: block;
    }

    .dashboard-content {
        padding: var(--page-gutter);
        overflow-x: hidden;
    }

    .glass-panel {
        border-radius: var(--panel-radius);
    }

    .url-input-container {
        padding: 1rem;
        margin-bottom: 0.85rem;
        text-align: center;
    }

    .url-title {
        font-size: 1.45rem;
        line-height: 1.2;
    }

    .url-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .input-group {
        max-width: none;
        flex-direction: column;
        gap: 0.65rem;
    }

    .workflow-guide {
        margin-top: 1rem;
    }

    .workflow-next {
        justify-content: center;
        text-align: center;
        min-height: 0;
        font-size: 0.86rem;
        line-height: 1.35;
    }

    .workflow-steps {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .workflow-step {
        justify-content: center;
        padding: 0.55rem;
        text-align: center;
    }

    .workflow-step strong {
        font-size: 0.78rem;
    }

    .mobile-action-tooltip {
        position: relative;
        display: none;
        width: fit-content;
        max-width: 100%;
        margin: 0.75rem auto 0;
        padding: 0.65rem 0.85rem;
        border: 1px solid rgba(0, 245, 212, 0.38);
        border-radius: 9px;
        background: rgba(0, 245, 212, 0.12);
        color: var(--text-primary);
        font-size: 0.82rem;
        font-weight: 700;
        line-height: 1.35;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    }

    .mobile-action-tooltip.active {
        display: block;
        animation: tooltipFloat 1.45s ease-in-out infinite;
    }

    .mobile-action-tooltip::before {
        content: '';
        position: absolute;
        top: -7px;
        right: 22px;
        width: 12px;
        height: 12px;
        background: rgba(0, 245, 212, 0.12);
        border-left: 1px solid rgba(0, 245, 212, 0.38);
        border-top: 1px solid rgba(0, 245, 212, 0.38);
        transform: rotate(45deg);
    }

    .input-wrapper {
        width: 100%;
        flex: 1 1 auto;
    }

    .text-input,
    .form-select {
        font-size: 16px;
    }

    .btn {
        width: 100%;
        min-height: 44px;
        padding: 0.75rem 1rem;
    }

    .btn-sm {
        min-height: 40px;
    }

    .btn-icon {
        width: 40px;
        min-width: 40px;
        padding: 0.5rem;
    }

    .workspace-grid,
    .left-column,
    .right-column {
        gap: 0.85rem !important;
    }

    .panel-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.7rem;
        padding: 0.9rem;
        text-align: center;
    }

    .studio-card .panel-header {
        grid-template-columns: 1fr;
        padding: 0;
    }

    .panel-title {
        font-size: 1rem;
        justify-content: center;
        min-width: 0;
        line-height: 1.25;
    }

    .panel-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.4rem;
    }

    .panel-actions .form-select {
        max-width: none !important;
        flex: 1 1 150px;
    }

    .panel-actions .btn,
    .panel-actions .btn-icon {
        width: auto;
        flex: 0 0 auto;
    }

    #btn-manage-templates {
        justify-self: center;
        width: 100%;
        max-width: 100%;
        min-height: 38px;
        padding: 0.45rem 0.75rem;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    .video-preview-card,
    .studio-card {
        padding: 0.9rem;
    }

    .video-meta-info {
        text-align: center;
    }

    .video-details-row {
        justify-content: center;
        gap: 0.6rem 0.9rem;
    }

    .transcript-card,
    .output-card {
        height: auto;
        min-height: 0;
    }

    .transcript-body,
    .output-body {
        max-height: 50vh;
        padding: 0.85rem;
    }

    .transcript-search-row,
    .refinement-container {
        padding: 0.75rem 0.85rem;
    }

    .transcript-segment {
        align-items: flex-start;
        gap: 0.65rem;
        padding: 0.6rem;
        text-align: left;
    }

    .transcript-text,
    .output-body {
        font-size: 0.9rem;
    }

    .form-label {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.25rem;
        line-height: 1.25;
        text-align: center;
        align-items: center;
    }

    .form-label > span:last-child {
        overflow-wrap: anywhere;
    }

    .prompt-textarea {
        min-height: 150px;
        text-align: left;
    }

    .next-action-callout {
        position: relative;
        align-items: center;
        justify-content: center;
        padding: 0.75rem;
        font-size: 0.84rem;
        line-height: 1.35;
        text-align: center;
    }

    .next-action-callout.ready {
        animation: tooltipFloat 1.45s ease-in-out infinite;
    }

    .next-action-callout.ready::after {
        content: '';
        position: absolute;
        bottom: -7px;
        left: 28px;
        width: 12px;
        height: 12px;
        background: rgba(0, 245, 212, 0.13);
        border-right: 1px solid rgba(0, 245, 212, 0.48);
        border-bottom: 1px solid rgba(0, 245, 212, 0.48);
        transform: rotate(45deg);
    }

    .prompt-editor-footer {
        align-items: center;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .prompt-editor-footer > div {
        justify-content: center;
        flex-wrap: wrap;
    }

    .output-stats {
        width: 100%;
        margin-right: 0 !important;
        flex-wrap: wrap;
    }

    #history-panel {
        margin-top: 1rem !important;
        padding: 0.9rem !important;
        text-align: center;
    }

    .history-item {
        align-items: center;
        text-align: center;
    }

    .modal-overlay {
        align-items: flex-start;
        overflow-y: auto;
        padding: 0.5rem;
    }

    .modal-content {
        width: calc(100vw - 1rem);
        max-width: none;
        margin: 0 auto;
        padding: 0.95rem !important;
    }

    .welcome-modal-content {
        text-align: center;
    }

    .welcome-hero {
        flex-direction: column;
        text-align: center;
    }

    .welcome-contact-grid,
    .welcome-link-list {
        grid-template-columns: 1fr;
    }

    .profile-modal-content {
        padding: 0 !important;
        width: calc(100vw - 1rem);
        max-width: calc(100vw - 1rem);
        max-height: calc(100dvh - 1rem);
        overflow-x: hidden;
        border-radius: 14px;
    }

    .profile-modal-header {
        position: sticky;
        top: 0;
        z-index: 2;
        padding: 0.9rem 1rem;
        background: rgba(13, 17, 28, 0.98);
        backdrop-filter: var(--glass-blur);
    }

    .profile-modal-header .panel-title {
        min-width: 0;
        font-size: 1rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .profile-dialog-layout {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .profile-sidebar {
        padding: 0.9rem;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
        background: rgba(0, 0, 0, 0.12);
        text-align: center;
    }

    .profile-panel-area {
        padding: 0.9rem;
        text-align: center;
    }

    .profile-summary {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
        padding: 0.75rem;
        border-radius: 10px;
    }

    .profile-avatar {
        width: 52px;
        height: 52px;
        flex-basis: 52px;
        border-radius: 12px;
        font-size: 1.3rem;
    }

    .profile-summary h4 {
        font-size: 0.98rem;
        line-height: 1.2;
    }

    .profile-summary p {
        margin-bottom: 0.35rem;
        font-size: 0.8rem;
    }

    .template-item {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.5rem;
    }

    .profile-tabs {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.35rem;
        padding: 0.25rem;
        border-radius: 10px;
    }

    .profile-tab {
        justify-content: center;
        min-height: 40px;
        padding: 0 0.75rem;
        font-size: 0.88rem;
        box-shadow: none;
    }

    .profile-tab.active {
        box-shadow: inset 0 -3px 0 var(--secondary);
    }

    .user-management-toolbar,
    .user-management-row,
    .user-row-actions {
        text-align: center;
        align-items: stretch;
        flex-direction: column;
    }

    .user-management-toolbar {
        align-items: center;
    }

    .user-management-row {
        display: flex;
        gap: 0.65rem;
        padding: 0.7rem;
    }

    .user-row-main {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .user-row-actions {
        gap: 0.45rem;
    }

    .user-row-actions .btn {
        width: 100%;
        min-height: 38px;
    }

    .profile-form-grid {
        grid-template-columns: 1fr;
    }

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

    .profile-form {
        gap: 0.85rem;
        align-items: stretch;
    }

    .profile-form .form-label {
        justify-content: center;
        text-align: center;
        align-items: center;
    }

    .compact-input,
    .user-role-select {
        min-height: 42px;
        font-size: 0.95rem;
        width: 100%;
        text-align: center;
    }

    .notification-banner {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        width: auto;
        padding: 0.85rem 1rem;
    }
}

@media (max-width: 420px) {
    :root {
        --page-gutter: 0.55rem;
    }

    .dashboard-content {
        padding: var(--page-gutter);
    }

    .url-input-container,
    .video-preview-card,
    .studio-card {
        padding: 0.75rem;
    }

    .logo-text {
        font-size: 1rem;
    }

    .logo-tag {
        margin-top: 0.25rem;
    }

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

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

    .profile-menu-trigger {
        justify-content: space-between;
    }

    .profile-modal-content {
        width: calc(100vw - 0.7rem);
        max-width: calc(100vw - 0.7rem);
        max-height: calc(100dvh - 0.7rem);
        border-radius: 12px;
    }

    .profile-modal-header {
        padding: 0.75rem;
    }

    .profile-modal-header .btn-icon {
        width: 34px;
        height: 34px;
        min-width: 34px;
    }

    .profile-sidebar,
    .profile-panel-area {
        padding: 0.75rem;
    }

    .profile-summary {
        gap: 0.65rem;
        padding: 0.65rem;
    }

    .profile-avatar {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
        font-size: 1.15rem;
    }

    .profile-tabs {
        grid-template-columns: 1fr;
    }

    .profile-tab {
        justify-content: center;
        min-height: 38px;
        font-size: 0.86rem;
    }

    .profile-tab.active {
        box-shadow: inset 0 -3px 0 var(--secondary);
    }

    .status-badge {
        justify-content: center;
        min-height: 38px;
    }

    .url-title {
        font-size: 1.25rem;
    }

    .workflow-steps {
        grid-template-columns: 1fr;
    }

    .workflow-step {
        min-height: 40px;
    }

    .transcript-card,
    .studio-card,
    .video-preview-card,
    .output-card,
    #history-panel {
        border-radius: 10px;
    }

    .panel-header {
        padding: 0.85rem;
    }

    .panel-title {
        font-size: 0.95rem;
        gap: 0.4rem;
    }

    .panel-actions {
        flex-wrap: nowrap;
        gap: 0.35rem;
    }

    .panel-actions .btn-icon {
        flex: 0 0 36px;
        width: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 0.95rem;
    }

    .transcript-search-row,
    .refinement-container {
        padding: 0.65rem 0.7rem;
    }

    .transcript-body,
    .output-body {
        max-height: 42vh;
        padding: 0.85rem;
    }

    .transcript-empty {
        padding: 1.25rem 0.75rem;
        gap: 0.75rem;
    }

    .transcript-empty i {
        font-size: 2rem;
    }

    #btn-manage-templates {
        justify-self: stretch;
        width: 100%;
    }

    .transcript-segment {
        flex-direction: column;
    }

    .text-input {
        padding-top: 0.85rem;
        padding-bottom: 0.85rem;
    }

    .url-title {
        font-size: 1.22rem;
    }

    .url-subtitle,
    .workflow-next,
    .next-action-callout {
        font-size: 0.84rem;
    }
}
