/* ==========================================================================
   Bilibili Studio - Modern Dark Glassmorphism CSS Theme
   ========================================================================== */

:root {
    --bg-main: #0B0E14;
    --bg-card: rgba(22, 28, 40, 0.7);
    --bg-card-hover: rgba(30, 39, 56, 0.85);
    --bg-sidebar: #07090D;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(0, 180, 255, 0.3);
    
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --text-dim: #64748B;
    
    --accent-blue: #00B4D8;
    --accent-pink: #FF007A;
    --accent-purple: #7000FF;
    --accent-cyan: #06B6D4;
    --accent-emerald: #10B981;

    --gradient-primary: linear-gradient(135deg, #00B4D8 0%, #7000FF 100%);
    --gradient-hot: linear-gradient(135deg, #FF007A 0%, #7000FF 100%);
    --gradient-success: linear-gradient(135deg, #10B981 0%, #00B4D8 100%);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --shadow-glow: 0 0 25px rgba(0, 180, 216, 0.25);
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-left: 8px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    box-shadow: var(--shadow-glow);
}

.brand-text h2 {
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(90deg, #FFFFFF, #94A3B8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-blue);
    background: rgba(0, 180, 216, 0.15);
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

/* Nav Menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    position: relative;
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: white;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-glow);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-pink);
    border-radius: 50%;
    margin-left: auto;
    animation: pulse 1.5s infinite;
}

.hidden { display: none !important; }

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 0, 122, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(255, 0, 122, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 0, 122, 0); }
}

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

.voice-quick-select label {
    font-size: 12px;
    color: var(--text-dim);
    display: block;
    margin-bottom: 6px;
}

.voice-quick-select select, select {
    width: 100%;
    background: #161C28;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    outline: none;
    font-size: 13px;
    cursor: pointer;
}

select option {
    background-color: #111622 !important;
    color: #F1F5F9 !important;
    padding: 10px;
}

select option:hover, select option:focus, select option:checked {
    background-color: #00B4D8 !important;
    color: #FFFFFF !important;
}

.voice-quick-select select:focus {
    border-color: var(--accent-blue);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: radial-gradient(circle at top right, rgba(112, 0, 255, 0.08), transparent 40%),
                radial-gradient(circle at bottom left, rgba(0, 180, 216, 0.08), transparent 40%);
}

.top-header {
    padding: 16px 32px;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 50px;
    box-shadow: var(--shadow-card);
}

.search-bar i {
    color: var(--accent-blue);
}

.search-bar input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
}

/* Buttons */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Tab Pages */
.tab-page {
    display: none;
    padding: 32px;
    flex-grow: 1;
}

.tab-page.active {
    display: block;
}

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

.section-header h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 50px;
}

.search-box input {
    background: transparent;
    border: none;
    color: white;
    outline: none;
    width: 220px;
    font-size: 13px;
}

/* Category Pills & Scroll Bar */
.category-pills-scroll {
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.category-pills-scroll::-webkit-scrollbar {
    height: 4px;
}
.category-pills-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.category-pills {
    display: flex;
    gap: 10px;
    white-space: nowrap;
}

.pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pill:hover, .pill.active {
    background: rgba(0, 180, 216, 0.18);
    color: white;
    border-color: var(--border-highlight);
    box-shadow: 0 0 15px rgba(0, 180, 216, 0.2);
}

/* Topic Hashtag Cloud */
.topic-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
}

.tag-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    margin-right: 4px;
}

.topic-tag {
    background: rgba(112, 0, 255, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.2);
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.topic-tag:hover {
    background: var(--accent-cyan);
    color: #000;
    transform: translateY(-1px);
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.video-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-card);
}

.thumb-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #111;
}

.thumb-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.duration-tag {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.video-details {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.video-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-author {
    font-size: 12px;
    color: var(--text-dim);
}

.video-card-actions {
    margin-top: auto;
    padding-top: 10px;
    display: flex;
    gap: 8px;
}

.btn-card-process {
    flex-grow: 1;
    background: rgba(0, 180, 216, 0.1);
    color: var(--accent-blue);
    border: 1px solid var(--border-highlight);
    padding: 8px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-card-process:hover {
    background: var(--accent-blue);
    color: white;
}

.btn-card-view {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
}

.btn-card-view:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* Load More */
.load-more-container {
    text-align: center;
    margin-top: 16px;
    margin-bottom: 40px;
}

/* Modal Quick Detail View */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: #111622;
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-lg);
    max-width: 750px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-color);
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--accent-pink);
    border-color: var(--accent-pink);
}

.modal-body {
    display: flex;
    flex-direction: column;
}

.modal-player-box {
    position: relative;
    width: 100%;
    height: 360px;
    background: black;
}

#player-iframe-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

#player-iframe-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#player-iframe-wrapper iframe,
#player-iframe-wrapper video {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
    object-fit: contain;
}

.player-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    text-align: center;
    pointer-events: auto;
}

.player-hint a {
    color: var(--accent-blue);
}

.select-hint {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--accent-pink);
}

.storage-note {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
}

.blur-hint {
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-dim);
}

.btn-block {
    width: 100%;
    justify-content: center;
    margin-top: 14px;
}

.btn-block:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#blur-settings {
    transition: opacity 0.2s ease;
}

#blur-settings.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.blur-preview-box {
    position: relative;
    margin-top: 6px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.35);
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blur-preview-box img {
    width: 100%;
    display: none;
}

.blur-preview-box img.visible {
    display: block;
}

.blur-preview-msg {
    padding: 16px;
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
}

/* Draggable blur-region overlay on the preview image */
.blur-region-overlay {
    position: absolute;
    left: 0;
    right: 0;
    box-sizing: border-box;
    border: 2px dashed var(--accent-blue);
    background: rgba(0, 180, 216, 0.18);
    cursor: grab;
    touch-action: none;
    user-select: none;
    z-index: 2;
}

.blur-region-overlay.dragging {
    cursor: grabbing;
    background: rgba(0, 180, 216, 0.28);
}

.blur-region-overlay.hidden {
    display: none;
}

.blur-region-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 2px 8px;
    border-radius: 20px;
    pointer-events: none;
}

.blur-handle {
    position: absolute;
    left: 0;
    right: 0;
    height: 12px;
    cursor: ns-resize;
    background: transparent;
}

.blur-handle::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: 3px;
    background: var(--accent-blue);
}

.blur-handle.top {
    top: -6px;
}

.blur-handle.top::after {
    top: 4px;
}

.blur-handle.bottom {
    bottom: -6px;
}

.blur-handle.bottom::after {
    bottom: 4px;
}

.play-overlay-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 180, 216, 0.85);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 0 30px rgba(0, 180, 216, 0.6);
    transition: transform 0.2s, background 0.2s;
}

.play-overlay-btn:hover {
    transform: translate(-50%, -50%) scale(1.05);
    background: var(--accent-blue);
}

.orig-title-text {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: -6px;
}

.modal-info-box {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.modal-desc-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: var(--radius-sm);
    max-height: 100px;
    overflow-y: auto;
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

/* Process Dashboard */
.process-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
}

.process-video-info {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 32px;
}

.placeholder-thumb {
    width: 120px;
    height: 70px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-dim);
}

.url-text {
    font-size: 13px;
    color: var(--text-muted);
    word-break: break-all;
}

.progress-container {
    margin-bottom: 40px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 700;
}

.progress-track {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 20px;
    transition: width 0.4s ease;
}

/* Steps Visualizer */
.steps-visualizer {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.step-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    opacity: 0.4;
    transition: all 0.3s;
}

.step-item.active {
    opacity: 1;
    border-color: var(--accent-blue);
    background: rgba(0, 180, 216, 0.1);
}

.step-item.completed {
    opacity: 1;
    border-color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.1);
}

.step-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Subtitle Editor Table */
.subtitles-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    max-height: 550px;
    overflow-y: auto;
}

.subtitles-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.subtitles-table th {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 16px;
    text-align: left;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
}

.subtitles-table td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: top;
}

.subtitles-table input[type="text"] {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    outline: none;
    font-size: 13px;
}

.subtitles-table input[type="text"]:focus {
    border-color: var(--accent-blue);
    background: rgba(0, 180, 216, 0.08);
}

.empty-msg {
    text-align: center;
    color: var(--text-dim);
    padding: 40px !important;
}

/* Preview Grid */
.preview-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.player-card, .export-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.video-wrapper video {
    width: 100%;
    border-radius: var(--radius-md);
    background: black;
    max-height: 480px;
}

.export-card h3 {
    font-size: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.control-group label {
    font-size: 13px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
}

.control-group input[type="range"] {
    width: 100%;
    accent-color: var(--accent-blue);
}

.range-val {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-blue);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}
