/* ==========================================================================
   החוניטה של הפאדל — עיצוב כהה ספורטיבי, mobile-first, RTL
   ========================================================================== */

:root {
    --bg:        #0A0F0D;
    --surface:   #141B18;
    --surface-2: #1B2420;
    --border:    #26332C;
    --lime:      #B4FF39;
    --lime-dim:  #7FBF20;
    --text:      #F2F5F3;
    --muted:     #8A9691;
    --yellow:    #F5C518;
    --star:      #FFC83D;
    --blue:      #4EA8FF;
    --red:       #FF5C5C;

    --radius:    16px;
    --radius-sm: 10px;
    --tap:       44px;

    --safe-top:    env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --tabbar-h:    62px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Assistant, Rubik, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 700; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p  { margin: 0 0 .75rem; }

a { color: var(--lime); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }

/* ---------- כותרת עליונה ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: calc(.7rem + var(--safe-top)) 1rem .7rem;
    background: rgba(10, 15, 13, .92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar__brand { display: flex; align-items: center; gap: .5rem; color: var(--text); min-width: 0; }
.topbar__ball  { font-size: 1.25rem; }
.topbar__name  { font-weight: 700; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; }
.usermenu summary::-webkit-details-marker { display: none; }

.usermenu__panel {
    position: absolute;
    /* התפריט יושב בקצה השמאלי של הכותרת ב-RTL, ולכן נפתח פנימה ולא החוצה */
    inset-inline-end: 0;
    top: calc(100% + .5rem);
    min-width: 200px;
    max-width: calc(100vw - 2rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .5rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
    z-index: 60;
}
.usermenu__panel a,
.usermenu__panel .linklike {
    display: block;
    width: 100%;
    padding: .6rem .5rem;
    color: var(--text);
    border-radius: 8px;
    text-align: start;
    font-size: .95rem;
}
.usermenu__panel a:hover,
.usermenu__panel .linklike:hover { background: var(--surface-2); }
.usermenu__who { padding: .4rem .5rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .35rem; }
.usermenu__who span { display: block; font-size: .8rem; }

.linklike {
    background: none;
    border: 0;
    font: inherit;
    color: var(--text);
    cursor: pointer;
}
.linklike.danger { color: var(--red); }

/* ---------- פריסה ---------- */

.content {
    padding: 1rem;
    padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 1.5rem);
    max-width: 640px;
    margin: 0 auto;
}

/* ---------- טאב־בר תחתון ---------- */

.tabbar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    background: rgba(10, 15, 13, .95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: var(--tabbar-h);
    color: var(--muted);
    font-size: .72rem;
}
.tab__icon { font-size: 1.2rem; line-height: 1; }
.tab.is-active { color: var(--lime); }
.tab.is-active .tab__icon { transform: translateY(-1px); }

/* ---------- הודעות מערכת ---------- */

.flashes { max-width: 640px; margin: .75rem auto 0; padding: 0 1rem; }
.flash {
    padding: .7rem .9rem;
    border-radius: var(--radius-sm);
    margin-bottom: .5rem;
    font-size: .92rem;
    border: 1px solid var(--border);
    background: var(--surface);
}
.flash--success { border-color: rgba(180, 255, 57, .4); background: rgba(180, 255, 57, .1); }
.flash--error   { border-color: rgba(255, 92, 92, .45); background: rgba(255, 92, 92, .12); }
.flash--info    { border-color: rgba(78, 168, 255, .4); background: rgba(78, 168, 255, .1); }

/* ---------- כרטיס "היום הכי טוב" ---------- */

.hero {
    background: linear-gradient(160deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
    margin-bottom: 1rem;
    text-align: center;
}
.hero--ready  { border-color: rgba(180, 255, 57, .45); box-shadow: 0 0 0 1px rgba(180, 255, 57, .08), 0 10px 30px rgba(180, 255, 57, .06); }
.hero--almost { border-color: rgba(245, 197, 24, .4); }
.hero--empty  { border-style: dashed; }

.hero__title { font-weight: 700; font-size: .95rem; color: var(--muted); margin-bottom: .5rem; }
.hero--ready .hero__title { color: var(--lime); }
.hero__sub   { color: var(--muted); font-size: .9rem; margin: 0; }

.hero__when { display: block; color: var(--text); margin-bottom: .75rem; }
.hero__date { display: block; font-size: 1.15rem; font-weight: 700; }
.hero__time { display: block; font-size: 2.4rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.hero--ready .hero__time { color: var(--lime); }

.hero__count { display: flex; align-items: center; justify-content: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .6rem; }
.hero__countText { font-size: .9rem; color: var(--muted); margin-inline-start: .3rem; }
.hero__names { display: flex; justify-content: center; flex-wrap: wrap; gap: .35rem; margin-bottom: .9rem; }
.hero__actions { display: flex; flex-direction: column; gap: .5rem; }

/* ---------- נקודות שחקנים ---------- */

.dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--border);
    display: inline-block;
    flex: none;
}
.dot--lg    { width: 12px; height: 12px; }
.dot--yes   { background: var(--lime); }
.dot--maybe { background: var(--yellow); }

/* ---------- שורת כוכבים ---------- */

.starbar {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .6rem .8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .84rem;
    margin-bottom: .9rem;
}

/* ---------- אקורדיון ימים ---------- */

.day {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .6rem;
    overflow: hidden;
}
.day--best { border-color: rgba(180, 255, 57, .35); }

.day__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .85rem 1rem;
    cursor: pointer;
    list-style: none;
    min-height: var(--tap);
    font-weight: 600;
}
.day__head::-webkit-details-marker { display: none; }
.day__head::after {
    content: '▾';
    color: var(--muted);
    font-size: .8rem;
    transition: transform .15s ease;
}
.day[open] .day__head::after { transform: rotate(180deg); }

.day__name { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.day__meta { color: var(--muted); font-size: .85rem; margin-inline-start: auto; margin-inline-end: .5rem; }
.day__meta b { color: var(--lime); }
.day__slots { border-top: 1px solid var(--border); }

.pill {
    font-size: .7rem;
    padding: .12rem .45rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-weight: 600;
}
.pill--locked { color: var(--blue); border-color: rgba(78, 168, 255, .4); }
.pill--best   { color: var(--lime); border-color: rgba(180, 255, 57, .4); }

/* ---------- שורת משבצת ---------- */

.slot {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem .8rem;
    border-bottom: 1px solid var(--border);
    transition: opacity .15s ease;
}
.slot:last-child { border-bottom: 0; }
.slot.is-busy { opacity: .5; pointer-events: none; }

.slot--blocked, .slot--past { opacity: .45; }
.slot--locked { background: rgba(78, 168, 255, .07); }
.slot--ready  { background: rgba(180, 255, 57, .05); }

.slot__main { flex: 1; min-width: 0; color: var(--text); display: block; }
.slot__head { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.slot__time { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.slot__label { font-size: .8rem; color: var(--muted); }
.slot--ready  .slot__label { color: var(--lime); }
.slot--almost .slot__label { color: var(--yellow); }
.slot--locked .slot__label { color: var(--blue); }

.slot__dots { display: flex; gap: 4px; margin: .35rem 0; }
.slot__people { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.slot__court { font-size: .78rem; color: var(--muted); margin-inline-start: .3rem; }
.slot__note { font-size: .78rem; color: var(--yellow); margin-top: .3rem; }

.maybe-wrap   { opacity: .65; }
.reserve-wrap { opacity: .45; }

/* ---------- בורר הזמינות ---------- */

.picker { display: flex; gap: 4px; flex: none; }
.picker--locked { align-items: center; padding-inline: .5rem; }
.lockmark { font-size: 1.2rem; }

.pick {
    width: 38px;
    min-height: var(--tap);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .1s ease, background .15s ease, color .15s ease, border-color .15s ease;
    -webkit-tap-highlight-color: transparent;
}
.pick:active { transform: scale(.92); }
.pick:disabled { opacity: .3; cursor: default; }

.pick--yes.is-on   { background: var(--lime);   color: #0A0F0D; border-color: var(--lime); }
.pick--maybe.is-on { background: var(--yellow); color: #0A0F0D; border-color: var(--yellow); }
.pick--none.is-on  { background: var(--border); color: var(--text); }
.pick--star        { color: var(--muted); }
.pick--star.is-on  { background: var(--star); color: #0A0F0D; border-color: var(--star); }

/* ---------- אווטאר ---------- */

.avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--avatar-color) 22%, transparent);
    border: 1.5px solid var(--avatar-color);
    color: var(--avatar-color);
    font-size: .74rem;
    font-weight: 700;
    flex: none;
    line-height: 1;
}
.avatar--sm { width: 26px; height: 26px; font-size: .62rem; border-width: 1px; }

.avatar__star {
    position: absolute;
    top: -4px;
    inset-inline-end: -3px;
    font-size: .6rem;
    color: var(--star);
    font-style: normal;
    text-shadow: 0 0 3px #0A0F0D, 0 0 3px #0A0F0D;
}

/* ---------- כפתורים ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: var(--tap);
    padding: .6rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    transition: transform .1s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--lime); border-color: var(--lime); color: #0A0F0D; }
.btn--danger  { background: transparent; border-color: rgba(255, 92, 92, .5); color: var(--red); }
.btn--ghost   { background: transparent; }
.btn--block   { width: 100%; }
.btn--sm      { min-height: 36px; padding: .35rem .7rem; font-size: .85rem; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.btnrow { display: flex; gap: .5rem; flex-wrap: wrap; }
.btnrow--stack { flex-direction: column; }

/* ---------- כרטיסים וטפסים ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: .9rem;
}
.card__title { font-weight: 700; margin-bottom: .6rem; display: flex; align-items: center; gap: .4rem; }

.field { margin-bottom: .85rem; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }

.input, select.input, textarea.input {
    width: 100%;
    min-height: var(--tap);
    padding: .6rem .8rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
}
.input:focus { outline: 2px solid var(--lime); outline-offset: 1px; }
.input--pin { letter-spacing: .5em; text-align: center; font-size: 1.4rem; font-weight: 700; }
textarea.input { min-height: 76px; resize: vertical; }

.checkline {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .3rem;
    border-bottom: 1px solid var(--border);
    min-height: var(--tap);
}
.checkline:last-child { border-bottom: 0; }
.checkline input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--lime); flex: none; }
.checkline__name { flex: 1; min-width: 0; }
.checkline__tag { font-size: .72rem; color: var(--muted); }

/* ---------- גריד משבצות קבועות ---------- */

.tplgrid { width: 100%; border-collapse: collapse; font-size: .85rem; }
.tplgrid th, .tplgrid td { padding: .45rem .2rem; text-align: center; border-bottom: 1px solid var(--border); }
.tplgrid th { color: var(--muted); font-weight: 600; }
.tplgrid input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--lime); }

/* ---------- רשימות ---------- */

.list { list-style: none; margin: 0; padding: 0; }
.list li {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem .2rem;
    border-bottom: 1px solid var(--border);
}
.list li:last-child { border-bottom: 0; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 600; }
.list__sub { font-size: .8rem; color: var(--muted); }

.empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.board-foot { margin-top: 1rem; }

/* ---------- מסך משבצת ---------- */

.slotpage__when { text-align: center; margin-bottom: 1rem; }
.slotpage__date { font-size: 1.1rem; font-weight: 700; }
.slotpage__time { font-size: 2.6rem; font-weight: 800; line-height: 1.1; color: var(--lime); }
.slotpage__meta { color: var(--muted); font-size: .88rem; }

.peoplegroup { margin-bottom: 1rem; }
.peoplegroup__title { font-size: .85rem; color: var(--muted); margin-bottom: .45rem; }
.peoplerow { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; }
.peoplerow__name { flex: 1; }
.peoplerow__tag { font-size: .72rem; color: var(--muted); }

.selfpicker { display: flex; gap: .5rem; justify-content: center; margin: 1rem 0; }
.selfpicker .pick { width: 56px; min-height: 52px; font-size: 1.15rem; }

/* ---------- מסכי אימות ---------- */

.authbody { display: flex; min-height: 100dvh; }
.authwrap {
    margin: auto;
    width: 100%;
    max-width: 420px;
    padding: calc(1.5rem + var(--safe-top)) 1.25rem calc(1.5rem + var(--safe-bottom));
}
.authlogo { text-align: center; margin-bottom: 1.25rem; }
.authlogo__ball { font-size: 3rem; line-height: 1; }
.authlogo h1 { margin: .4rem 0 .15rem; }
.authlogo p { margin: 0; font-size: .9rem; }
.authalt { text-align: center; margin-top: .9rem; font-size: .9rem; }

/* ---------- טוסט ---------- */

.toast {
    position: fixed;
    inset-inline: 1rem;
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 1rem);
    z-index: 200;
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    text-align: center;
    font-size: .9rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    max-width: 480px;
    margin: 0 auto;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast--error   { border-color: rgba(255, 92, 92, .55); }
.toast--success { border-color: rgba(180, 255, 57, .5); }

/* ---------- נגישות ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

/* ---------- מסכים רחבים ---------- */

@media (min-width: 720px) {
    .hero__actions { flex-direction: row; justify-content: center; }
    .hero__actions .btn { flex: 0 1 auto; }
}
