/* ========================================
   Creator Script Studio — Design System
   ======================================== */

/* ---- CSS Variables / Tokens ---- */
:root {
    /* Colors */
    --primary: #6366f1;
    --primary-hover: #5558e6;
    --primary-light: #eef2ff;
    --primary-glow: rgba(99, 102, 241, 0.15);

    --accent: #8b5cf6;
    --accent-light: #f3e8ff;

    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Surfaces */
    --bg: #f8f9fc;
    --bg-secondary: #f1f3f9;
    --surface: #ffffff;
    --surface-hover: #f8f9fc;
    --surface-elevated: #ffffff;
    --border: #e5e7eb;
    --border-light: #f0f1f4;

    /* Text */
    --text-primary: #1a1d26;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-inverse: #ffffff;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

    /* Sidebar */
    --sidebar-bg: #fafbfe;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;

    /* Top bar */
    --topbar-height: 64px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif: 'Merriweather', Georgia, serif;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* Z-index */
    --z-sidebar: 100;
    --z-topbar: 90;
    --z-modal-overlay: 200;
    --z-modal: 210;
    --z-toast: 300;
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --primary-light: rgba(99, 102, 241, 0.15);
    --primary-glow: rgba(99, 102, 241, 0.2);

    --accent: #a78bfa;
    --accent-light: rgba(139, 92, 246, 0.15);

    --success-light: rgba(16, 185, 129, 0.15);
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger-light: rgba(239, 68, 68, 0.15);
    --info-light: rgba(59, 130, 246, 0.15);

    --bg: #0f1117;
    --bg-secondary: #161822;
    --surface: #1a1d2e;
    --surface-hover: #22253a;
    --surface-elevated: #1e2133;
    --border: #2a2d3e;
    --border-light: #22253a;

    --text-primary: #e8eaf0;
    --text-secondary: #9ca3b8;
    --text-tertiary: #6b7280;
    --text-inverse: #0f1117;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.15);

    --sidebar-bg: #12141e;
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    border: none;
    outline: none;
    background: transparent;
}

ul,
ol {
    list-style: none;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ---- App Layout ---- */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-normal);
    z-index: var(--z-sidebar);
    position: relative;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-info {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-light);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    white-space: nowrap;
}

.sidebar-toggle {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item.active svg {
    stroke: var(--primary);
}

.nav-item svg {
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.user-role {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ---- Top Bar ---- */
.top-bar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: var(--z-topbar);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    width: 240px;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-box svg {
    flex-shrink: 0;
    color: var(--text-tertiary);
}

.search-box input {
    width: 100%;
    font-size: 13px;
}

.search-box input::placeholder {
    color: var(--text-tertiary);
}

.icon-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.icon-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.notification-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    top: 8px;
    right: 8px;
    border: 2px solid var(--surface);
}

/* ---- Page Container ---- */
.page-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px;
}

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition-fast);
    cursor: pointer;
    white-space: nowrap;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--text-tertiary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ---- Status Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-idea {
    background: var(--info-light);
    color: var(--info);
}

.badge-script {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-recording {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-editing {
    background: rgba(236, 72, 153, 0.1);
    color: #ec4899;
}

.badge-published {
    background: var(--success-light);
    color: var(--success);
}

.badge-thumbnail {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

.badge-upload {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

/* ---- Priority Tags ---- */
.priority {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
}

.priority-high {
    color: var(--danger);
}

.priority-medium {
    color: var(--warning);
}

.priority-low {
    color: var(--success);
}

.priority-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.priority-high .priority-dot {
    background: var(--danger);
}

.priority-medium .priority-dot {
    background: var(--warning);
}

.priority-low .priority-dot {
    background: var(--success);
}

/* ---- Platform Tags ---- */
.platform-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* ---- Form Elements ---- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input {
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.form-select {
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ---- Progress Bar ---- */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width var(--transition-slow);
}

/* ---- Pipeline Steps ---- */
.pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
}

.pipeline-step {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    position: relative;
}

.pipeline-step.completed {
    color: var(--success);
}

.pipeline-step.active {
    color: var(--primary);
    font-weight: 600;
}

.pipeline-step .step-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

.pipeline-step.completed .step-icon {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.pipeline-step.active .step-icon {
    border-color: var(--primary);
    color: var(--primary);
}

.pipeline-connector {
    width: 24px;
    height: 2px;
    background: var(--border);
    flex-shrink: 0;
}

.pipeline-connector.completed {
    background: var(--success);
}

/* ---- Grid Layouts ---- */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* ---- Stats Cards ---- */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ---- Kanban Board ---- */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: 400px;
}

.kanban-column {
    min-width: 280px;
    max-width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

.kanban-column-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.kanban-count {
    background: var(--surface);
    padding: 1px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
}

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 80px;
}

.kanban-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: grab;
    transition: all var(--transition-fast);
}

.kanban-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.kanban-card-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---- Video List Item ---- */
.video-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.video-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    border-color: var(--primary);
}

.video-item-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
}

.video-item-info {
    flex: 1;
    min-width: 0;
}

.video-item-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-item-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
}

.video-item-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* ---- Scene Card ---- */
.scene-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: grab;
    transition: all var(--transition-fast);
    position: relative;
}

.scene-card:hover {
    box-shadow: var(--shadow-sm);
}

.scene-card.dragging {
    opacity: 0.6;
    box-shadow: var(--shadow-lg);
}

.scene-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.scene-number {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.scene-location {
    font-size: 11px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.scene-card-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

.scene-card-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Script Editor ---- */
.script-editor-container {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.script-editor-main {
    flex: 3;
    min-width: 0;
}

.script-editor-sidebar {
    flex: 2;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.script-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.script-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}

.script-section-header:hover {
    background: var(--surface-hover);
}

.script-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
}

.script-section-emoji {
    font-size: 18px;
}

.script-section-toggle {
    color: var(--text-tertiary);
    transition: transform var(--transition-fast);
}

.script-section.collapsed .script-section-toggle {
    transform: rotate(-90deg);
}

.script-section-body {
    padding: 0 18px 18px;
    transition: all var(--transition-fast);
}

.script-section.collapsed .script-section-body {
    display: none;
}

.script-textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    resize: vertical;
    transition: all var(--transition-fast);
}

.script-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    outline: none;
}

.script-textarea::placeholder {
    color: var(--text-tertiary);
}

/* ---- Script Modes ---- */
.script-mode-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.script-mode-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.script-mode-btn:hover {
    color: var(--text-primary);
}

.script-mode-btn.active {
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-xs);
}

/* ---- Reading Mode ---- */
.reading-mode {
    position: fixed;
    inset: 0;
    z-index: 250;
    background: var(--bg);
    overflow-y: auto;
    padding: 60px 20px;
    display: none;
}

.reading-mode.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.reading-mode-content {
    max-width: 680px;
    margin: 0 auto;
    font-family: var(--font-serif);
    font-size: 22px;
    line-height: 2;
    color: var(--text-primary);
}

.reading-mode-close {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 260;
}

/* ---- Teleprompter Mode ---- */
.teleprompter-mode {
    position: fixed;
    inset: 0;
    z-index: 250;
    background: #000;
    overflow: hidden;
    display: none;
}

.teleprompter-mode.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

.teleprompter-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: rgba(30, 30, 30, 0.9);
    border-radius: var(--radius-full);
    backdrop-filter: blur(10px);
    z-index: 260;
}

.teleprompter-text {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    overflow: hidden;
}

.teleprompter-text-content {
    font-family: var(--font-sans);
    font-size: 42px;
    font-weight: 500;
    line-height: 1.8;
    color: #ffffff;
    text-align: center;
    max-width: 800px;
    transition: transform 0.1s linear;
}

.teleprompter-speed-label {
    color: #999;
    font-size: 12px;
    font-weight: 600;
}

.teleprompter-speed-slider {
    width: 120px;
    accent-color: var(--primary);
}

/* ---- Shooting Mode ---- */
.shooting-mode {
    position: fixed;
    inset: 0;
    z-index: 250;
    background: var(--bg);
    overflow-y: auto;
    display: none;
}

.shooting-mode.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

.shooting-mode-header {
    padding: 20px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.shooting-scene-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 24px;
}

.shooting-scene-number {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 6px 16px;
    border-radius: var(--radius-full);
}

.shooting-scene-title {
    font-size: 32px;
    font-weight: 800;
    text-align: center;
    letter-spacing: -0.02em;
}

.shooting-scene-text {
    font-size: 22px;
    line-height: 1.8;
    text-align: center;
    max-width: 700px;
    color: var(--text-secondary);
}

.shooting-scene-notes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 28px;
    background: var(--warning-light);
    border-radius: var(--radius-md);
    max-width: 500px;
}

.shooting-scene-notes h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--warning);
}

.shooting-scene-notes p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.shooting-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    justify-content: center;
}

.shooting-mark-btn {
    padding: 16px 40px;
    font-size: 16px;
    font-weight: 700;
    border-radius: var(--radius-md);
    background: var(--success);
    color: white;
    transition: all var(--transition-fast);
}

.shooting-mark-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-overlay);
    animation: fadeIn 0.2s ease;
}

.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--z-modal);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    animation: modalIn 0.25s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    background: var(--surface);
}

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    animation: slideInRight 0.3s ease;
    font-size: 13px;
    font-weight: 500;
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-error {
    border-left: 3px solid var(--danger);
}

.toast-info {
    border-left: 3px solid var(--info);
}

/* ---- Empty State ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 400px;
}

/* ---- Section Header ---- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.section-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ---- View Toggle ---- */
.view-toggle {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.view-toggle-btn {
    width: 32px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}

.view-toggle-btn.active {
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-xs);
}

/* ---- Tab Navigation ---- */
.tab-nav {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ---- Metric Card ---- */
.metric-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

.metric-inline svg {
    flex-shrink: 0;
}

.metric-inline strong {
    color: var(--text-primary);
}

/* ---- Tags ---- */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* ---- Divider ---- */
.divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

/* ---- Location Group ---- */
.location-group {
    margin-bottom: 24px;
}

.location-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.location-icon {
    color: var(--primary);
}

.location-name {
    font-weight: 600;
    font-size: 14px;
}

.location-count {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-left: auto;
}

/* ---- Task Item ---- */
.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.task-item:hover {
    box-shadow: var(--shadow-sm);
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.task-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-size: 13px;
    font-weight: 600;
}

.task-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* ---- Team Member Card ---- */
.member-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    transition: all var(--transition-fast);
}

.member-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.member-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: white;
}

.member-name {
    font-size: 14px;
    font-weight: 600;
}

.member-role {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ---- Drag & Drop ---- */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}

.drop-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

/* ---- Animations ---- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

.animate-slide-up {
    animation: slideInUp 0.3s ease;
}

/* ---- Hidden Utility ---- */
.hidden {
    display: none !important;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        transition: left var(--transition-normal);
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .search-box {
        display: none;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .page-container {
        padding: 16px;
    }

    .script-editor-container {
        flex-direction: column;
    }

    .script-editor-sidebar {
        min-width: 100%;
    }

    .kanban-board {
        flex-direction: column;
    }

    .kanban-column {
        min-width: 100%;
        max-width: 100%;
    }

    .video-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .video-item-right {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .top-bar {
        padding: 0 16px;
    }

    .page-title {
        font-size: 16px;
    }
}

/* ---- Utility ---- */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.gap-20 {
    gap: 20px;
}

.gap-24 {
    gap: 24px;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.text-sm {
    font-size: 13px;
}

.text-xs {
    font-size: 11px;
}

.font-bold {
    font-weight: 700;
}

.text-secondary {
    color: var(--text-secondary);
}

.text-tertiary {
    color: var(--text-tertiary);
}

.w-full {
    width: 100%;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* ========================================
   RTL / Arabic Language Support
   ======================================== */

/* Arabic Font Family Override */
.lang-ar {
    --font-sans: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif: 'Tajawal', 'Cairo', Georgia, serif;
}

.lang-ar * {
    letter-spacing: 0 !important;
}

/* RTL Sidebar */
[dir="rtl"] .sidebar {
    border-right: none;
    border-left: 1px solid var(--border);
}

[dir="rtl"] .sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(0deg);
}

[dir="rtl"] .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* RTL Select Arrow */
[dir="rtl"] .form-select {
    background-position: left 12px center;
    padding-left: 36px;
    padding-right: 14px;
}

/* RTL Notification Dot */
[dir="rtl"] .notification-dot {
    right: auto;
    left: 8px;
}

/* RTL Pipeline Connector flip */
[dir="rtl"] .pipeline {
    direction: rtl;
}

/* RTL Modal Footer */
[dir="rtl"] .modal-footer {
    flex-direction: row-reverse;
}

/* RTL Toast Container */
[dir="rtl"] .toast-container {
    right: auto;
    left: 24px;
}

/* RTL Flex reverse for specific layouts */
[dir="rtl"] .flex-row-reverse-rtl {
    flex-direction: row-reverse;
}

/* ========================================
   Paragraph Block Styles
   ======================================== */

.paragraph-blocks {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.paragraph-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-fast);
    position: relative;
}

.paragraph-block:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.paragraph-block.dragging {
    opacity: 0.5;
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.paragraph-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.paragraph-block-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.paragraph-block-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.paragraph-block-location {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.paragraph-block-location .location-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    min-width: 60px;
}

.paragraph-block-location .form-select {
    padding: 6px 12px;
    font-size: 13px;
    flex: 1;
    max-width: 220px;
}

[dir="rtl"] .paragraph-block-location .form-select {
    padding-left: 30px;
    padding-right: 12px;
}

.paragraph-block textarea.paragraph-textarea {
    width: 100%;
    min-height: 80px;
    padding: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    resize: vertical;
    transition: border-color var(--transition-fast);
    font-family: var(--font-sans);
}

.paragraph-block textarea.paragraph-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    outline: none;
}

.paragraph-block textarea.paragraph-textarea::placeholder {
    color: var(--text-tertiary);
}

.paragraph-block .paragraph-notes {
    margin-top: 8px;
}

.paragraph-block .paragraph-notes input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    transition: border-color var(--transition-fast);
}

.paragraph-block .paragraph-notes input:focus {
    border-color: var(--primary);
    outline: none;
}

.paragraph-drag-handle {
    cursor: grab;
    display: flex;
    align-items: center;
    color: var(--text-tertiary);
    padding: 4px;
    border-radius: 4px;
    transition: color var(--transition-fast);
}

.paragraph-drag-handle:hover {
    color: var(--text-secondary);
}

.paragraph-drag-handle:active {
    cursor: grabbing;
}

/* ========================================
   Shooting Script Modal / View
   ======================================== */

.shooting-script-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 250;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.shooting-script-overlay.active {
    display: flex;
}

.shooting-script-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-wrap: wrap;
    gap: 12px;
}

.shooting-script-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.shooting-script-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shooting-script-body {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

.shooting-script-content {
    font-size: 18px;
    line-height: 2;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.shooting-script-content .ss-paragraph {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
}

.shooting-script-content .ss-paragraph:last-child {
    border-bottom: none;
}

.shooting-script-content .ss-paragraph-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Location filter chips */
.location-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.location-chip {
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.location-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.location-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Add paragraph button */
.add-paragraph-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: transparent;
}

.add-paragraph-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* Script editor two-column layout in paragraph mode */
.paragraph-editor-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 960px) {
    .paragraph-editor-container {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Professional Teleprompter System
   ======================================== */

.pro-tp {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0a0a0f;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--font-sans);
}

/* ---- Controls Bar ---- */
.pro-tp-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.7) 80%, transparent 100%);
    padding: 16px 24px 32px;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.pro-tp-controls.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px);
}

.pro-tp-controls-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 16px;
    flex-wrap: wrap;
}

.pro-tp-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.pro-tp-title-icon {
    font-size: 24px;
}

.pro-tp-title-main {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.pro-tp-title-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

.pro-tp-btn-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pro-tp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pro-tp-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.pro-tp-btn.active {
    background: rgba(99, 102, 241, 0.3);
    border-color: #6366f1;
    color: #a5b4fc;
}

.pro-tp-btn-close {
    border-color: rgba(239, 68, 68, 0.4);
    color: rgba(239, 68, 68, 0.8);
}

.pro-tp-btn-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-color: #ef4444;
}

/* ---- Controls Bottom Row ---- */
.pro-tp-controls-bottom {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.pro-tp-play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.pro-tp-play-btn:hover {
    background: rgba(99, 102, 241, 0.4);
    border-color: #6366f1;
    transform: scale(1.08);
}

.pro-tp-slider-group {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 500;
}

.pro-tp-slider-group label {
    white-space: nowrap;
    min-width: 40px;
}

.pro-tp-slider-group input[type="range"] {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.pro-tp-slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #6366f1;
    border: 2px solid #fff;
    cursor: pointer;
}

.pro-tp-slider-group input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #6366f1;
    border: 2px solid #fff;
    cursor: pointer;
}

.pro-tp-slider-group span {
    min-width: 38px;
    text-align: right;
    color: rgba(255, 255, 255, 0.8);
    font-variant-numeric: tabular-nums;
}

.pro-tp-keys-hint {
    margin-top: 10px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.25);
    text-align: center;
}

/* ---- Viewport ---- */
.pro-tp-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.pro-tp-content {
    width: 100%;
    max-width: 800px;
    padding: 50vh 40px 0;
    color: #f0f0f5;
    font-size: 32px;
    line-height: 2.2;
    will-change: transform;
    transition: none;
}

.pro-tp-paragraph {
    margin-bottom: 48px;
    position: relative;
}

.pro-tp-paragraph-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(99, 102, 241, 0.6);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pro-tp-paragraph-text {
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---- Focus Mode Overlays ---- */
.pro-tp-focus-overlay {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 5;
    pointer-events: none;
}

.pro-tp-focus-top {
    top: 0;
    height: 38%;
    background: linear-gradient(180deg, rgba(10, 10, 15, 0.85) 0%, rgba(10, 10, 15, 0.4) 100%);
}

.pro-tp-focus-bottom {
    bottom: 0;
    height: 38%;
    background: linear-gradient(0deg, rgba(10, 10, 15, 0.85) 0%, rgba(10, 10, 15, 0.4) 100%);
}

.pro-tp-focus-line {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    max-width: 900px;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, rgba(99, 102, 241, 0.5) 30%, rgba(99, 102, 241, 0.5) 70%, transparent 100%);
    z-index: 6;
    pointer-events: none;
    border-radius: 4px;
}

/* ---- Paragraph Selection Checkbox ---- */
.paragraph-select-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
    appearance: none;
    -webkit-appearance: none;
}

.paragraph-select-checkbox:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.paragraph-select-checkbox:checked::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.paragraph-select-checkbox:hover {
    border-color: var(--primary);
}

/* ---- Quick Teleprompter Buttons ---- */
.tp-quick-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 0;
    border-top: 1px solid var(--border-light);
    margin-top: 12px;
}

.tp-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
}

.tp-quick-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.tp-quick-btn svg {
    flex-shrink: 0;
}

/* ---- Responsive Teleprompter ---- */
@media (max-width: 768px) {
    .pro-tp-controls {
        padding: 12px 16px 24px;
    }

    .pro-tp-controls-bottom {
        gap: 10px;
    }

    .pro-tp-slider-group {
        font-size: 11px;
    }

    .pro-tp-slider-group input[type="range"] {
        width: 60px;
    }

    .pro-tp-slider-group label {
        display: none;
    }

    .pro-tp-btn span {
        display: none;
    }

    .pro-tp-content {
        padding: 50vh 20px 0;
        font-size: 24px;
    }

    .pro-tp-title-main {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .pro-tp-controls-bottom {
        gap: 6px;
    }

    .pro-tp-slider-group {
        gap: 4px;
    }

    .pro-tp-slider-group input[type="range"] {
        width: 50px;
    }

    .pro-tp-content {
        font-size: 20px;
        line-height: 2;
        padding: 50vh 16px 0;
    }
}

/* ============================================================
   MOBILE RESPONSIVE — COMPREHENSIVE
   Breakpoints: 768px (tablet), 480px (phone)
   ============================================================ */

/* ---- Mobile Sidebar Overlay ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-sidebar) - 1);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

/* ---- Bottom Navigation Bar (mobile only) ---- */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: var(--z-sidebar);
    padding: 0 4px;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    font-size: 10px;
    font-weight: 600;
    transition: all var(--transition-fast);
    flex: 1;
    cursor: pointer;
    min-width: 0;
}

.mobile-nav-item svg {
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.mobile-nav-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-item.active svg {
    stroke: var(--primary);
}

/* ============================================================
   TABLET — max 1024px
   ============================================================ */
@media (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .script-editor-container {
        flex-direction: column;
    }

    .script-editor-sidebar {
        min-width: 0;
        width: 100%;
    }

    .search-box {
        width: 180px;
    }
}

/* ============================================================
   MOBILE TABLET — max 768px
   ============================================================ */
@media (max-width: 768px) {

    /* Body scrollable on mobile */
    body {
        overflow: auto;
    }

    /* App layout: stack vertically */
    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    /* ---- Sidebar: slide-in overlay ---- */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        z-index: var(--z-sidebar);
        box-shadow: var(--shadow-xl);
    }

    [dir="rtl"] .sidebar {
        left: auto;
        right: 0;
        transform: translateX(100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    [dir="rtl"] .sidebar.mobile-open {
        transform: translateX(0);
    }

    /* Hide desktop sidebar toggle */
    .sidebar-toggle {
        display: none;
    }

    /* ---- Main content: full width ---- */
    .main-content {
        width: 100%;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    /* ---- Top Bar ---- */
    .top-bar {
        padding: 0 16px;
        position: sticky;
        top: 0;
        z-index: var(--z-topbar);
        height: 56px;
        min-height: 56px;
    }

    .mobile-menu-btn {
        display: flex !important;
    }

    .search-box {
        width: 140px;
    }

    .page-title {
        font-size: 16px;
    }

    /* Hide notification button on small screens */
    .notification-btn {
        display: none;
    }

    /* ---- Page Container ---- */
    .page-container {
        padding: 16px;
        overflow: visible;
        padding-bottom: 80px;
        /* space for bottom nav */
    }

    /* ---- Show bottom nav ---- */
    .mobile-bottom-nav {
        display: flex;
    }

    /* ---- Cards ---- */
    .card {
        padding: 16px;
    }

    /* ---- Grids ---- */
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* ---- Section Header ---- */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .section-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* ---- Stat Cards ---- */
    .stat-value {
        font-size: 22px;
    }

    /* ---- Video List Items ---- */
    .video-item {
        padding: 12px 14px;
        gap: 12px;
    }

    .video-item-right {
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
    }

    /* ---- Kanban Board ---- */
    .kanban-board {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        gap: 12px;
        padding: 0 0 16px 0;
    }

    .kanban-column {
        min-width: 260px;
        scroll-snap-align: start;
    }

    /* ---- Task Items ---- */
    .task-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .task-meta {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* ---- Tab Nav ---- */
    .tab-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
        gap: 4px;
        flex-wrap: nowrap;
    }

    .tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 12px;
        padding: 7px 12px;
    }

    /* ---- Pipeline ---- */
    .pipeline {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .pipeline-step {
        flex-shrink: 0;
        font-size: 11px;
        padding: 4px 8px;
    }

    /* ---- Script Editor ---- */
    .script-editor-container {
        flex-direction: column;
    }

    .script-editor-sidebar {
        min-width: 0;
        width: 100%;
    }

    .script-mode-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 2px;
    }

    .script-mode-btn {
        flex-shrink: 0;
        font-size: 12px;
        padding: 7px 12px;
    }

    /* ---- Modals ---- */
    .modal-container {
        width: calc(100vw - 24px) !important;
        max-width: none !important;
        margin: 12px;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: var(--radius-lg);
    }

    .modal-body {
        max-height: 60vh;
        overflow-y: auto;
    }

    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    /* ---- Member Cards ---- */
    .member-card {
        padding: 16px;
    }

    /* ---- Location Groups (Shooting) ---- */
    .location-group {
        padding: 12px;
    }

    .location-group-header {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* ---- Teleprompter Quick Bar ---- */
    .tp-quick-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }

    .tp-quick-btn {
        flex-shrink: 0;
        font-size: 11px;
        padding: 7px 10px;
    }

    /* ---- Flex helpers on mobile ---- */
    .flex-mobile-col {
        flex-direction: column !important;
    }

    /* ---- Video Detail Top Area ---- */
    .video-detail-header {
        flex-direction: column;
        gap: 12px;
    }

    /* ---- Metrics Inline ---- */
    .metric-inline {
        font-size: 12px;
    }

    /* ---- Dashboard Recent Videos ---- */
    .section-title {
        font-size: 16px !important;
    }

    /* ---- Touch-friendly buttons ---- */
    .btn {
        min-height: 40px;
    }

    .btn-sm {
        min-height: 34px;
    }

    /* ---- Form inputs bigger on mobile ---- */
    .form-input,
    .form-select {
        font-size: 16px;
        /* prevents iOS zoom */
        padding: 12px 14px;
    }

    textarea.form-input {
        font-size: 16px;
    }

    /* ---- Shooting Script View ---- */
    .shooting-script-view {
        padding: 12px;
    }

    /* ---- Empty State ---- */
    .empty-state {
        padding: 32px 16px;
    }

    .empty-state-title {
        font-size: 16px;
    }
}

/* ============================================================
   SMALL PHONES — max 480px
   ============================================================ */
@media (max-width: 480px) {

    .top-bar {
        padding: 0 12px;
    }

    .page-container {
        padding: 12px;
        padding-bottom: 80px;
    }

    .search-box {
        width: 110px;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-value {
        font-size: 20px;
    }

    .section-header .btn svg {
        display: none;
    }

    /* Kanban columns even narrower */
    .kanban-column {
        min-width: 240px;
    }

    /* Pipeline scrollable with smaller steps */
    .pipeline-step span:last-child {
        display: none;
    }

    .pipeline-connector {
        width: 12px;
    }

    /* Video item: compact */
    .video-item {
        padding: 10px 12px;
    }

    .video-item-icon {
        width: 36px;
        height: 36px;
    }

    /* Compact button text */
    .btn-primary svg,
    .btn-secondary svg {
        flex-shrink: 0;
    }

    /* Member card compact */
    .member-card {
        padding: 12px;
    }

    /* Scene card compact */
    .scene-card {
        padding: 12px;
    }

    /* bottom nav labels shrink */
    .mobile-nav-item span {
        font-size: 9px;
    }

    /* Modal full screen on tiny devices */
    .modal-container {
        width: 100vw !important;
        margin: 0 !important;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
        position: fixed !important;
        bottom: 0 !important;
        top: auto !important;
        transform: none !important;
    }

    .modal-body {
        max-height: 65vh;
    }
}

/* ============================================================
   RTL MOBILE ADJUSTMENTS
   ============================================================ */
@media (max-width: 768px) {
    [dir="rtl"] .sidebar {
        right: 0;
        left: auto;
        border-left: 1px solid var(--border);
        border-right: none;
    }

    [dir="rtl"] .form-select {
        background-position: left 12px center;
        padding-right: 14px;
        padding-left: 36px;
    }

    [dir="rtl"] .search-box {
        flex-direction: row-reverse;
    }

    [dir="rtl"] .top-bar-left {
        flex-direction: row-reverse;
    }
}

/* ============================================================
   LANDSCAPE PHONE
   ============================================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .page-container {
        padding-bottom: 70px;
    }

    .mobile-bottom-nav {
        height: 54px;
    }

    .top-bar {
        height: 48px;
        min-height: 48px;
    }
}