:root {
    --primary: #0f6cbd;
    --primary-dark: #002060;
    --primary-hover: #115ea3;
    --primary-light: #ebf3fc;
    --accent-green: #107c41;
    --accent-amber: #b06000;
    --accent-red: #d13438;
    --bg-main: #f3f2f1;
    --card-bg: #ffffff;
    --text-main: #242424;
    --text-secondary: #616161;
    --border-color: #e1dfdd;
    --border-dark: #8a8886;
    --font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
}

/* Header Bar */
.app-header {
    background-color: var(--primary-dark);
    color: #ffffff;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo-badge {
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 800;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

.app-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.version-tag {
    font-size: 11px;
    color: #a19f9d;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.backend-status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.1);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.connected { background-color: #107c41; }
.status-dot.disconnected { background-color: #d13438; }

.btn-help-doc {
    color: #ffffff;
    text-decoration: none;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    padding: 5px 12px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-help-doc:hover {
    background: rgba(255,255,255,0.25);
}

/* Layout */
.editor-container {
    max-width: 1280px;
    margin: 20px auto;
    padding: 0 20px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* Source Bar */
.source-card {
    margin-bottom: 20px;
}

.source-label {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-wrapper {
    display: flex;
    gap: 10px;
}

.input-wrapper input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    padding: 8px 18px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

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

.demo-samples {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-sample {
    background: #f0f0f0;
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
}

.btn-sample:hover {
    background: #e0e0e0;
}

/* Grid System */
.studio-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
}

/* Video Card & Viewport */
.video-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.video-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.video-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 600px;
}

.video-badges {
    display: flex;
    gap: 8px;
}

.info-pill {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.speed-pill {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.video-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000000;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-viewport video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-overlay-timecode {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.75);
    color: #00ffcc;
    font-family: 'Consolas', monospace;
    font-size: 14px;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 4px;
    letter-spacing: 1px;
    pointer-events: none;
}

.video-placeholder {
    position: absolute;
    color: #888888;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Timeline Scrubber */
.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timeline-slider-track {
    position: relative;
    height: 24px;
    background: #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.timeline-progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background-color: rgba(15, 108, 189, 0.25);
    pointer-events: none;
}

.timeline-range-highlight {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0%;
    width: 0%;
    background-color: rgba(16, 124, 65, 0.4);
    border-left: 2px solid var(--accent-green);
    border-right: 2px solid var(--accent-green);
    pointer-events: none;
}

#timeline-scrubber {
    width: 100%;
    height: 100%;
    background: transparent;
    -webkit-appearance: none;
    cursor: pointer;
    position: relative;
    z-index: 2;
}

#timeline-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 24px;
    background: var(--primary-dark);
    border: 2px solid #ffffff;
    border-radius: 2px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.timeline-time-labels {
    display: flex;
    justify-content: space-between;
    font-family: 'Consolas', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Transport Console */
.transport-console {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #f8f9fa;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.transport-group, .in-out-group {
    display: flex;
    gap: 8px;
}

.btn-tool, .btn-mark {
    background: #ffffff;
    border: 1px solid var(--border-dark);
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-tool:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.btn-mark-in {
    border-left: 4px solid var(--primary);
}

.btn-mark-out {
    border-right: 4px solid var(--accent-green);
}

.btn-mark-in:hover { background-color: var(--primary-light); }
.btn-mark-out:hover { background-color: #e6f4ea; }

/* Control Panels Column */
.controls-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-heading {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.speed-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 14px;
}

.btn-speed {
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 6px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-speed.active, .btn-speed:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary-dark);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 4px;
}

.speed-val {
    font-weight: bold;
    color: var(--primary);
}

#speed-range-slider {
    width: 100%;
}

/* Clip Summary Panel */
.timecode-display-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.tc-box {
    background: #fafafa;
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
}

.tc-label {
    font-size: 10px;
    font-weight: bold;
    color: var(--text-secondary);
}

.tc-val {
    font-family: 'Consolas', monospace;
    font-size: 13px;
    font-weight: bold;
    color: var(--primary-dark);
}

.clip-duration-bar {
    background: var(--primary-light);
    border: 1px solid #cce5ff;
    padding: 8px 12px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
}

.dur-accent {
    color: var(--primary);
    font-size: 14px;
}

.export-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.export-label {
    font-weight: 600;
    font-size: 12px;
}

.name-input-row {
    display: flex;
    align-items: center;
}

.name-input-row input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border-dark);
    border-radius: 4px 0 0 4px;
    font-size: 12px;
}

.ext-tag {
    background: #e0e0e0;
    border: 1px solid var(--border-dark);
    border-left: none;
    padding: 6px 10px;
    border-radius: 0 4px 4px 0;
    font-weight: bold;
    font-size: 12px;
}

.btn-render-export {
    margin-top: 6px;
    justify-content: center;
    background-color: var(--accent-green);
}

.btn-render-export:hover {
    background-color: #0d522c;
}

/* Hotkey Card */
.hotkey-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.hk-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

kbd {
    background: #f0f0f0;
    border: 1px solid #cccccc;
    box-shadow: 0 1px 0 rgba(0,0,0,0.2);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: monospace;
    font-weight: bold;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

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

.modal-card {
    background: #ffffff;
    padding: 24px 30px;
    border-radius: 8px;
    width: 420px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.modal-card h3 {
    margin-bottom: 8px;
    color: var(--primary-dark);
}

.modal-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.modal-progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.modal-progress-fill {
    height: 100%;
    width: 30%;
    background: var(--primary);
    animation: pulse-progress 1.5s infinite ease-in-out;
}

@keyframes pulse-progress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary {
    background: #e0e0e0;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.hidden { display: none; }

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