/* Shorts Studio - YouTube Style Design (Fixed & Refined) */
:root {
    --yt-bg: #0f0f0f;
    --yt-bg-elevated: #1e1e1e;
    --yt-border: rgba(255, 255, 255, 0.1);
    --yt-text: #ffffff;
    --yt-text-secondary: #aaaaaa;
    --yt-red: #ff0000;
    --yt-blue: #3ea6ff;
    --accent-yellow: #d4ff00;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-soft: 0 10px 40px rgba(0,0,0,0.5);
    --font-main: 'Inter', 'Noto Sans KR', sans-serif;
}

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

body.yt-theme {
    background: var(--yt-bg);
    color: var(--yt-text);
    font-family: var(--font-main);
    overflow-x: hidden;
    min-height: 100vh;
}

.hidden { display: none !important; }

/* Header */
.yt-header {
    height: 56px;
    background: var(--yt-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--yt-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-left { display: flex; align-items: center; gap: 16px; }
.menu-btn { background: transparent; border: none; color: #fff; font-size: 20px; cursor: pointer; padding: 8px; border-radius: 50%; }
.menu-btn:hover { background: rgba(255,255,255,0.1); }

.logo { display: flex; align-items: center; gap: 8px; cursor: pointer; transition: opacity 0.2s; }
.logo:hover { opacity: 0.8; }
.logo-icon { font-size: 24px; }
.logo-text { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }
.logo-text span { color: var(--accent-yellow); font-weight: 900; }

.yt-nav { display: flex; align-items: center; gap: 8px; }
.nav-icon-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
}
.nav-icon-btn:hover { background: rgba(255,255,255,0.1); }
.nav-icon-btn.active { color: var(--accent-yellow); background: rgba(212,255,0,0.1); }

.user-avatar {
    width: 32px; height: 32px; background: #5c9cff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12px; margin-left: 8px;
}

.header-center {
    display: none !important;
}
.header-tabs {
    display: flex;
    background: #0f0f0f;
    border: 1px solid var(--yt-border);
    border-radius: 20px;
    padding: 2px;
}
.tab-item {
    padding: 6px 20px;
    color: var(--yt-text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border-radius: 18px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tab-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}
.tab-item.active {
    color: #000;
    background: #fff;
}

/* Main */
.yt-main { max-width: 1400px; margin: 0 auto; padding: 24px; min-height: calc(100vh - 112px); }

/* Input Step */
.focused-input-card { max-width: 600px; margin: 40px auto; text-align: center; }
.focused-input-card h2 { font-size: 32px; font-weight: 800; margin-bottom: 8px; }
.step-desc { color: var(--yt-text-secondary); margin-bottom: 32px; font-size: 14px; }

.yt-search-box {
    background: #121212; border: 1px solid #333; border-radius: 40px;
    padding: 0 24px; display: flex; align-items: center; margin-bottom: 24px;
}
.yt-search-box:focus-within { border-color: var(--yt-blue); box-shadow: inset 0 1px 2px rgba(0,0,0,0.5); }
.yt-search-box input { width: 100%; background: transparent; border: none; height: 48px; color: #fff; font-size: 16px; outline: none; }

.advanced-options { background: var(--yt-bg-elevated); border-radius: var(--radius-lg); padding: 24px; text-align: left; margin-bottom: 32px; }
.advanced-options textarea {
    width: 100%; background: #000; border: 1px solid var(--yt-border); border-radius: var(--radius-sm);
    padding: 12px; color: #fff; font-size: 14px; resize: none; height: 80px; margin-bottom: 16px;
}
.tags-input-wrapper input {
    width: 100%; background: #000; border: 1px solid var(--yt-border); border-radius: var(--radius-sm);
    padding: 12px; color: #fff; font-size: 14px;
}

.scene-selector-group { margin-top: 16px; }
.scene-selector-group label { font-size: 12px; font-weight: 700; color: var(--yt-text-secondary); }
.scene-toggle { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.scene-count-option {
    background: rgba(255,255,255,0.05); border: 1px solid transparent; color: var(--yt-text-secondary);
    padding: 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; transition: all 0.2s;
}
.scene-count-option:hover { background: rgba(255,255,255,0.1); }
.scene-count-option.active { background: rgba(212,255,0,0.15); border-color: var(--accent-yellow); color: var(--accent-yellow); font-weight: 700; }

.visual-style-toggle { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.visual-style-option {
    background: rgba(255,255,255,0.05); border: 1px solid transparent; color: var(--yt-text-secondary);
    padding: 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; transition: all 0.2s;
    text-align: center;
}
.visual-style-option:hover { background: rgba(255,255,255,0.1); }
.visual-style-option.active { background: rgba(212,255,0,0.15); border-color: var(--accent-yellow); color: var(--accent-yellow); font-weight: 700; }

/* Voice Custom Options Styles */
.voice-gender-option,
.voice-age-option,
.voice-tone-option,
.voice-speed-option {
    background: rgba(255,255,255,0.05);
    border: 1px solid transparent;
    color: var(--yt-text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    text-align: center;
}
.voice-gender-option:hover,
.voice-age-option:hover,
.voice-tone-option:hover,
.voice-speed-option:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.voice-gender-option.active,
.voice-age-option.active,
.voice-tone-option.active,
.voice-speed-option.active {
    background: rgba(212,255,0,0.15);
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
    font-weight: 700;
}

/* Workspace Step */
.dual-frame-layout { display: grid; grid-template-columns: 1fr 380px; gap: 20px; height: calc(100vh - 160px); }

.frame-left, .frame-right { display: flex; flex-direction: column; background: var(--yt-bg-elevated); border-radius: var(--radius-md); border: 1px solid var(--yt-border); }

.frame-header { padding: 12px 20px; border-bottom: 1px solid var(--yt-border); display: flex; justify-content: space-between; align-items: center; min-height: 48px; }
.frame-header h3 { font-size: 14px; font-weight: 700; }
.frame-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.editor-scroll-area { flex: 1; overflow-y: auto; padding: 20px; }
.frame-footer { padding: 16px 20px; border-top: 1px solid var(--yt-border); }

/* Editor Content */
.title-card { background: #000; padding: 16px; border-radius: var(--radius-sm); margin-bottom: 24px; border: 1px solid var(--yt-border); }
.title-inputs { display: grid; gap: 12px; margin-top: 10px; }
.script-stats {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--yt-text-secondary);
    font-size: 12px;
    line-height: 1.5;
}
.script-stats strong {
    color: var(--yt-text);
}
.title-field { display: grid; gap: 6px; }
.title-field span { color: var(--yt-text-secondary); font-size: 11px; font-weight: 700; }
.title-inputs input { background: #1a1a1a; border: 1px solid #333; border-radius: 4px; padding: 9px 12px; color: #fff; font-size: 13px; }
.title-inputs input:focus { border-color: var(--accent-yellow); outline: none; }

.scenes-stack { display: flex; flex-direction: column; gap: 16px; }
.scene-item { background: rgba(255,255,255,0.03); border: 1px solid var(--yt-border); border-radius: var(--radius-sm); padding: 20px; position: relative; }
.scene-number { position: absolute; top: -8px; left: -8px; background: var(--accent-yellow); color: #000; width: 22px; height: 22px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 11px; z-index: 2; }

.editor-label { font-size: 11px; color: var(--accent-yellow); font-weight: 800; margin-bottom: 6px; }
.scene-script-edit, .scene-bg-edit { width: 100%; background: #000; border: 1px solid #333; border-radius: 4px; padding: 10px; color: #fff; font-size: 13px; line-height: 1.5; margin-bottom: 12px; }
.scene-script-meta {
    display: flex;
    justify-content: flex-end;
    margin: -6px 0 12px;
}
.scene-char-count {
    font-size: 11px;
    color: var(--yt-text-secondary);
}
.scene-char-count.over {
    color: #ff8f8f;
}

/* Overlay Visualizer */
.scene-overlay-section { margin-top: 8px; padding: 12px; background: #000; border-radius: 4px; }
.overlay-visualizer { width: 120px; aspect-ratio: 9/16; background: #111; margin: 0 auto 12px; position: relative; border: 1px solid #333; border-radius: 4px; overflow: hidden; }
.blackboard-zone { position: absolute; top: 8%; left: 7%; right: 7%; bottom: 10%; background: rgba(212,255,0,0.03); border: 1px dashed rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; }
.overlay-preview-img { width: 100%; height: 100%; object-fit: contain; }

.full-audio-card { background: #000; border: 1px solid var(--yt-border); border-radius: var(--radius-sm); padding: 14px; margin-top: 16px; }
.metadata-card { background: #000; border: 1px solid var(--yt-border); border-radius: var(--radius-sm); padding: 14px; margin-top: 16px; display: grid; gap: 10px; }
.metadata-card textarea,
.metadata-card input { background: #1a1a1a; border: 1px solid #333; border-radius: 4px; padding: 9px 12px; color: #fff; font-size: 13px; }
.metadata-card textarea { min-height: 96px; resize: vertical; }
.metadata-card textarea:focus,
.metadata-card input:focus { border-color: var(--accent-yellow); outline: none; }
.upload-stub { display: flex; align-items: center; justify-content: center; min-height: 42px; border: 1px dashed #444; border-radius: 6px; color: var(--yt-text-secondary); font-size: 12px; cursor: pointer; }
.upload-stub:hover { border-color: var(--accent-yellow); color: var(--accent-yellow); }
.upload-stub input { display: none; }
.status-pill { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 8px 10px; background: rgba(212,255,0,0.1); border: 1px solid rgba(212,255,0,0.3); border-radius: 999px; color: var(--accent-yellow); font-size: 12px; }
.status-pill button { width: 22px; height: 22px; border: none; border-radius: 50%; background: rgba(255,255,255,0.12); color: #fff; cursor: pointer; }

/* Status Frame Right */
.status-content { flex: 1; display: flex; flex-direction: column; padding: 16px; gap: 16px; overflow: hidden; min-height: 0; }
.progress-box { background: rgba(0,0,0,0.2); border-radius: 8px; padding: 16px; border: 1px solid var(--yt-border); }
.progress-top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px; }
.progress-bar-bg { height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent-yellow); width: 0%; transition: width 0.3s; }
.pipeline-list { display: flex; justify-content: space-between; margin-top: 12px; }
.pipe-item { font-size: 10px; color: var(--yt-text-secondary); opacity: 0.5; }
.pipe-item.active { color: var(--accent-yellow); opacity: 1; font-weight: 700; }

.log-window { flex: 0 0 220px; height: 220px; background: #000; border-radius: 8px; display: flex; flex-direction: column; border: 1px solid var(--yt-border); min-height: 220px; max-height: 220px; overflow: hidden; }
.log-title { padding: 8px 12px; font-size: 11px; color: var(--yt-text-secondary); border-bottom: 1px solid var(--yt-border); display: flex; justify-content: space-between; align-items: center; }
.log-body { flex: 1; min-height: 0; padding: 12px; font-family: 'JetBrains Mono', monospace; font-size: 11px; overflow-y: auto; color: #00ff00; line-height: 1.4; word-break: break-word; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: #444; }
.dot.active { background: #00ff00; box-shadow: 0 0 6px #00ff00; }

/* Video Result */
.result-box { display: flex; flex-direction: column; gap: 16px; }
.video-preview-wrapper { width: 100%; aspect-ratio: 9/16; background: #000; border-radius: 8px; overflow: hidden; border: 1px solid #333; }
.video-preview-wrapper video { width: 100%; height: 100%; }
.result-meta-box { background: #000; border: 1px solid var(--yt-border); border-radius: 8px; padding: 12px; display: grid; gap: 8px; }
.result-meta-title { color: #fff; font-size: 14px; font-weight: 800; line-height: 1.4; }
.result-meta-desc { color: var(--yt-text-secondary); font-size: 12px; line-height: 1.5; white-space: pre-wrap; }
.result-meta-tags { color: var(--accent-yellow); font-size: 12px; line-height: 1.4; }
.result-actions-yt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-yt-action {
    background: #2a2a2a; border: none; color: #fff; padding: 8px 12px; border-radius: 4px;
    font-size: 12px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn-yt-action:hover { background: #3a3a3a; }
.btn-yt-action.red { background: var(--yt-red); color: #fff; grid-column: 1 / -1; height: 36px; margin-top: 4px; }
.btn-yt-action.red:hover { background: #cc0000; }
.btn-yt-action.border { background: transparent; border: 1px solid #444; }
.yt-status-msg { color: var(--yt-text-secondary); font-size: 12px; text-align: center; }
.error-box { background: rgba(255,0,0,0.08); border: 1px solid rgba(255,0,0,0.35); border-radius: 8px; padding: 16px; text-align: center; color: #fff; }
.error-icon { font-size: 28px; margin-bottom: 8px; }
.error-box p { color: #ffb3b3; font-size: 13px; line-height: 1.5; margin-bottom: 12px; }

/* Buttons & Common */
.btn-primary { background: #fff; color: #000; border: none; font-weight: 700; cursor: pointer; border-radius: 20px; transition: background 0.2s; }
.btn-primary:hover { background: #e6e6e6; }
.btn-primary:disabled { background: #333; color: #666; cursor: not-allowed; }
.btn-large { height: 44px; padding: 0 24px; font-size: 15px; }
.btn-full { width: 100%; height: 40px; font-size: 14px; }

.btn-secondary { background: rgba(255,255,255,0.1); border: none; color: #fff; padding: 8px 16px; border-radius: 18px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-secondary:hover { background: rgba(255,255,255,0.15); }
.btn-sm { padding: 6px 12px; font-size: 11px; border-radius: 14px; }

/* History */
.history-grid-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.history-item { background: var(--yt-bg-elevated); border-radius: 12px; overflow: hidden; border: 1px solid var(--yt-border); transition: transform 0.2s; }
.history-item:hover { transform: translateY(-4px); border-color: #444; }
.history-thumb { width: 100%; aspect-ratio: 9/16; background: #000; position: relative; }
.history-thumb video { width: 100%; height: 100%; object-fit: cover; }
.history-info { padding: 12px; }
.history-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.yt-footer { padding: 20px; text-align: center; color: var(--yt-text-secondary); font-size: 12px; border-top: 1px solid var(--yt-border); }

/* Responsive */
@media (max-width: 900px) {
    .dual-frame-layout { grid-template-columns: 1fr; height: auto; }
    .editor-scroll-area { max-height: 500px; }
}

/* Login Screen Refinement */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.login-card {
    text-align: center;
    width: 100%;
    max-width: 400px;
    background: var(--yt-bg-elevated);
    padding: 60px 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--yt-border);
    box-shadow: 0 30px 100px rgba(0,0,0,0.8);
}

.logo-large { 
    font-size: 32px; 
    font-weight: 900; 
    margin-bottom: 40px; 
    font-family: var(--font-main); 
    color: #fff;
}
.logo-large span { color: var(--accent-yellow); }

.login-desc { color: var(--yt-text-secondary); margin-bottom: 32px; font-size: 15px; }

.login-card .input-group { width: 100%; margin-bottom: 20px; }
.login-card input[type="password"] {
    display: block;
    width: 100%;
    height: 50px;
    background: #000;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 0 16px;
    color: #fff;
    font-size: 16px;
    line-height: 50px;
    outline: none;
    appearance: none;
}
.login-card input[type="password"]::placeholder { color: #777; }
.login-card input[type="password"]:focus { border-color: var(--accent-yellow); box-shadow: 0 0 0 3px rgba(212,255,0,0.12); }
.login-card .btn-primary { display: block; width: 100%; height: 50px; font-size: 16px; margin-top: 10px; border-radius: 8px; }

.error-message { color: var(--yt-red); font-size: 14px; margin-top: 20px; font-weight: 600; }

/* Hamburger Menu Dropdown Styles */
.menu-dropdown {
    position: absolute;
    top: 48px;
    left: 8px;
    background: rgba(15, 15, 15, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    min-width: 180px;
    z-index: 1010;
    overflow: hidden;
    backdrop-filter: blur(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform-origin: top left;
}

.menu-dropdown.hidden {
    display: none !important;
}

.menu-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
}

.menu-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-yellow);
}

.menu-dropdown-item.active {
    background: rgba(212, 255, 0, 0.1);
    color: var(--accent-yellow);
    font-weight: 700;
}

.menu-item-icon {
    font-size: 16px;
}
