/* ─── Tokens ─────────────────────────────────────────────────────── */
:root {
    --bg:           #080807;
    --bg-panel:     #101010;
    --bg-input:     #1a1916;
    --bg-hover:     #1e1d1a;
    --gold:         #c8a86a;
    --gold-light:   #e8d5a3;
    --gold-dim:     #6b5830;
    --text:         #f0ebe0;
    --text-muted:   #7a7060;
    --text-dim:     #3e3a30;
    --border:       #242018;
    --border-gold:  #38300e;
    --danger:       #8a2f2f;
}

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

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Jost', 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

/* ─── Shared inputs ──────────────────────────────────────────────── */
.input-dark {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    padding: 12px 16px;
    outline: none;
    transition: border-color .2s;
}
.input-dark::placeholder { color: var(--text-muted); }
.input-dark:focus { border-color: var(--gold-dim); }
.input-mono { font-family: 'JetBrains Mono', 'Courier New', monospace; letter-spacing: .08em; }

/* ─── Shared buttons ─────────────────────────────────────────────── */
.btn-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gold);
    color: #0a0907;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    border: none;
    border-radius: 2px;
    padding: 13px 32px;
    cursor: pointer;
    transition: background .2s, transform .1s;
    text-decoration: none;
}
.btn-gold:hover  { background: var(--gold-light); color: #0a0907; }
.btn-gold:active { transform: scale(.98); }
.btn-full { width: 100%; }

/* ─── Blazor error ───────────────────────────────────────────────── */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--danger);
    color: var(--text);
    padding: 10px 20px;
    font-size: 13px;
    z-index: 1000;
}
#blazor-error-ui .reload { color: var(--gold-light); margin-left: 8px; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; opacity: .6; }

/* ─── Landing page ───────────────────────────────────────────────── */
.landing {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background:
        radial-gradient(ellipse 60% 40% at 50% 0%, rgba(200,168,106,.06) 0%, transparent 70%),
        var(--bg);
}

.landing-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 48px;
    width: 100%;
    max-width: 420px;
}

/* Brand block */
.brand { text-align: center; }

.brand-mark {
    width: 90px;
    height: 90px;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    display: inline-block;
    padding: 10px;
    box-sizing: border-box;
    margin-bottom: 20px;
}

.brand-name {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 36px;
    font-weight: 300;
    letter-spacing: .35em;
    color: var(--text);
    margin-bottom: 10px;
}

.brand-tagline {
    font-size: 12px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Panel */
.landing-panel {
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Tabs */
.tab-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 10px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color .2s, border-color .2s;
}
.tab:hover    { color: var(--text); }
.tab-active   { color: var(--gold); border-bottom-color: var(--gold); }

/* Fields */
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label {
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.landing-error {
    font-size: 13px;
    color: #c47070;
    background: rgba(138,47,47,.15);
    border: 1px solid rgba(138,47,47,.3);
    border-radius: 2px;
    padding: 10px 14px;
}

.landing-note {
    text-align: center;
    font-size: 11px;
    letter-spacing: .06em;
    color: var(--text-dim);
    margin-top: -4px;
}

/* ─── Join/gone screens ──────────────────────────────────────────── */
.join-screen, .gone-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: var(--bg);
}

.join-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 40px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.join-logo {
    width: 64px;
    height: 64px;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    display: inline-block;
    padding: 8px;
    box-sizing: border-box;
    margin-bottom: 4px;
}

.join-room-label {
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.join-room-code {
    color: var(--gold);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

.join-card h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 24px;
    font-weight: 300;
    letter-spacing: .06em;
    color: var(--text);
}

.join-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: -4px;
}

.join-error {
    font-size: 13px;
    color: #c47070;
    width: 100%;
    background: rgba(138,47,47,.15);
    border: 1px solid rgba(138,47,47,.3);
    border-radius: 2px;
    padding: 10px;
}

.join-card .input-dark { text-align: center; letter-spacing: .05em; }
.join-card .btn-gold   { width: 100%; }

.gone-inner {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.gone-icon {
    font-size: 40px;
    color: var(--text-dim);
    display: block;
}

.gone-inner h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 26px;
    font-weight: 300;
    color: var(--text);
}

.gone-inner p {
    font-size: 13px;
    color: var(--text-muted);
}

/* ─── Chat layout ────────────────────────────────────────────────── */
.chat-layout {
    display: grid;
    grid-template-columns: 1fr 180px;
    grid-template-rows: auto 1fr auto;
    height: 100dvh;
    overflow: hidden;
}

/* Header */
.chat-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 24px;
    height: 56px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
    flex-shrink: 0;
}

.chat-brand {
    width: 36px;
    height: 36px;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    box-sizing: border-box;
    text-decoration: none;
    flex-shrink: 0;
    transition: border-color .2s;
}
.chat-brand img {
    width: 100%;
    height: 100%;
}
.chat-brand:hover { border-color: var(--gold); color: var(--gold-light); }

.chat-header-center {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-shrink: 0;
}

.chat-room-label {
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.chat-room-code {
    background: none;
    border: none;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    letter-spacing: .08em;
    color: var(--gold);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 2px;
    transition: background .15s;
    position: relative;
}
.chat-room-code:hover { background: var(--border-gold); }

.copy-hint {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gold);
    color: #0a0907;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 2px;
    white-space: nowrap;
    pointer-events: none;
    font-family: inherit;
}

/* Sidebar rooms nav */
.sidebar-rooms-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 6px;
    flex-shrink: 0;
}

.sidebar-section-label {
    font-size: 10px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.sidebar-new-room {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    transition: border-color .15s, color .15s;
}
.sidebar-new-room:hover { border-color: var(--gold-dim); color: var(--gold); }

.sidebar-rooms {
    display: flex;
    flex-direction: column;
    padding: 2px 0;
    flex-shrink: 0;
}

.sidebar-room {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 14px;
    text-decoration: none;
    transition: background .1s;
}

.sidebar-room:hover { background: var(--bg-hover); }

.sidebar-room-id {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    letter-spacing: .06em;
    color: var(--text-muted);
}

.sidebar-room-active { background: rgba(200,168,106,.06); }
.sidebar-room-active .sidebar-room-id { color: var(--gold); }

.sidebar-room-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    flex-shrink: 0;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
    flex-shrink: 0;
}

/* Active rooms on home page */
.active-rooms {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.active-rooms-label {
    font-size: 10px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 2px;
}

.active-room-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 10px 14px;
    text-decoration: none;
    transition: border-color .15s;
    gap: 12px;
}

.active-room-link:hover { border-color: var(--gold-dim); }

.active-room-id {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    letter-spacing: .08em;
    color: var(--gold);
}

.active-room-nick {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar members (IRC style) */
.chat-sidebar {
    grid-column: 2;
    grid-row: 2 / 4;
    border-left: 1px solid var(--border);
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 12px 14px 8px;
    font-size: 10px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-members {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.sidebar-member {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-member::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}

.sidebar-member-self {
    color: var(--gold);
}

.sidebar-member-self::before {
    background: var(--gold);
}

/* Messages */
.chat-messages {
    overflow-y: auto;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-dim);
    text-align: center;
    font-size: 14px;
    padding: 40px;
    margin: auto;
}

.chat-empty-sub {
    font-size: 12px;
    color: var(--text-dim);
}

.msg-system {
    text-align: center;
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 8px 24px;
}

.msg-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 4px 24px;
    transition: background .1s;
}
.msg-row:hover { background: rgba(255,255,255,.015); }

.msg-nick {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .05em;
    color: var(--gold);
    min-width: 80px;
    text-align: right;
    flex-shrink: 0;
}

.msg-own .msg-nick { color: var(--gold-light); }

.msg-bubble {
    color: var(--text);
    font-size: 14px;
    word-break: break-word;
    flex: 1;
}

.msg-time {
    font-size: 10px;
    color: var(--text-dim);
    flex-shrink: 0;
    letter-spacing: .05em;
}

/* Contador de participantes: solo visible en mobile */
.header-count {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-family: inherit;
    font-size: 11px;
    letter-spacing: .1em;
    color: var(--text-muted);
    padding: 4px 8px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.header-count:hover   { border-color: var(--gold-dim); color: var(--text); }
.header-count-open    { border-color: var(--gold-dim); color: var(--gold); }

.header-rooms-btn {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-muted);
    padding: 4px 8px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.header-rooms-btn:hover { border-color: var(--gold-dim); color: var(--text); }

.btn-leave {
    margin-left: auto;
    background: none;
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s, color .15s, background .15s;
}
.btn-leave:hover { border-color: var(--danger); color: #c47070; background: rgba(138,47,47,.12); }

/* Footer */
.chat-footer {
    grid-column: 1;
    border-top: 1px solid var(--border);
    background: var(--bg-panel);
    padding: 16px 24px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    flex-shrink: 0;
}

.chat-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 4px 4px 4px 16px;
    transition: border-color .2s;
}

.chat-input-row:focus-within { border-color: var(--gold-dim); }

.chat-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    padding: 8px 0;
}
.chat-input::placeholder { color: var(--text-muted); }

.chat-send {
    background: var(--gold);
    border: none;
    color: #0a0907;
    width: 36px;
    height: 36px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
}
.chat-send:hover  { background: var(--gold-light); }
.chat-send-disabled { background: var(--bg-hover) !important; color: var(--text-dim) !important; cursor: default; }

/* ─── Attach button ──────────────────────────────────────────────── */
.chat-attach {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 6px;
    flex-shrink: 0;
    transition: color .15s;
    line-height: 1;
}
.chat-attach:hover:not(:disabled) { color: var(--gold); }
.chat-attach:disabled { opacity: .3; cursor: default; }

/* ─── File message card ──────────────────────────────────────────── */
.msg-file-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
    max-width: 260px;
}

.msg-file-expired {
    opacity: .45;
}

.msg-file-link {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text);
    transition: color .15s;
}
.msg-file-link:hover { color: var(--gold); }

.msg-file-link-dead {
    cursor: default;
    color: var(--text-muted);
}

.msg-file-icon {
    font-size: 13px;
    flex-shrink: 0;
}

.msg-file-name {
    font-size: 13px;
    word-break: break-all;
}

.msg-file-size {
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: .04em;
}

/* ─── Countdown bar ──────────────────────────────────────────────── */
@keyframes countdown-bar {
    from { width: 100%; }
    to   { width: 0%; }
}

.file-bar-track {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2px;
}

.file-bar-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 2px;
    animation: countdown-bar linear forwards;
}

/* ─── File upload modal ──────────────────────────────────────────── */
.file-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.file-modal {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 28px 28px 24px;
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.file-modal-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 20px;
    font-weight: 300;
    letter-spacing: .06em;
    color: var(--text);
    margin: 0;
}

.file-modal-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 10px 12px;
}

.file-modal-filename {
    font-size: 13px;
    color: var(--text);
    word-break: break-all;
}

.file-modal-size {
    font-size: 11px;
    color: var(--text-dim);
}

.file-modal-error {
    font-size: 13px;
    color: #c47070;
    background: rgba(138,47,47,.15);
    border: 1px solid rgba(138,47,47,.3);
    border-radius: 2px;
    padding: 8px 12px;
    margin: 0;
}

.file-modal-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-modal-label {
    font-size: 12px;
    letter-spacing: .08em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.file-modal-range {
    width: 100%;
    accent-color: var(--gold);
    cursor: pointer;
}

.file-modal-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: .06em;
}

.file-modal-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.file-modal-actions .btn-gold {
    flex: 1;
    padding: 11px 16px;
}

.file-modal-cancel {
    background: none;
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    padding: 10px 16px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.file-modal-cancel:hover:not(:disabled) { border-color: var(--text-dim); color: var(--text); }

/* ─── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── Mobile members drawer ──────────────────────────────────────── */
.mobile-members-backdrop {
    display: none;
}
.mobile-members-drawer {
    display: none;
}

/* ─── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }
    .chat-sidebar {
        display: none;
    }
    .header-count {
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }
    .chat-footer {
        grid-column: 1;
    }

    .header-rooms-btn {
        display: inline-flex;
        align-items: center;
    }

    .mobile-members-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 90;
        background: rgba(0,0,0,.45);
    }

    .mobile-members-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        z-index: 91;
        background: var(--bg-panel);
        border-bottom: 1px solid var(--border);
        max-height: 40dvh;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--border) transparent;
    }

    .mobile-room-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 20px;
        border-bottom: 1px solid var(--border);
        text-decoration: none;
        transition: background .1s;
    }
    .mobile-room-link:hover  { background: var(--bg-hover); }
    .mobile-room-active { background: rgba(200,168,106,.06); }
    .mobile-room-active .sidebar-room-id { color: var(--gold); }

    .mobile-room-new {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 12px 20px;
        font-size: 12px;
        letter-spacing: .08em;
        color: var(--text-muted);
        text-decoration: none;
        transition: color .15s;
    }
    .mobile-room-new:hover { color: var(--gold); }
}
