/* ============================================================
   Admin felület – letisztult, modern dashboard
   ============================================================ */

@font-face {
    font-family: 'Jost';
    src: url('../fonts/jost-v20-latin_latin-ext-regular.woff2') format('woff2');
    font-weight: 400; font-display: swap;
}
@font-face {
    font-family: 'Jost';
    src: url('../fonts/jost-v20-latin_latin-ext-500.woff2') format('woff2');
    font-weight: 500; font-display: swap;
}
@font-face {
    font-family: 'Jost';
    src: url('../fonts/jost-v20-latin_latin-ext-600.woff2') format('woff2');
    font-weight: 600; font-display: swap;
}
@font-face {
    font-family: 'Cormorant Garamond';
    src: url('../fonts/cormorant-garamond-v21-latin_latin-ext-600.woff2') format('woff2');
    font-weight: 600; font-display: swap;
}

:root {
    --primary: #a2635d;
    --primary-dark: #8a504b;
    --accent: #c5a253;
    --bg: #f7f4f2;
    --card: #ffffff;
    --dark: #322220;
    --muted: #8d7b76;
    --line: #eadfda;
    --ok: #2e7d36;
    --ok-bg: #e9f5ea;
    --warn: #9a6c08;
    --warn-bg: #fbf1d8;
    --danger: #b3362c;
    --danger-bg: #fbe7e5;
    --radius: 14px;
    --shadow: 0 4px 20px rgba(50, 34, 32, .07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Jost', system-ui, sans-serif;
    font-size: 15.5px;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.55;
}

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

h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }

/* ---------- Elrendezés ---------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    background: var(--dark);
    color: #e9ddd9;
    padding: 1.2rem .9rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    flex-shrink: 0;
    /* hosszú oldalakon is mindig látszódjon a teljes menü (kilépéssel együtt) */
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.2) transparent;
}

.side-sep { border-top: 1px solid rgba(255,255,255,.12); margin: .5rem .4rem; }
.sidebar a.item.secondary { font-size: .87rem; padding: .42rem .8rem; color: #b9a49e; }
.sidebar a.item.secondary:hover { color: #fff; }
.sidebar a.item.secondary.active { color: #fff; }

.side-top { display: flex; align-items: center; }
.side-top .brand { flex: 1; }
.side-toggle {
    display: none;
    background: none; border: 0; color: #fff;
    font-size: 1.6rem; cursor: pointer; padding: .2rem .6rem;
}
.side-nav { display: flex; flex-direction: column; gap: .2rem; flex: 1; min-height: 0; }

.sidebar .brand {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.35rem;
    font-weight: 600;
    color: #fff;
    padding: .4rem .8rem 1.1rem;
    display: block;
    text-decoration: none;
}
.sidebar .brand small { display: block; font-family: 'Jost'; font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }

.sidebar a.item {
    display: flex; align-items: center; gap: .65rem;
    color: #d9c8c3; padding: .58rem .8rem;
    border-radius: 10px; text-decoration: none; font-weight: 500; font-size: .95rem;
}
.sidebar a.item:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.item.active { background: var(--primary); color: #fff; }
.sidebar .spacer { flex: 1; }
.sidebar .public-link { font-size: .85rem; opacity: .8; }

.main { flex: 1; padding: 1.6rem 2rem 4rem; min-width: 0; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.4rem; gap: 1rem; flex-wrap: wrap;
}
.topbar h1 { margin: 0; }

@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; position: sticky; top: 0; z-index: 60;
               height: auto; overflow: visible; padding: .5rem .8rem; }
    .side-toggle { display: block; }
    .side-nav { display: none; padding-bottom: .6rem; max-height: calc(100vh - 60px); overflow-y: auto; }
    .sidebar.open .side-nav { display: flex; }
    .sidebar .brand { padding: .3rem .4rem; font-size: 1.15rem; }
    .sidebar .brand small { display: none; }
    .sidebar a.item { padding: .6rem .8rem; font-size: .95rem; }
    .sidebar .spacer { display: none; }
    .main { padding: 1rem .8rem 3rem; }
    .topbar h1 { font-size: 1.3rem; }
    .card { padding: 1rem 1rem; }
    .main .btn { padding: .55rem 1rem; }
}

/* nagyon kicsi kijelzők */
@media (max-width: 480px) {
    body { font-size: 15px; }
    .grid { gap: .7rem; }
    .stat .num { font-size: 1.6rem; }
    table.list { font-size: .84rem; }
    table.list td, table.list th { padding: .45rem .45rem; }
}

/* ---------- Kártyák, rácsok ---------- */

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.3rem 1.4rem;
    margin-bottom: 1.3rem;
}

.grid { display: grid; gap: 1.1rem; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.stat { text-align: center; padding: 1.1rem .8rem; }
.stat .num { font-size: 2rem; font-weight: 600; color: var(--primary); line-height: 1.1; }
.stat .lbl { font-size: .85rem; color: var(--muted); }

/* ---------- Gombok ---------- */

.btn {
    display: inline-block;
    padding: .55rem 1.25rem;
    border-radius: 999px;
    border: 0; cursor: pointer;
    font-family: inherit; font-size: .92rem; font-weight: 600;
    text-decoration: none !important;
    transition: background .15s;
    line-height: 1.4;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ok { background: var(--ok-bg); color: var(--ok); }
.btn-ok:hover { background: var(--ok); color: #fff; }
.btn-sm { padding: .3rem .8rem; font-size: .82rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Táblázatok ---------- */

.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.list th {
    text-align: left; font-size: .74rem; text-transform: uppercase;
    letter-spacing: .08em; color: var(--muted);
    padding: .5rem .7rem; border-bottom: 2px solid var(--line);
    white-space: nowrap;
}
table.list td { padding: .65rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:hover td { background: #fbf8f6; }
table.list .actions { white-space: nowrap; text-align: right; }

/* ---------- Badge-ek ---------- */

.badge {
    display: inline-block; padding: .18rem .65rem;
    border-radius: 999px; font-size: .76rem; font-weight: 600;
    white-space: nowrap;
}
.badge.confirmed { background: var(--ok-bg); color: var(--ok); }
.badge.pending { background: var(--warn-bg); color: var(--warn); }
.badge.done { background: #e8e6f5; color: #4b4494; }
.badge.noshow { background: #f0e5e3; color: #7a4a42; }
.badge.cancelled_client, .badge.cancelled_salon { background: var(--danger-bg); color: var(--danger); }
.badge.online { background: #e3f0f5; color: #22617a; }
.badge.admin { background: #efe9e2; color: #6d5a3f; }

/* ---------- Űrlapok ---------- */

label { display: block; font-weight: 600; font-size: .85rem; margin: .8rem 0 .25rem; }
input[type=text], input[type=password], input[type=email], input[type=tel],
input[type=number], input[type=date], input[type=time], input[type=color],
select, textarea {
    width: 100%; padding: .55rem .75rem;
    border: 1.5px solid var(--line); border-radius: 10px;
    font-family: inherit; font-size: .95rem; background: #fff; color: var(--dark);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(162, 99, 93, .3); border-color: var(--primary); }
input[type=color] { padding: .15rem; height: 42px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1rem; }
.inline-form { display: inline; }
.hint { font-size: .8rem; color: var(--muted); margin-top: .2rem; }

fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 1rem 0; padding: .8rem 1.1rem 1.1rem; }
legend { font-weight: 600; font-size: .9rem; padding: 0 .4rem; }

/* ---------- Flash üzenetek ---------- */

.flash { border-radius: 12px; padding: .75rem 1.1rem; margin-bottom: 1rem; font-size: .93rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfdcc2; }
.flash.error { background: var(--danger-bg); color: var(--danger); border: 1px solid #eec3bf; }
.flash.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #e8d29a; }

/* ---------- Naptár nézet ---------- */

.cal-controls { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.cal-controls .mon { font-weight: 600; min-width: 200px; text-align: center; }

.day-cal { display: grid; gap: 2px; background: var(--line); border-radius: 12px; overflow: hidden; }
.day-cal .col { background: #fff; min-width: 0; }
.day-cal .col-head {
    text-align: center; padding: .55rem .3rem; font-weight: 600;
    background: #fbf8f6; font-size: .88rem;
    border-bottom: 2px solid var(--line);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.day-cal .col-body { position: relative; }
.day-cal .hour-line {
    position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line);
    font-size: .68rem; color: var(--muted); padding-left: .25rem;
}
.day-cal .booking-block {
    position: absolute; left: 4px; right: 4px;
    border-radius: 8px; padding: .3rem .5rem;
    font-size: .78rem; line-height: 1.25;
    color: #fff; overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    text-decoration: none !important;
}
.day-cal .booking-block:hover { filter: brightness(1.08); }
.day-cal .booking-block .t { font-weight: 600; }
.day-cal .booking-block.pending { outline: 2px dashed rgba(255,255,255,.7); outline-offset: -3px; }
.day-cal .off-block {
    position: absolute; left: 0; right: 0;
    background: repeating-linear-gradient(45deg, #f1ebe8, #f1ebe8 8px, #e9e1dd 8px, #e9e1dd 16px);
}

.time-col { width: 46px; flex-shrink: 0; }
.cal-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mobile-hint { display: none; }
@media (max-width: 900px) { .mobile-hint { display: inline; } }

/* ---------- Dashboard timeline ---------- */

.tl-name { width: 180px; }
.tl-scale { margin-left: 190px; }
@media (max-width: 700px) {
    .tl-name { width: 118px; }
    .tl-name img { display: none; }
    .tl-scale { margin-left: 126px; }
}

/* ---------- Havi naptár ---------- */

.mcal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.mcal-dow {
    text-align: center; font-size: .74rem; font-weight: 600;
    color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
    padding: .3rem 0 .5rem;
}
.mcal-dow .long { display: inline; }
@media (max-width: 900px) { .mcal-dow .long { display: none; } }

.mcal-day {
    display: block; min-height: 108px;
    border: 1px solid var(--line); border-radius: 12px;
    padding: .4rem .5rem; background: #fff;
    text-decoration: none !important; color: inherit;
    transition: box-shadow .15s, transform .15s, border-color .15s;
}
.mcal-day:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--primary); }
.mcal-day.weekend { background: #fbf7f4; }
.mcal-day.past { opacity: .55; }
.mcal-day.today { outline: 2px solid var(--primary); outline-offset: -2px; background: #fdf3ef; }

.mcal-head { display: flex; align-items: center; gap: .35rem; margin-bottom: .25rem; }
.mcal-head .num { font-weight: 600; font-size: .95rem; }
.mcal-day.today .num { color: var(--primary); }
.mcal-head .ma-badge {
    font-size: .62rem; font-weight: 700; text-transform: uppercase;
    background: var(--primary); color: #fff; border-radius: 999px; padding: .05rem .45rem;
}
.mcal-head .cnt {
    margin-left: auto; font-size: .68rem; font-weight: 600;
    background: var(--line); border-radius: 999px; padding: .05rem .45rem; color: var(--dark);
}
.mcal-chip {
    font-size: .68rem; line-height: 1.35; margin-top: 2px;
    padding: 1px 6px; border-radius: 6px; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mcal-chip.pending { opacity: .65; border: 1px dashed #fff; }
.mcal-more { font-size: .68rem; color: var(--muted); margin-top: 2px; }
.mcal-empty { min-height: 20px; }

@media (max-width: 700px) {
    .mcal { gap: 3px; }
    .mcal-day { min-height: 64px; padding: .25rem .3rem; border-radius: 8px; }
    .mcal-chip { display: none; }
    .mcal-more { display: none; }
}

/* ---------- Login ---------- */

.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, #f7f4f2, #efe4e0);
    padding: 1rem;
}
.login-card {
    background: #fff; border-radius: 18px; box-shadow: 0 16px 60px rgba(50,34,32,.15);
    padding: 2.4rem 2.2rem; width: 100%; max-width: 380px;
}
.login-card h1 { font-family: 'Cormorant Garamond', serif; text-align: center; margin-bottom: 1.4rem; }
.login-card .btn { width: 100%; margin-top: 1.4rem; padding: .75rem; }

/* ---------- Egyéb ---------- */

.muted { color: var(--muted); }
.small { font-size: .84rem; }
.mt0 { margin-top: 0; }
.flex { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; vertical-align: middle; }
.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: .35rem; }
details.collapse { margin: .6rem 0; }
details.collapse summary { cursor: pointer; font-weight: 600; }

/* ============================================================
   DEMÓ: admin témaváltó – az alap "barna" paletta mellett
   választható "lilac" (lila-rózsaszín) színvilág.
   localStorage kulcs: pb_admin_theme
   ============================================================ */

:root[data-atheme="lilac"] {
    --primary: #8e5aa8;
    --primary-dark: #74478c;
    --accent: #d4699a;
    --bg: #f8f5fb;
    --card: #ffffff;
    --dark: #3a2c44;
    --muted: #8a7d99;
    --line: #e8e0f0;
    --shadow: 0 4px 20px rgba(58, 44, 68, .08);
}

:root[data-atheme="lilac"] .sidebar { background: #2b2138; }
:root[data-atheme="lilac"] .sidebar a.item { color: #c8b8da; }
:root[data-atheme="lilac"] .sidebar a.item:hover { color: #fff; }
:root[data-atheme="lilac"] .sidebar a.item.active { color: #fff; }
:root[data-atheme="lilac"] .sidebar a.item.secondary { color: #a893c0; }
:root[data-atheme="lilac"] .sidebar a.item.secondary:hover,
:root[data-atheme="lilac"] .sidebar a.item.secondary.active { color: #fff; }

/* témaváltó gomb a menü TETEJÉN */
.atheme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 .8rem .6rem;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    color: inherit;
    align-self: flex-start;
}
.atheme-toggle .lbl { font-size: .72rem; letter-spacing: .06em; opacity: .7; font-family: inherit; }
.atheme-toggle .sw {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .45);
    opacity: .5;
    transition: opacity .15s, transform .15s;
}
.atheme-toggle .sw-brown { background: #a2635d; }
.atheme-toggle .sw-lilac { background: #8e5aa8; }
:root:not([data-atheme="lilac"]) .atheme-toggle .sw-brown,
:root[data-atheme="lilac"] .atheme-toggle .sw-lilac {
    opacity: 1;
    transform: scale(1.15);
    border-color: #fff;
}
