/* ------------------------------------------------------------------
   Karácsonyi húzás – közös stílus
   ------------------------------------------------------------------ */
:root {
    --brand: #b3261e;
    --brand-dark: #8c1d17;
    --brand-soft: #fbe9e7;
    --ink: #1f1f24;
    --muted: #6b6b76;
    --line: #e7e5ea;
    --surface: #ffffff;
    --surface-2: #f6f5f8;
    --ok: #1e7a4c;
    --ok-soft: #e5f4ec;
    --warn-soft: #fff4e0;
    --danger: #c62828;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px rgba(20, 10, 10, 0.18);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    color: var(--ink);
    background-color: #5a0f0b;
    background-image:
        linear-gradient(180deg, rgba(40, 6, 4, 0.55) 0%, rgba(40, 6, 4, 0.25) 45%, rgba(40, 6, 4, 0.55) 100%),
        url('background.jpg');
    background-size: cover;
    background-position: center bottom;
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }

/* ---------- Fejléc ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(30, 6, 5, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-inner {
    max-width: 760px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand {
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.92rem;
}

.topbar-user a { color: #fff; opacity: 0.85; }
.topbar-user a:hover { opacity: 1; text-decoration: none; }

/* ---------- Oldal ---------- */
.page {
    max-width: 760px;
    margin: 0 auto;
    padding: 28px 16px 60px;
}

.page.narrow, .topbar-inner.narrow { max-width: 440px; }
.page.wide, .topbar-inner.wide { max-width: 1080px; }

.card-x {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 20px;
}

.card-x h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 6px;
}

.card-x h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 4px;
}

.lead-muted {
    color: var(--muted);
    margin: 0 0 20px;
}

.section-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
}

/* ---------- Űrlapok, gombok ---------- */
.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--ink);
    margin-bottom: 6px;
}

.form-control {
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    padding: 10px 14px;
    font-size: 0.95rem;
    background: #fff;
}

.form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.15);
}

.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    padding: 10px 18px;
}

.btn-sm { padding: 5px 12px; font-size: 0.85rem; }

.btn-brand, .btn-custom {
    background: var(--brand);
    border: 1px solid var(--brand);
    color: #fff;
}

.btn-brand:hover, .btn-brand:focus, .btn-custom:hover, .btn-custom:focus {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink);
}

.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-big {
    padding: 16px 22px;
    font-size: 1.05rem;
    font-weight: 600;
}

/* ---------- Értesítések ---------- */
.flash-stack { margin-bottom: 16px; display: grid; gap: 8px; }

.flash {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 0.92rem;
    background: #fff;
    border-left: 4px solid var(--muted);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.flash-success { border-left-color: var(--ok); }
.flash-error { border-left-color: var(--danger); }
.flash-warning { border-left-color: #e69100; }
.flash-hide { opacity: 0; transform: translateY(-6px); }

.note {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--muted);
    font-size: 0.92rem;
}

.note-warn { background: var(--warn-soft); color: #7a4b00; }
.note-danger { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- Állapotjelzők ---------- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--surface-2);
    color: var(--muted);
    white-space: nowrap;
}

.status-pill::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.status-pill.on { background: var(--ok-soft); color: var(--ok); }
.status-pill.waiting { background: var(--warn-soft); color: #9a6200; }

/* ---------- Húzás eredménye ---------- */
.draw-result {
    text-align: center;
    padding: 12px 0 4px;
}

.draw-result .label {
    color: var(--muted);
    font-size: 0.95rem;
}

.draw-result .name {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--brand);
    margin: 4px 0 0;
    word-break: break-word;
}

.empty-state {
    text-align: center;
    padding: 24px 8px 8px;
    color: var(--muted);
}

/* ---------- Ajándékötletek ---------- */
.gift-list {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
    display: grid;
    gap: 8px;
}

.gift-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    word-break: break-word;
}

.icon-btn {
    border: none;
    background: transparent;
    color: var(--muted);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }

/* ---------- Chat ---------- */
.chat-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface-2);
    border-radius: 12px;
    margin-bottom: 14px;
}

/* Szerepenként saját szín: piros = akinek te ajándékozol, zöld = aki neked ajándékoz */
.chat-tab[data-type="drawn"], .chat-panel[data-type="drawn"] {
    --accent: var(--brand);
    --accent-dark: var(--brand-dark);
    --accent-soft: var(--brand-soft);
}

.chat-tab[data-type="drawer"], .chat-panel[data-type="drawer"] {
    --accent: var(--ok);
    --accent-dark: #155c39;
    --accent-soft: var(--ok-soft);
}

.chat-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.25;
    border-top: 3px solid transparent !important;
    border: none;
    background: transparent;
    padding: 9px 12px;
    border-radius: 9px;
    font-weight: 500;
    font-size: 0.92rem;
    color: var(--muted);
    position: relative;
    transition: background 0.15s ease, color 0.15s ease;
}

.tab-role {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
}

.tab-name { font-size: 0.98rem; }

.chat-tab.active {
    background: #fff;
    color: var(--ink);
    border-top-color: var(--accent) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.chat-tab .dot {
    display: none;
    position: absolute;
    top: 8px;
    right: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.chat-tab.has-new .dot { display: block; }

.chat-panel { display: none; }
.chat-panel.active { display: block; }

.chat-hint {
    font-size: 0.88rem;
    color: var(--muted);
    margin: 0 2px 10px;
}

.chat-role {
    border-left: 4px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 10px;
    font-size: 0.88rem;
}

.chat-role-title { margin: 0 0 4px; font-weight: 500; }
.chat-role-title strong { color: var(--accent-dark); }

.chat-role-tips {
    margin: 0;
    padding-left: 18px;
    color: #4a4a55;
}

.chat-role-tips li { margin: 1px 0; }

.chat-panel .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-accent {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #fff;
    font-weight: 600;
}

.btn-accent:hover, .btn-accent:focus { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }

.chat-window {
    border: 2px solid var(--accent-soft);
    height: 360px;
    overflow-y: auto;
    padding: 16px;
    background: var(--surface-2);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-empty {
    margin: auto;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

.msg {
    max-width: 78%;
    display: flex;
    flex-direction: column;
}

.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }

.msg-bubble {
    padding: 9px 14px;
    border-radius: 16px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.msg.mine .msg-bubble {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 5px;
}

.msg.theirs .msg-bubble {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    border-bottom-left-radius: 5px;
}

.msg-time {
    font-size: 0.72rem;
    color: var(--muted);
    margin: 3px 6px 6px;
}

.chat-compose {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.chat-compose .form-control { flex: 1; }

.gif-btn {
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    padding-left: 12px;
    padding-right: 12px;
}

.msg-gif img {
    display: block;
    width: 180px;
    height: 180px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.gif-picker {
    margin-top: 12px;
    padding: 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.gif-picker-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.gif-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.gif-item {
    padding: 0;
    border: 2px solid transparent;
    border-radius: 10px;
    background: none;
    overflow: hidden;
    aspect-ratio: 1;
    transition: transform 0.1s ease, border-color 0.1s ease;
}

.gif-item:hover, .gif-item:focus-visible { border-color: var(--brand); transform: scale(1.04); outline: none; }
.gif-item img { width: 100%; height: 100%; display: block; }

.gif-source-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.gif-sources {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 9px;
}

.gif-source {
    border: none;
    background: transparent;
    padding: 4px 14px;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
}

.gif-source.active { background: var(--brand); color: #fff; }

.klipy-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.klipy-topic {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 3px 11px;
    font-size: 0.8rem;
    color: var(--ink);
}

.klipy-topic:hover { border-color: var(--brand); }
.klipy-topic.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }

.klipy-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

.klipy-foot .btn[hidden] { display: none; }
.klipy-attr { margin-left: auto; font-size: 0.72rem; color: var(--muted); letter-spacing: 0.02em; }

.gif-none {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
    padding: 20px 0;
}

/* ---------- Táblázatok (admin) ---------- */
.table-x {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.table-x th {
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
}

.table-x td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table-x tr:last-child td { border-bottom: none; }

.table-wrap { overflow-x: auto; }

.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.admin-grid .card-x { margin-bottom: 0; }

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.toggle-row:last-child { border-bottom: none; }

.danger-zone { border: 1px solid #f1c7c3; }

code { color: var(--brand-dark); }

/* ---------- Mobil ---------- */
@media (max-width: 600px) {
    .card-x { padding: 20px; }
    .card-x h1 { font-size: 1.35rem; }
    .draw-result .name { font-size: 1.8rem; }
    .chat-window { height: 300px; }
    .msg { max-width: 88%; }
    .msg-gif img { width: 150px; height: 150px; }
    .tab-role { font-size: 0.62rem; }
    .tab-name { font-size: 0.9rem; }
    .chat-role { font-size: 0.82rem; padding: 8px 12px; }
    .gif-grid { grid-template-columns: repeat(3, 1fr); }
    .topbar-user .who { display: none; }
}
