/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:           #0d0f14;
    --surface:      #161a24;
    --surface2:     #1e2333;
    --border:       #262d42;
    --border-focus: #5c6bc0;
    --text:         #e4e8f5;
    --text-muted:   #6b7ba8;
    --accent:       #5c6bc0;
    --accent-hi:    #7986cb;
    --green:        #4caf73;
    --red:          #e05353;
    --dot-on:       #4caf73;
    --dot-off:      #374151;
    --radius:       10px;
    --radius-sm:    6px;
}

html { font-size: 16px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    line-height: 1.55;
    min-height: 100vh;
}

/* ── Layout ───────────────────────────────────────────────── */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.container--center {
    max-width: 480px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    justify-content: center;
}

/* ── Typography helpers ───────────────────────────────────── */
.hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Index page header ────────────────────────────────────── */
.app-header {
    text-align: center;
    padding: 0 0 32px;
}

.logo {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -2px;
    color: var(--text);
    text-decoration: none;
    display: block;
}

.logo--sm {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.tagline {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 6px;
}

/* ── Room header ──────────────────────────────────────────── */
.room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    gap: 12px;
}

.room-id {
    display: flex;
    align-items: center;
    gap: 8px;
}

.room-id__label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.room-id__name {
    font-family: 'Courier New', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--accent-hi);
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.card__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* ── Room two-column layout ───────────────────────────────── */
.room-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 680px) {
    .room-layout { grid-template-columns: 1fr; }
}

/* ── QR code ──────────────────────────────────────────────── */
.qr-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.qr-wrap canvas,
.qr-wrap img {
    padding: 10px;
    background: #fff;
    border-radius: var(--radius-sm);
    display: block;
}

.room-url-text {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    word-break: break-all;
    text-align: center;
    margin-top: 4px;
}

/* ── Device status ────────────────────────────────────────── */
.device-list { margin-bottom: 16px; }

.device-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    font-size: 0.9rem;
}

.dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--dot-off);
    flex-shrink: 0;
    transition: background 0.3s, box-shadow 0.3s;
}

.dot--on {
    background: var(--dot-on);
    box-shadow: 0 0 7px var(--dot-on);
}

/* ── Meta list ────────────────────────────────────────────── */
.meta-list {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    display: grid;
    row-gap: 4px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
}

.meta-row dt { color: var(--text-muted); }

.meta-row dd {
    font-family: 'Courier New', monospace;
    color: var(--text);
}

/* ── Form inputs ──────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

label {
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

input[type="text"]:focus { border-color: var(--border-focus); }

textarea {
    width: 100%;
    padding: 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

textarea:focus { border-color: var(--border-focus); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-group {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-group--wrap { flex-wrap: wrap; }

.btn {
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:hover  { opacity: 0.82; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn--primary   { background: var(--accent); color: #fff; }
.btn--secondary { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn--danger    { background: transparent; color: var(--red); border-color: var(--red); }
.btn--sm        { padding: 5px 10px; font-size: 0.8rem; }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.15rem;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.15s;
    line-height: 1;
}

.btn-icon:hover { color: var(--text); }

.link-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--accent-hi);
    font-size: inherit;
    padding: 0;
    text-decoration: underline;
}

/* ── Status messages ──────────────────────────────────────── */
.status-msg {
    font-size: 0.83rem;
    margin-top: 8px;
    min-height: 1.2em;
    color: var(--text-muted);
    transition: color 0.2s;
}

.status-msg--ok  { color: var(--green); }
.status-msg--err { color: var(--red); }

/* ── New-content banner ───────────────────────────────────── */
.new-banner {
    background: rgba(92, 107, 192, 0.12);
    border: 1px solid rgba(92, 107, 192, 0.3);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--accent-hi);
    margin-bottom: 10px;
}

/* ── Image drop zone ──────────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}

.drop-zone:hover,
.drop-zone--over {
    border-color: var(--accent);
    background: rgba(92, 107, 192, 0.04);
}

.drop-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.drop-placeholder p { margin: 0; }

#imgPreview {
    max-width: 100%;
    max-height: 420px;
    object-fit: contain;
    display: block;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert--error {
    background: rgba(224, 83, 83, 0.1);
    border: 1px solid rgba(224, 83, 83, 0.3);
    color: var(--red);
}

/* ── Footer ───────────────────────────────────────────────── */
.app-footer {
    text-align: center;
    padding: 28px 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}
