:root {
    --gold: #f5c542;
    --gold-light: #ffe99a;
    --background: #050505;
    --panel: #101010;
    --panel-soft: #171717;
    --panel-hover: #202020;
    --border: rgba(245, 197, 66, 0.24);
    --text: #ffffff;
    --muted: #9b9b9b;
    --danger: #ff5858;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
}

body {
    color: var(--text);
    font-family: Arial, Tahoma, sans-serif;
    background:
        radial-gradient(
            circle at 50% -20%,
            rgba(245, 197, 66, 0.13),
            transparent 36%
        ),
        var(--background);
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    min-height: 100vh;
}

/* ================= HEADER ================= */

.topbar {
    min-height: 72px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-bottom: 1px solid var(--border);
    background: rgba(8, 8, 8, 0.96);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
}

.brand-logo {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    color: #050505;
    font-size: 21px;
    font-weight: 900;
    border-radius: 15px;
    background: linear-gradient(
        135deg,
        var(--gold-light),
        var(--gold)
    );
    box-shadow: 0 0 30px rgba(245, 197, 66, 0.22);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-copy strong {
    font-size: 15px;
    letter-spacing: 0.5px;
}

.brand-copy small {
    color: var(--gold);
    font-size: 9px;
    letter-spacing: 2px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.button {
    min-height: 40px;
    padding: 9px 15px;
    border-radius: 11px;
    transition: 0.2s;
}

.button-secondary {
    color: white;
    border: 1px solid var(--border);
    background: var(--panel-soft);
}

.button-secondary:hover {
    background: var(--panel-hover);
}

.button-primary {
    color: #050505;
    border: 0;
    font-weight: 900;
    background: linear-gradient(
        135deg,
        var(--gold-light),
        var(--gold)
    );
}

.button-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(245, 197, 66, 0.18);
}

/* ================= MODES ================= */

.mode-navigation {
    min-height: 58px;
    padding: 8px 20px;
    display: flex;
    justify-content: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    background: #0b0b0b;
}

.mode-button {
    padding: 9px 18px;
    color: var(--muted);
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
}

.mode-button span {
    margin-left: 5px;
}

.mode-button:hover,
.mode-button.active {
    color: var(--gold);
    border-color: var(--border);
    background: rgba(245, 197, 66, 0.08);
}

/* ================= EDITOR ================= */

.editor-layout {
    min-height: calc(100vh - 130px);
    display: grid;
    grid-template-columns:
        275px
        minmax(430px, 1fr)
        260px;
}

.media-panel,
.properties-panel {
    padding: 17px;
    overflow-y: auto;
    background: var(--panel);
}

.media-panel {
    border-left: 1px solid var(--border);
}

.properties-panel {
    border-right: 1px solid var(--border);
}

.panel-heading {
    margin-bottom: 16px;
}

.panel-heading h2 {
    margin: 0 0 5px;
    font-size: 18px;
}

.panel-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

/* ================= UPLOAD ================= */

.upload-box {
    min-height: 145px;
    padding: 20px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 7px;
    text-align: center;
    border: 1px dashed rgba(245, 197, 66, 0.55);
    border-radius: 17px;
    background: rgba(245, 197, 66, 0.04);
    cursor: pointer;
    transition: 0.2s;
}

.upload-box:hover {
    border-color: var(--gold);
    background: rgba(245, 197, 66, 0.09);
}

.upload-symbol {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    color: #050505;
    font-size: 27px;
    border-radius: 50%;
    background: var(--gold);
}

.upload-box strong {
    font-size: 13px;
}

.upload-box small {
    color: var(--muted);
    font-size: 10px;
}

.audio-upload {
    margin: 13px 0;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--panel-soft);
    cursor: pointer;
}

.audio-icon {
    font-size: 23px;
}

.audio-upload strong,
.audio-upload small {
    display: block;
}

.audio-upload strong {
    margin-bottom: 4px;
    font-size: 12px;
}

.audio-upload small {
    max-width: 180px;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-filters {
    margin-bottom: 12px;
    display: flex;
    gap: 6px;
}

.filter-button {
    flex: 1;
    padding: 8px 5px;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    font-size: 10px;
}

.filter-button.active {
    color: #050505;
    background: var(--gold);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 28px 10px;
    color: var(--muted);
    text-align: center;
    font-size: 11px;
}

/* ================= WORKSPACE ================= */

.workspace {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #080808;
}

.workspace-toolbar {
    min-height: 52px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 7px;
}

.toolbar-group label,
.toolbar-group span {
    color: var(--muted);
    font-size: 10px;
}

.toolbar-group select {
    min-height: 34px;
    padding: 0 10px;
    color: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-soft);
}

.icon-button {
    min-width: 34px;
    height: 34px;
    color: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-soft);
}

.icon-button:hover {
    color: var(--gold);
    background: var(--panel-hover);
}

/* ================= PREVIEW ================= */

.preview-area {
    min-height: 390px;
    padding: 16px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        linear-gradient(45deg, #101010 25%, transparent 25%),
        linear-gradient(-45deg, #101010 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #101010 75%),
        linear-gradient(-45deg, transparent 75%, #101010 75%),
        #0b0b0b;
    background-size: 28px 28px;
}

.preview-canvas {
    position: relative;
    max-height: 390px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(245, 197, 66, 0.4);
    border-radius: 9px;
    background: black;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
}

.ratio-9-16 {
    height: 365px;
    aspect-ratio: 9 / 16;
}

.preview-placeholder {
    padding: 22px;
    color: var(--muted);
    text-align: center;
}

.preview-play-icon {
    width: 58px;
    height: 58px;
    margin: auto;
    display: grid;
    place-items: center;
    color: #050505;
    border-radius: 50%;
    background: var(--gold);
}

.preview-placeholder h2 {
    margin: 15px 0 7px;
    color: white;
    font-size: 16px;
}

.preview-placeholder p {
    margin: 0;
    font-size: 11px;
}

#imagePreview,
#videoPreview {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-text-layer {
    position: absolute;
    z-index: 4;
    pointer-events: none;
}

/* ================= PLAYBACK ================= */

.playback-bar {
    min-height: 48px;
    padding: 7px 14px;
    display: flex;
    align-items: center;
    gap: 7px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: #0c0c0c;
}

.play-button {
    min-width: 36px;
    height: 36px;
    color: #050505;
    border: 0;
    border-radius: 9px;
    background: var(--gold);
}

.time-display {
    margin-right: 7px;
    color: var(--muted);
    font-size: 10px;
}

.playback-spacer {
    flex: 1;
}

/* ================= TIMELINE ================= */

.timeline-panel {
    min-height: 245px;
    padding: 13px;
    background: #0a0a0a;
}

.timeline-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.timeline-heading h3 {
    margin: 0 0 3px;
    font-size: 15px;
}

.timeline-heading small {
    color: var(--muted);
    font-size: 9px;
}

.timeline-actions {
    display: flex;
    gap: 6px;
}

.small-button {
    min-height: 30px;
    padding: 0 9px;
    color: white;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--panel-soft);
    font-size: 9px;
}

.danger-button {
    color: #ffaaaa;
}

.timeline-body {
    height: 165px;
    margin-top: 13px;
    display: grid;
    grid-template-columns: 75px minmax(0, 1fr);
}

.track-labels {
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    gap: 6px;
}

.track-labels div {
    display: flex;
    align-items: center;
    color: var(--muted);
    font-size: 9px;
}

.tracks {
    position: relative;
    min-width: 0;
    overflow-x: auto;
}

.timeline-track {
    height: 50px;
    margin-bottom: 6px;
    padding: 5px;
    display: flex;
    gap: 5px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 7px;
    background: #050505;
}

.track-empty {
    margin: auto;
    color: #676767;
    font-size: 9px;
}

.playhead {
    position: absolute;
    z-index: 10;
    top: 0;
    bottom: 0;
    right: 0;
    width: 2px;
    background: var(--danger);
}

/* ================= PROPERTIES ================= */

.property-group {
    margin-bottom: 17px;
}

.property-group > label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 10px;
}

.property-group input,
.property-group select {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    color: white;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--panel-soft);
}

.number-control {
    display: grid;
    grid-template-columns: 34px 1fr auto 34px;
    align-items: center;
    gap: 5px;
}

.number-control button {
    height: 35px;
    color: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-soft);
}

.number-control span {
    color: var(--muted);
    font-size: 9px;
}

.fit-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.fit-button {
    padding: 9px;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-soft);
}

.fit-button.active {
    color: #050505;
    background: var(--gold);
}

.project-stats {
    margin-top: 22px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #090909;
}

.project-stats div {
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.project-stats div:last-child {
    border-bottom: 0;
}

.project-stats span {
    color: var(--muted);
    font-size: 10px;
}

.project-stats strong {
    color: var(--gold);
    font-size: 11px;
}

/* ================= MODAL ================= */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(10px);
}

.modal.open {
    display: grid;
}

.modal-card {
    position: relative;
    width: min(430px, 100%);
    padding: 30px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--panel);
}

.modal-close-button {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    color: white;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--panel-soft);
}

.modal-icon {
    font-size: 48px;
}

.modal-card h2 {
    margin: 12px 0 8px;
}

.modal-card p {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.export-summary {
    margin: 20px 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.export-summary div {
    padding: 12px 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #090909;
}

.export-summary span,
.export-summary strong {
    display: block;
}

.export-summary span {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 9px;
}

.export-summary strong {
    color: var(--gold);
    font-size: 12px;
}

.full-width-button {
    width: 100%;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 1100px) {
    .editor-layout {
        grid-template-columns: 245px minmax(400px, 1fr);
    }

    .properties-panel {
        display: none;
    }
}

@media (max-width: 760px) {
    .topbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .brand-copy strong {
        font-size: 12px;
    }

    .button-secondary {
        display: none;
    }

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

    .mode-navigation {
        justify-content: flex-start;
        overflow-x: auto;
    }

    .mode-button {
        min-width: 145px;
    }

    .editor-layout {
        display: block;
    }

    .media-panel {
        max-height: 430px;
        border: 0;
        border-bottom: 1px solid var(--border);
    }

    .workspace {
        min-height: 800px;
    }

    .preview-area {
        min-height: 430px;
    }

    .properties-panel {
        display: block;
        border: 0;
        border-top: 1px solid var(--border);
    }

    .timeline-panel {
        min-height: 245px;
    }
}
