/* Pascal Demos — COR24 panel styles */

/* Header */
header {
    padding: 4px 20px;
    border-bottom: 1px solid var(--surface1);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    background: var(--mantle);
}

header h1 {
    font-size: 16px;
    font-weight: 700;
    color: var(--blue);
    white-space: nowrap;
}

header .subtitle {
    font-size: 13px;
    color: var(--overlay2);
}

/* Toolbar / control bar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-bottom: 1px solid var(--surface1);
    background: var(--mantle);
    flex-shrink: 0;
}

.demo-select {
    font-family: var(--mono);
    font-size: 12px;
    padding: 4px 8px;
    background: var(--surface0);
    color: var(--text);
    border: 1px solid var(--surface2);
    border-radius: 4px;
    cursor: pointer;
}

.btn {
    font-family: var(--mono);
    font-size: 13px;
    padding: 4px 14px;
    border: 1px solid var(--surface2);
    border-radius: 4px;
    cursor: pointer;
    background: var(--surface0);
    color: var(--text);
    transition: background 0.15s;
}

.btn:hover:not(:disabled) {
    background: var(--surface1);
}

.btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.btn-run {
    color: var(--green);
    border-color: var(--green);
}

.btn-stop {
    color: var(--red);
    border-color: var(--red);
}

.btn-compile {
    color: var(--mauve);
    border-color: var(--mauve);
}

/* Mode tabs */
.mode-tabs {
    display: flex;
    gap: 0;
}

.btn-tab {
    border-radius: 0;
    padding: 4px 12px;
    font-size: 12px;
    color: var(--overlay2);
    border-color: var(--surface2);
}

.btn-tab:first-child {
    border-radius: 4px 0 0 4px;
}

.btn-tab:last-child {
    border-radius: 0 4px 4px 0;
    border-left: none;
}

.btn-tab-active {
    color: var(--blue);
    border-color: var(--blue);
    background: var(--surface1);
}

.status {
    font-size: 13px;
    font-weight: 600;
    margin-left: auto;
    padding-right: 80px;
}

.status-ready { color: var(--yellow); }
.status-compiling { color: var(--mauve); }
.status-linking { color: var(--sapphire); }
.status-running { color: var(--green); }
.status-exited { color: var(--overlay2); }

/* Hardware emulator bar */
.hw-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--surface1);
    background: var(--mantle);
    flex-shrink: 0;
}

.hw-bar-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.hw-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hw-indicator-label {
    font-size: 12px;
    color: var(--overlay2);
    white-space: nowrap;
}

.led-large {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--surface2);
    background: var(--surface0);
    flex-shrink: 0;
}

.led-power {
    background: var(--blue);
    border-color: var(--blue);
    box-shadow: 0 0 8px var(--blue);
}

.led-user-on {
    background: var(--red);
    border-color: var(--red);
    box-shadow: 0 0 10px var(--red);
}

.switch-btn-large {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    padding: 4px 16px;
    background: var(--surface0);
    color: var(--overlay2);
    border: 2px solid var(--surface2);
    border-radius: 4px;
    cursor: pointer;
    min-width: 50px;
    text-align: center;
}

.switch-btn-large:hover {
    background: var(--surface1);
}

.switch-on-large {
    color: var(--peach);
    border-color: var(--peach);
    background: var(--surface1);
}

.hw-stats {
    display: flex;
    gap: 12px;
    margin-left: auto;
    padding-right: 80px;
}

/* Three-panel grid: code top, hardware bottom */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 3fr 2fr;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.panel-tl { border-right: 1px solid var(--surface1); border-bottom: 1px solid var(--surface1); }
.panel-tr { border-bottom: 1px solid var(--surface1); }
.panel-hw { grid-column: 1 / -1; display: flex; flex-direction: column; }

.panel-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 12px;
    border-bottom: 1px solid var(--surface1);
    background: var(--mantle);
    flex-shrink: 0;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 12px;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Code display */
.code-display {
    font-size: 13px;
    line-height: 1.4;
    white-space: pre;
    color: var(--subtext1);
    tab-size: 4;
}

/* Code editor (compile mode) */
.code-editor {
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.5;
    white-space: pre;
    tab-size: 4;
    color: var(--text);
    background: var(--crust);
    border: 1px solid var(--surface2);
    border-radius: 4px;
    padding: 8px 12px;
    resize: none;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    flex: 1;
    min-height: 0;
}

.code-editor:focus {
    outline: none;
    border-color: var(--blue);
}

.code-editor:disabled {
    opacity: 0.6;
}

/* Output console */
.output-text {
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--subtext1);
    background: var(--crust);
    padding: 8px;
    border-radius: 4px;
    flex: 1;
    min-height: 40px;
    overflow-y: auto;
}

.uart-field {
    flex: 1;
    font-family: var(--mono);
    font-size: 13px;
    padding: 4px 8px;
    background: var(--crust);
    color: var(--text);
    border: 1px solid var(--surface2);
    border-radius: 4px;
}

.uart-field::placeholder {
    color: var(--overlay0);
}

.uart-field:focus {
    outline: none;
    border-color: var(--blue);
}

.btn-send {
    color: var(--sapphire);
    border-color: var(--sapphire);
}

/* Hardware UART I/O */
.hw-io {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.hw-uart-output {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.hw-uart-input {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 4px 12px 8px;
    border-top: 1px solid var(--surface1);
}

.hw-io-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 12px;
    flex-shrink: 0;
}

.hw-uart-output .output-text {
    margin: 0 12px 8px;
}

.uart-input-row {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

/* Hardware stats in bar */
.hw-stat {
    font-size: 12px;
    color: var(--overlay1);
    font-variant-numeric: tabular-nums;
}

/* About button */
.btn-about {
    margin-left: auto;
    font-size: 12px;
    padding: 2px 10px;
    color: var(--overlay2);
    margin-right: 80px;
}

/* About dialog */
.about-box {
    background: var(--base);
    border: 1px solid var(--surface2);
    border-radius: 8px;
    width: 560px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.about-header {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--surface1);
}

.about-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--blue);
}

.about-close {
    margin-left: auto;
    font-size: 18px;
    padding: 2px 8px;
    color: var(--overlay2);
    border: none;
}

.about-body {
    padding: 16px 20px;
}

.about-section {
    margin-bottom: 14px;
}

.about-section:last-child {
    margin-bottom: 0;
}

.about-section h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--lavender);
    margin-bottom: 4px;
}

.about-section p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--subtext1);
}

/* Discard dialog */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.dialog-box {
    background: var(--surface0);
    border: 1px solid var(--surface2);
    border-radius: 8px;
    padding: 20px 24px;
    min-width: 320px;
    max-width: 400px;
}

.dialog-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--yellow);
    margin-bottom: 8px;
}

.dialog-body {
    font-size: 13px;
    color: var(--subtext1);
    margin-bottom: 16px;
    line-height: 1.4;
}

.dialog-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.dialog-cancel {
    color: var(--text);
}

.dialog-confirm {
    color: var(--red);
    border-color: var(--red);
}

/* Footer */
footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 20px;
    font-size: 0.8em;
    color: var(--overlay0);
    border-top: 1px solid var(--surface1);
    flex-shrink: 0;
}

footer .sep { color: var(--surface2); }
footer a { color: var(--blue); text-decoration: none; }
footer a:hover { text-decoration: underline; }
