/* =========================================================
   ASTRA SIMULATOR
   Main stylesheet
   ========================================================= */


/* ===================== VARIABLES ===================== */

:root {
    --background: #0b0e14;
    --panel: #111722;
    --panel-secondary: #151e2b;

    --border: #263143;
    --border-light: #35445a;

    --text: #edf2fa;
    --text-secondary: #b1bdce;
    --muted: #8290a4;

    --accent: #8db8ff;
    --accent-hover: #b2d0ff;
    --accent-dark: #477bc7;

    --success: #78d6ad;
    --danger: #ff8585;

    --radius: 10px;
}


/* ===================== RESET ===================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--background);
    color: var(--text);

    font-family: "DM Sans", "Segoe UI", sans-serif;
    font-size: 14px;
}


/* ===================== HEADER ===================== */

.topbar {
    height: 72px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 30px;

    background: #0e131c;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
}

.brand-icon {
    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    border-radius: 10px;

    background: #1c2a40;
    color: var(--accent);

    font-size: 23px;
}

.brand-info h1 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.brand-info h1 span {
    color: var(--accent);
}

.brand-info p {
    margin-top: 3px;

    font-size: 10px;
    color: var(--muted);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 9px;

    font-family: "DM Mono", monospace;
    font-size: 10px;
    letter-spacing: 1px;

    color: var(--text-secondary);
}

.status-indicator {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--success);
    box-shadow: 0 0 10px #78d6ad66;
}


/* ===================== MAIN LAYOUT ===================== */

.workspace {
    width: 100%;
    max-width: 1900px;

    margin: 0 auto;
    padding: 22px;

    display: grid;

    grid-template-columns:
        minmax(330px, 390px)
        minmax(0, 1fr);

    gap: 18px;

    align-items: start;
}


/* ===================== PANELS ===================== */

.configuration-panel,
.output-panel {
    min-width: 0;

    background: var(--panel);

    border: 1px solid var(--border);
    border-radius: 12px;
}

.configuration-panel {
    padding: 22px 20px;
}

.output-panel {
    padding: 23px;

    display: flex;
    flex-direction: column;
    gap: 22px;
}


/* ===================== PANEL HEADINGS ===================== */

.panel-heading,
.output-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 12px;
}

.panel-heading {
    margin-bottom: 22px;
}

.output-heading {
    margin-bottom: 12px;
}

.panel-heading h2,
.output-heading h2 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.4px;
}

.eyebrow {
    margin-bottom: 7px;

    color: var(--accent);

    font-family: "DM Mono", monospace;
    font-size: 10px;
    letter-spacing: 1.5px;
}

.step-indicator,
.output-status {
    padding: 6px 8px;

    border: 1px solid var(--border);
    border-radius: 5px;

    color: var(--muted);

    font-family: "DM Mono", monospace;
    font-size: 9px;
    letter-spacing: 0.8px;

    white-space: nowrap;
}


/* ===================== CONFIGURATION SECTIONS ===================== */

.configuration-section {
    padding: 19px 0;

    border-top: 1px solid var(--border);
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-bottom: 14px;
}

.section-heading h3 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 13px;
    font-weight: 600;
}

.section-number {
    width: 22px;
    height: 22px;

    display: grid;
    place-items: center;

    border-radius: 6px;

    background: #1c2a40;
    color: var(--accent);

    font-family: "DM Mono", monospace;
    font-size: 11px;
}


/* ===================== IMAGE UPLOAD ===================== */

.upload-zone {
    min-height: 125px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 8px;

    padding: 18px;

    background: #131c29;

    border: 1px dashed #3c4d66;
    border-radius: 9px;

    cursor: pointer;

    transition:
        background 0.2s,
        border-color 0.2s,
        transform 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
    background: #18263b;
    border-color: var(--accent);
}

.upload-zone:hover {
    transform: translateY(-1px);
}

.upload-zone input {
    display: none;
}

.upload-icon {
    color: var(--accent);
    font-size: 27px;
    line-height: 1;
}

.upload-zone strong {
    font-size: 12px;
    font-weight: 600;
}

.upload-zone span:not(.upload-icon) {
    color: var(--text-secondary);
    font-size: 10px;
}

.upload-zone small {
    color: var(--muted);
    font-size: 9px;
}

.file-information {
    margin-top: 10px;

    color: var(--success);

    font-family: "DM Mono", monospace;
    font-size: 10px;

    overflow-wrap: anywhere;
}


/* ===================== INPUT FIELDS ===================== */

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11px;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 7px;

    margin-bottom: 11px;

    color: var(--text-secondary);
    font-size: 11px;
}

.input-field > span {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.input-field small {
    color: var(--muted);

    font-family: "DM Mono", monospace;
    font-size: 9px;
}

.input-field input {
    width: 100%;

    padding: 9px 10px;

    background: #0d131d;

    border: 1px solid var(--border);
    border-radius: 6px;

    outline: none;

    color: var(--text);

    font-family: "DM Mono", monospace;
    font-size: 12px;

    transition: border-color 0.2s;
}

.input-field input:focus {
    border-color: var(--accent-dark);
}

.seed-field {
    margin-top: 2px;
    margin-bottom: 0;
}


/* ===================== FILTER PIPELINE ===================== */

.filters-section {
    padding-bottom: 12px;
}

.filter-section-heading {
    justify-content: space-between;
}

.section-heading-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-count {
    padding: 5px 7px;

    border: 1px solid var(--border);
    border-radius: 5px;

    color: var(--muted);

    font-family: "DM Mono", monospace;
    font-size: 8px;
    letter-spacing: 0.7px;
}

.section-description {
    margin-bottom: 14px;

    color: var(--muted);

    font-size: 10px;
    line-height: 1.6;
}

.section-description code {
    color: var(--accent);
    font-family: "DM Mono", monospace;
}

.filters-container {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.loading-state {
    padding: 20px;

    border: 1px dashed var(--border);
    border-radius: 7px;

    color: var(--muted);

    font-size: 11px;
    text-align: center;
}


/* ===================== INDIVIDUAL FILTER CARD ===================== */

.filter-card {
    overflow: hidden;

    background: #131a25;

    border: 1px solid var(--border);
    border-radius: 8px;

    transition: border-color 0.2s;
}

.filter-card:hover {
    border-color: var(--border-light);
}

.filter-card.dragging {
    opacity: 0.45;
    border-color: var(--accent);
}

.filter-card.drag-target {
    border-color: var(--accent-dark);
}

.filter-head {
    min-height: 53px;

    display: flex;
    align-items: center;
    gap: 9px;

    padding: 10px;

    cursor: grab;
}

.filter-head:active {
    cursor: grabbing;
}

.drag-handle {
    color: #718198;
    font-size: 16px;
    cursor: grab;
}

.filter-name {
    flex: 1;
    min-width: 0;
}

.filter-name strong {
    display: block;

    color: var(--text);

    font-size: 11px;
    font-weight: 600;
}

.filter-name small {
    display: block;

    margin-top: 3px;

    color: var(--muted);
    font-size: 9px;
}


/* ===================== FILTER SWITCH ===================== */

.switch {
    position: relative;

    width: 32px;
    height: 18px;

    flex-shrink: 0;
}

.switch input {
    width: 0;
    height: 0;

    opacity: 0;
}

.switch span {
    position: absolute;
    inset: 0;

    background: #394556;

    border-radius: 20px;

    cursor: pointer;

    transition: background 0.2s;
}

.switch span::before {
    content: "";

    position: absolute;

    width: 12px;
    height: 12px;

    left: 3px;
    top: 3px;

    background: #d4dce7;

    border-radius: 50%;

    transition: transform 0.2s;
}

.switch input:checked + span {
    background: var(--accent-dark);
}

.switch input:checked + span::before {
    transform: translateX(14px);
    background: white;
}

.switch input:focus-visible + span {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}


/* ===================== EXPAND BUTTON ===================== */

.expand-button {
    padding: 4px 6px;

    background: transparent;
    border: none;

    color: var(--muted);

    font-size: 14px;

    cursor: pointer;
}

.expand-button:hover {
    color: var(--accent);
}


/* ===================== FILTER PARAMETERS ===================== */

.filter-params {
    padding: 3px 11px 13px;

    border-top: 1px solid var(--border);
}

.param-row {
    padding-top: 12px;
}

.param-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;

    margin-bottom: 7px;

    color: var(--text-secondary);

    font-size: 10px;
}

.param-label output {
    color: var(--accent);

    font-family: "DM Mono", monospace;
    font-size: 10px;
}

.param-control {
    width: 100%;
}

input[type="range"].param-control {
    height: 5px;

    display: block;

    padding: 0;

    accent-color: var(--accent-dark);

    cursor: pointer;
}

input[type="number"].param-control,
input[type="text"].param-control,
select.param-control {
    padding: 8px;

    background: #0d131d;

    border: 1px solid var(--border);
    border-radius: 5px;

    outline: none;

    color: var(--text);

    font-family: "DM Mono", monospace;
    font-size: 11px;
}

input[type="number"].param-control:focus,
input[type="text"].param-control:focus,
select.param-control:focus {
    border-color: var(--accent-dark);
}

input[type="checkbox"].param-control {
    width: 16px;
    height: 16px;

    accent-color: var(--accent-dark);
    cursor: pointer;
}

.param-description {
    margin-top: 6px;

    color: #7f8b9e;

    font-size: 9px;
    line-height: 1.5;
}


/* ===================== GENERATE BUTTON ===================== */

.generate-button {
    width: 100%;

    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-top: 13px;
    padding: 13px 15px;

    background: var(--accent);

    border: none;
    border-radius: 7px;

    color: #0c1625;

    font-family: "Space Grotesk", sans-serif;
    font-size: 12px;
    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.2s,
        transform 0.2s;
}

.generate-button:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.generate-button:active:not(:disabled) {
    transform: translateY(0);
}

.generate-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.button-arrow {
    font-size: 16px;
}

.generate-hint {
    margin-top: 9px;

    color: var(--muted);

    font-size: 9px;
    text-align: center;
}


/* ===================== OUTPUT PANEL ===================== */

.output-panel {
    gap: 21px;
}

.preview-section,
.video-section {
    width: 100%;
    min-width: 0;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 7px;

    padding: 6px 9px;

    border: 1px solid #28513f;
    border-radius: 5px;

    color: var(--success);

    font-family: "DM Mono", monospace;
    font-size: 8px;
    letter-spacing: 0.7px;
}

.live-indicator span {
    width: 6px;
    height: 6px;

    background: var(--success);
    border-radius: 50%;

    box-shadow: 0 0 8px #78d6ad66;
}

.output-heading {
    margin-bottom: 12px;
}

.preview-section > .section-description {
    margin-bottom: 15px;
}


/* ===================== FRAME PREVIEW ===================== */

.frame-preview-container {
    width: 100%;

    min-height: 280px;
    max-height: 650px;

    aspect-ratio: 16 / 10;

    display: grid;
    place-items: center;

    overflow: hidden;

    background: #070a10;

    border: 1px solid #202a39;
    border-radius: 9px;
}

.frame-preview-container img {
    width: 100%;
    height: 100%;

    max-height: 650px;

    object-fit: contain;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 10px;

    padding: 25px;

    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    color: #cbd5e4;

    font-size: 12px;
    font-weight: 500;
}

.empty-state span {
    font-size: 10px;
    line-height: 1.5;
}

.empty-icon {
    margin-bottom: 4px;

    color: #7186a4;
    font-size: 30px;
}


/* ===================== PREVIEW INFORMATION ===================== */

.preview-information {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;

    margin-top: 10px;

    color: var(--muted);

    font-family: "DM Mono", monospace;
    font-size: 9px;
}

.preview-actions {
    display: flex;
    justify-content: flex-end;

    margin-top: 13px;
}

.secondary-button {
    padding: 9px 13px;

    background: #182437;

    border: 1px solid #2c4160;
    border-radius: 6px;

    color: #b9d3fb;

    font-family: "DM Sans", sans-serif;
    font-size: 10px;

    cursor: pointer;

    transition: background 0.2s;
}

.secondary-button:hover:not(:disabled) {
    background: #233752;
}

.secondary-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


/* ===================== SEPARATOR ===================== */

.output-separator {
    width: 100%;
    height: 1px;

    background: var(--border);
}


/* ===================== VIDEO PLAYER ===================== */

.video-container {
    width: 100%;

    min-height: 250px;

    aspect-ratio: 16 / 9;

    display: grid;
    place-items: center;

    overflow: hidden;

    background: #070a10;

    border: 1px solid #202a39;
    border-radius: 9px;
}

.video-container video {
    width: 100%;
    height: 100%;

    max-height: 650px;

    object-fit: contain;

    background: #05070b;
}

.play-icon {
    width: 45px;
    height: 45px;

    display: grid;
    place-items: center;

    margin-bottom: 5px;
    padding-left: 3px;

    border: 1px solid #34445c;
    border-radius: 50%;

    color: var(--accent);
    font-size: 15px;
}


/* ===================== PROGRESS BAR ===================== */

.progress-area {
    margin-top: 18px;
}

.progress-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;

    color: var(--text-secondary);

    font-size: 10px;
}

.progress-heading strong {
    color: var(--accent);

    font-family: "DM Mono", monospace;
    font-size: 12px;
}

.progress-track {
    width: 100%;
    height: 6px;

    margin: 10px 0;

    overflow: hidden;

    background: #252f3e;

    border-radius: 10px;
}

.progress-fill {
    width: 0%;
    height: 100%;

    background: linear-gradient(
        90deg,
        #5d91ed,
        #9bc2ff
    );

    border-radius: 10px;

    transition: width 0.25s ease;
}

.progress-information {
    display: flex;
    justify-content: space-between;
    gap: 10px;

    color: var(--muted);

    font-family: "DM Mono", monospace;
    font-size: 9px;
}


/* ===================== VIDEO FOOTER ===================== */

.video-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;

    margin-top: 18px;
    padding-top: 15px;

    border-top: 1px solid var(--border);
}

.video-format span {
    display: block;

    margin-bottom: 5px;

    color: var(--muted);

    font-family: "DM Mono", monospace;
    font-size: 9px;
}

.video-format strong {
    color: var(--text-secondary);

    font-size: 10px;
    font-weight: 500;
}

.download-button {
    padding: 9px 12px;

    background: #182437;

    border: 1px solid #385276;
    border-radius: 5px;

    color: var(--accent);

    font-size: 10px;
    text-decoration: none;

    transition: background 0.2s;
}

.download-button:hover {
    background: #233752;
}


/* ===================== TOAST NOTIFICATIONS ===================== */

.toast {
    position: fixed;

    left: 50%;
    bottom: 22px;

    z-index: 1000;

    max-width: 90vw;

    padding: 11px 16px;

    background: #273449;

    border: 1px solid #496080;
    border-radius: 7px;

    color: #edf4ff;

    font-size: 11px;

    opacity: 0;
    pointer-events: none;

    transform: translate(-50%, 20px);

    transition:
        opacity 0.25s,
        transform 0.25s;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast.error {
    background: #3b2229;
    border-color: #874451;
}


/* ===================== UTILITIES ===================== */

.hidden {
    display: none !important;
}


/* ===================== RESPONSIVE DESIGN ===================== */

@media (min-width: 1600px) {

    .workspace {
        grid-template-columns:
            minmax(350px, 410px)
            minmax(0, 1fr);
    }

    .frame-preview-container {
        min-height: 350px;
    }

    .video-container {
        min-height: 320px;
    }

}


@media (max-width: 1050px) {

    .workspace {
        grid-template-columns:
            minmax(290px, 350px)
            minmax(0, 1fr);

        padding: 15px;
        gap: 13px;
    }

    .configuration-panel,
    .output-panel {
        padding: 17px;
    }

    .frame-preview-container {
        min-height: 230px;
    }

    .video-container {
        min-height: 200px;
    }

}


@media (max-width: 800px) {

    .workspace {
        grid-template-columns: 1fr;
    }

    .configuration-panel {
        grid-row: 1;
    }

    .output-panel {
        grid-row: 2;
    }

    .frame-preview-container {
        min-height: 250px;
    }

    .video-container {
        min-height: 220px;
    }

}


@media (max-width: 480px) {

    .topbar {
        height: 65px;
        padding: 0 14px;
    }

    .brand-icon {
        width: 33px;
        height: 33px;
    }

    .brand-info h1 {
        font-size: 13px;
    }

    .brand-info p {
        font-size: 9px;
    }

    .system-status {
        font-size: 7px;
        gap: 5px;
    }

    .workspace {
        padding: 10px;
        gap: 12px;
    }

    .configuration-panel,
    .output-panel {
        padding: 15px;
    }

    .panel-heading h2,
    .output-heading h2 {
        font-size: 18px;
    }

    .settings-grid {
        gap: 8px;
    }

    .frame-preview-container {
        min-height: 190px;
    }

    .video-container {
        min-height: 170px;
    }

    .video-footer {
        align-items: flex-start;
    }

}
/* =========================================================
   FILTER CARD - JAVASCRIPT CLASS COMPATIBILITY
   ========================================================= */

.filter-card.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px #8db8ff33;
}

/* Filter header */
.filter-header {
    min-height: 53px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
}

.filter-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.filter-heading h3 {
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
}

.filter-heading p {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

/* Dedicated drag handle */
.drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    width: 24px;
    height: 27px;
    border-radius: 5px;
    color: #8294ad;
    font-size: 18px;
    cursor: grab;
    user-select: none;
}

.drag-handle:hover {
    color: var(--accent);
    background: #8db8ff12;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Filter description and parameters */
.filter-description {
    margin: 0 12px 11px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.55;
}

.filter-parameters {
    display: grid;
    gap: 12px;
    padding: 12px;
    border-top: 1px solid var(--border);
}

.parameter-control {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.parameter-label {
    color: var(--text-secondary);
    font-size: 10px;
}

/* Number input and slider layout */
.parameter-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 86px;
    align-items: center;
    gap: 12px;
}

.parameter-range {
    width: 100%;
    height: 5px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ===================== PARAMETER INPUTS ===================== */

.parameter-number,
.parameter-text,
.parameter-select {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 7px 9px;

    background: #0c121c;
    border: 1px solid #303e52;
    border-radius: 6px;

    outline: none;
    color: var(--text);

    font-family: "DM Mono", monospace;
    font-size: 11px;
    font-variant-numeric: tabular-nums;

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}

/* Numeric input */
.parameter-number {
    text-align: right;
    color: var(--accent);
}

/* Hover */
.parameter-number:hover,
.parameter-text:hover,
.parameter-select:hover {
    border-color: #465a76;
}

/* Focus */
.parameter-number:focus,
.parameter-text:focus,
.parameter-select:focus {
    background: #101a29;
    border-color: var(--accent-dark);
    box-shadow: 0 0 0 2px #477bc733;
}

/* ===================== NUMBER SPIN BUTTONS ===================== */

/* Hidden by default */
.parameter-number::-webkit-inner-spin-button,
.parameter-number::-webkit-outer-spin-button {
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.18s ease;
}

/* Show on hover */
.parameter-number:hover::-webkit-inner-spin-button,
.parameter-number:hover::-webkit-outer-spin-button {
    opacity: 1;
}

/* Show when selected / focused */
.parameter-number:focus::-webkit-inner-spin-button,
.parameter-number:focus::-webkit-outer-spin-button {
    opacity: 1;
}

/* ===================== SELECT ===================== */

.parameter-select {
    cursor: pointer;
}

.parameter-select option {
    background: #111722;
    color: var(--text);
}

/* ===================== DISABLED PARAMETERS ===================== */

.parameters-disabled {
    opacity: 0.42;
    pointer-events: none;
}

/* ===================== RESPONSIVE ===================== */

@media (max-width: 420px) {
    .parameter-input-row {
        grid-template-columns: minmax(0, 1fr) 78px;
        gap: 9px;
    }
}

/* =========================================================
   CONFIGURATION PANEL - FULL PANEL SCROLLING
   ========================================================= */

.configuration-panel {
    height: calc(100vh - 50px);
    max-height: calc(100vh - 100px);

    overflow-y: auto;
    overflow-x: hidden;

    min-height: 0;

    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: #465a76 transparent;
}

/* Chrome, Edge, Safari */
.configuration-panel::-webkit-scrollbar {
    width: 6px;
}

.configuration-panel::-webkit-scrollbar-track {
    background: transparent;
}

.configuration-panel::-webkit-scrollbar-thumb {
    background: #465a76;
    border-radius: 10px;
}

.configuration-panel::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}