/* LVL Editor Demo — UI Styles */

:root {
    --lae-bg: #0f1117;
    --lae-bg-raised: #1a1d27;
    --lae-bg-surface: #232731;
    --lae-bg-hover: #2a2e3a;
    --lae-border: #2e3340;
    --lae-text: #e1e4eb;
    --lae-text-muted: #8b90a0;
    --lae-primary: #6366f1;
    --lae-primary-hover: #818cf8;
    --lae-success: #22c55e;
    --lae-success-bg: rgba(34, 197, 94, 0.1);
    --lae-danger: #ef4444;
    --lae-danger-bg: rgba(239, 68, 68, 0.1);
    --lae-warning: #f59e0b;
    --lae-warning-bg: rgba(245, 158, 11, 0.1);
    --lae-info-bg: rgba(99, 102, 241, 0.1);
    --lae-radius: 8px;
    --lae-radius-sm: 6px;
    --lae-header-height: 56px;
    --lae-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --lae-font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--lae-font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--lae-text);
    background: var(--lae-bg);
}

/* ─── Header ─── */

.lae-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--lae-header-height);
    padding: 0 20px;
    background: var(--lae-bg-raised);
    border-bottom: 1px solid var(--lae-border);
}

.lae-header__brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lae-header__icon {
    color: var(--lae-primary);
}

.lae-header__title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.lae-header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ─── Layout ─── */

.demo-main {
    display: flex;
    flex-direction: row;
    height: calc(100vh - var(--lae-header-height));
    overflow: hidden;
}

/* ─── Preview Pane ─── */

.demo-preview {
    flex: 0 0 60%;
    overflow-y: auto;
    background: #fff;
    position: relative;
    min-height: 0;
    border-left: 1px solid var(--lae-border);
}

.demo-preview__banner {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--lae-bg-raised);
    border-bottom: 1px solid var(--lae-border);
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--lae-text-muted);
}

.demo-preview__banner-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.demo-preview__banner-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--lae-text-muted);
}

.demo-preview__banner-dot--original {
    background: var(--lae-primary);
}

.demo-preview__banner-dot--proposed {
    background: var(--lae-success);
}

.demo-preview__content {
    max-width: 1320px;
    margin: 0 auto;
}

.demo-preview__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--lae-text-muted);
    font-size: 14px;
    background: #fff;
}

/* ─── Editor Pane ─── */

.demo-editor {
    flex: 0 0 40%;
    overflow-y: auto;
    background: var(--lae-bg-raised);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.demo-editor__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.demo-editor__title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--lae-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Form Controls ─── */

.lae-textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--lae-bg);
    color: var(--lae-text);
    border: 1px solid var(--lae-border);
    border-radius: var(--lae-radius-sm);
    font-family: var(--lae-font);
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    min-height: 200px;
}

.lae-textarea:focus {
    outline: none;
    border-color: var(--lae-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.lae-textarea::placeholder {
    color: var(--lae-text-muted);
    opacity: 0.6;
}

/* ─── Character Counter ─── */

.lae-char-count {
    display: block;
    text-align: right;
    font-size: 11px;
    color: var(--lae-text-muted);
    margin-top: 4px;
}

.lae-char-count--warn {
    color: var(--lae-warning);
}

/* ─── Buttons ─── */

.lae-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-family: var(--lae-font);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--lae-radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.lae-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lae-btn--sm {
    padding: 5px 10px;
    font-size: 12px;
}

.lae-btn--primary {
    background: var(--lae-primary);
    color: #fff;
}

.lae-btn--primary:hover:not(:disabled) {
    background: var(--lae-primary-hover);
}

.lae-btn--ghost {
    background: transparent;
    color: var(--lae-text-muted);
    border-color: var(--lae-border);
}

.lae-btn--ghost:hover:not(:disabled) {
    color: var(--lae-text);
    background: var(--lae-bg-hover);
}

.lae-btn--danger {
    background: transparent;
    color: var(--lae-danger);
    border-color: var(--lae-danger);
}

.lae-btn--danger:hover:not(:disabled) {
    background: var(--lae-danger-bg);
}

/* ─── Prompt Area ─── */

.lae-prompt {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lae-prompt__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lae-prompt__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lae-prompt__hint {
    font-size: 12px;
    color: var(--lae-text-muted);
}

/* ─── Badge ─── */

.lae-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    background: var(--lae-info-bg);
    color: var(--lae-primary-hover);
    border-radius: 999px;
    text-transform: none;
    letter-spacing: normal;
}

/* ─── Changes List ─── */

.lae-changes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.lae-change-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    background: var(--lae-bg);
    border-radius: var(--lae-radius-sm);
    font-size: 13px;
    line-height: 1.5;
}

.lae-change-item::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    min-width: 6px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--lae-primary);
}

/* ─── Validation Warnings ─── */

.lae-validation-warnings {
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--lae-warning-bg);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--lae-radius-sm);
}

.lae-validation-warnings__title {
    font-weight: 600;
    font-size: 13px;
    color: var(--lae-warning);
    margin-bottom: 6px;
}

.lae-validation-warnings__list {
    list-style: none;
    font-size: 12px;
    color: var(--lae-text);
}

.lae-validation-warnings__list li {
    padding: 2px 0;
}

/* ─── Response Panel ─── */

.demo-response {
    background: var(--lae-bg-surface);
    border: 1px solid var(--lae-border);
    border-radius: var(--lae-radius);
    padding: 16px;
}

.demo-response__title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--lae-text-muted);
    margin-bottom: 12px;
}

.demo-response__actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ─── Rate Limit ─── */

.demo-rate {
    font-size: 12px;
    color: var(--lae-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.demo-rate__count {
    font-weight: 600;
}

.demo-rate--warning .demo-rate__count {
    color: var(--lae-warning);
}

.demo-rate--exhausted {
    color: var(--lae-danger);
}

.demo-rate--exhausted .demo-rate__count {
    color: var(--lae-danger);
}

/* ─── Status Bar ─── */

.lae-status {
    font-size: 13px;
    padding: 4px 0;
    min-height: 24px;
    transition: color 0.15s ease;
}

.lae-status:empty {
    display: none;
}

.lae-status--info {
    color: var(--lae-text-muted);
}

.lae-status--success {
    color: var(--lae-success);
}

.lae-status--error {
    color: var(--lae-danger);
}

/* ─── Hidden ─── */

.lae-panel--hidden {
    display: none !important;
}

.lae-hidden {
    display: none !important;
}

.lae-spin {
    animation: lae-spin 1s linear infinite;
}

@keyframes lae-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ─── Scrollbar ─── */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--lae-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--lae-text-muted);
}

/* ─── Responsive ─── */

@media (max-width: 900px) {
    .demo-main {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - var(--lae-header-height));
    }

    .demo-editor {
        flex: 0 0 auto;
        max-height: 50vh;
        border-bottom: 1px solid var(--lae-border);
    }

    .demo-preview {
        flex: 1;
        min-height: 300px;
        border-left: none;
    }
}
