/* ==========================================================
   קול־נט — ספריית העיצוב המשותפת
   כל המסכים בתוכנה משתמשים בקובץ הזה בלבד.
   שינוי צבע כאן משנה את כל המערכת.
   ========================================================== */

:root {
    --primary-color: #0A0F2D;
    --primary-soft: #16204d;
    --accent-color: #C6A94A;
    --accent-dark: #b39843;
    --accent-soft: #f6f0dc;
    --light-gray: #f5f5f5;
    --white: #ffffff;
    --text: #1f2430;
    --muted: #6b7280;
    --line: #e4e6ec;
    --danger: #dc3545;
    --success: #28a745;
    --warning: #f0ad4e;
    --radius: 8px;
    --shadow: 0 2px 4px rgba(10, 15, 45, 0.1);
    --shadow-lift: 0 6px 14px rgba(10, 15, 45, 0.16);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0 0 46px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-gray);
    color: var(--text);
    direction: rtl;
    font-size: 15px;
}

h1, h2, h3, h4 {
    margin: 0;
    color: var(--primary-color);
}

a {
    color: var(--primary-color);
}

/* ===================== כותרת עליונה ===================== */

.header {
    background: var(--primary-color);
    padding: 0.9rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    flex-wrap: wrap;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
}

.header-logo {
    height: 40px;
    width: auto;
}

.header-brand b {
    display: block;
    color: var(--white);
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.header-brand span {
    display: block;
    color: var(--accent-color);
    font-size: 0.78rem;
}

.header-side {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--white);
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.header-user {
    color: #cfd3e4;
}

.header-user b {
    color: var(--white);
}

/* התאריך העברי של היום, מוצג בכל מסך */
.header-date {
    color: var(--accent-color);
    background: rgba(198, 169, 74, 0.12);
    border: 1px solid rgba(198, 169, 74, 0.35);
    border-radius: 999px;
    padding: 0.32rem 0.8rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

.hebrew-date {
    display: block;
    color: var(--accent-dark);
    font-size: 0.82rem;
    margin-top: 0.15rem;
}

/* ===================== תוכן הדף ===================== */

.page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

.page-head h1 {
    font-size: 1.6rem;
}

.page-head p {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.page-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.2rem;
}

.card > h2 {
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
}

.card > h2 + p {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
}

.card-head h2 {
    font-size: 1.15rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.2rem;
    align-items: start;
}

/* ===================== תפריט דף הבית ===================== */

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.2rem;
}

.menu-item {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.6rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
}

.menu-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lift);
    border-color: var(--accent-color);
}

.menu-item i {
    font-size: 2.3rem;
    color: var(--accent-color);
    margin-bottom: 0.9rem;
}

.menu-item h3 {
    font-size: 1.1rem;
}

.menu-item p {
    margin: 0.4rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

/* ===================== כפתורים ===================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: var(--white);
    border: 1px solid var(--primary-color);
    padding: 0.62rem 1.1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.btn:hover {
    background: var(--primary-soft);
}

.btn-gold {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--white);
}

.btn-gold:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

.btn-outline {
    background: transparent;
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-outline:hover {
    background: var(--accent-color);
    color: var(--white);
}

.btn-quiet {
    background: var(--white);
    color: var(--primary-color);
    border-color: var(--line);
}

.btn-quiet:hover {
    background: var(--light-gray);
    border-color: var(--accent-color);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #bd2130;
    border-color: #bd2130;
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.btn-success:hover {
    background: #1e7e34;
    border-color: #1e7e34;
}

.btn-big {
    padding: 0.95rem 1.4rem;
    font-size: 1.08rem;
    width: 100%;
}

.btn-small {
    padding: 0.38rem 0.7rem;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ===================== טפסים ===================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
}

.field.full {
    grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text);
    padding: 0.65rem 0.75rem;
    border: 1px solid #d7d9e2;
    border-radius: 6px;
    background: var(--white);
    transition: border-color 0.2s;
    width: 100%;
}

.field textarea {
    min-height: 110px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.field small {
    font-weight: 400;
    color: var(--muted);
    font-size: 0.8rem;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    font-weight: 400;
    color: var(--text);
    padding: 0.4rem 0;
    cursor: pointer;
}

.check input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color);
}

.form-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* מקטע מתקפל לשדות שרוב הזמן אין בהם צורך */
.more {
    margin-top: 1rem;
    border-top: 1px solid var(--line);
    padding-top: 0.9rem;
}

.more > summary {
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted);
    list-style: none;
}

.more > summary::-webkit-details-marker {
    display: none;
}

.more > summary::before {
    content: "";
    display: inline-block;
    margin-left: 0.5rem;
    border: 5px solid transparent;
    border-top-color: currentColor;
    transform: translateY(2px);
    transition: transform 0.15s;
}

.more[open] > summary::before {
    transform: translateY(-2px) rotate(180deg);
}

.more > summary:hover {
    color: var(--accent-color);
}

.more .form-grid {
    margin-top: 1rem;
}

/* ===================== טבלאות ===================== */

.table-wrap {
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

table.data th,
table.data td {
    text-align: right;
    padding: 0.7rem 0.6rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

table.data th {
    background: #fafafc;
    color: var(--primary-color);
    font-size: 0.85rem;
    white-space: nowrap;
}

table.data tbody tr:hover {
    background: #fcfbf6;
}

table.data td.actions {
    white-space: nowrap;
}

table.data td.num {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* ===================== חיווי ומצבים ===================== */

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    background: #eef0f6;
    color: var(--primary-color);
}

.badge-open {
    background: #e4f5e8;
    color: #1e7e34;
}

.badge-closed {
    background: #fdeaea;
    color: #a71d2a;
}

.badge-draft {
    background: var(--accent-soft);
    color: #8a7325;
}

.alert {
    border-radius: 6px;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border-right: 4px solid var(--accent-color);
    background: var(--accent-soft);
    color: #7a6520;
}

.alert-error {
    border-right-color: var(--danger);
    background: #fdeaea;
    color: #a71d2a;
}

.alert-ok {
    border-right-color: var(--success);
    background: #e4f5e8;
    color: #1e7e34;
}

.empty {
    text-align: center;
    padding: 2.2rem 1rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.empty i {
    display: block;
    font-size: 2rem;
    color: #c9ccd8;
    margin-bottom: 0.7rem;
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.2rem;
}

.stat {
    background: var(--white);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--accent-color);
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
}

.stat b {
    font-size: 1.55rem;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
    word-break: break-word;
}

/* מדד שהערך שלו טקסט ולא מספר — למשל שם אירוע או תאריך עברי */
.stat.text b {
    font-size: 1.05rem;
}

/* ===================== שורת בחירת אירוע ===================== */

.context-bar {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.9rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
    border-right: 4px solid var(--accent-color);
}

.context-bar label {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.context-bar select {
    font-family: inherit;
    font-size: 1rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid #d7d9e2;
    border-radius: 6px;
    min-width: 260px;
    background: var(--white);
}

.context-bar select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.context-bar .spacer {
    flex: 1;
}

/* ===================== מסך ההצבעה (שני טורים) ===================== */

.workspace {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.2rem;
    align-items: start;
}

.pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.9rem;
}

.pick {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 0.8rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: center;
}

.pick:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-lift);
}

.pick .pick-num {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.pick .pick-name {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
    line-height: 1.3;
}

.pick .pick-count {
    color: var(--muted);
    font-size: 0.82rem;
}

.side-panel {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem;
    position: sticky;
    top: 1rem;
}

.side-panel h2 {
    font-size: 1.1rem;
    margin-bottom: 0.9rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--line);
}

.tally {
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.tally-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.92rem;
}

.tally-row:last-child {
    border-bottom: none;
}

.tally-row b {
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
}

.total-line {
    background: var(--primary-color);
    color: var(--white);
    border-radius: 6px;
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.05rem;
    margin-bottom: 0.9rem;
}

.total-line b {
    color: var(--accent-color);
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
}

/* ===================== תוצאות ===================== */

.result-row {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.75rem;
    border-right: 4px solid var(--line);
}

.result-row.winner {
    border-right-color: var(--accent-color);
    background: linear-gradient(90deg, var(--accent-soft), var(--white) 60%);
}

.result-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.55rem;
    flex-wrap: wrap;
}

.result-name {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-name .place {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--accent-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.result-value {
    font-variant-numeric: tabular-nums;
    color: var(--primary-color);
    font-weight: 700;
}

.result-value small {
    color: var(--muted);
    font-weight: 400;
    margin-right: 0.4rem;
}

.bar {
    height: 12px;
    background: #eceef4;
    border-radius: 999px;
    overflow: hidden;
}

.bar > div {
    height: 100%;
    background: var(--accent-color);
    border-radius: 999px;
    transition: width 0.4s;
}

.result-row.winner .bar > div {
    background: var(--primary-color);
}

/* ===================== חלונית ===================== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 45, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 500;
}

.modal.open {
    display: flex;
}

.modal-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.4rem;
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

.modal-box h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

/* ===================== הודעה צפה ===================== */

.toast {
    position: fixed;
    bottom: 62px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--primary-color);
    color: var(--white);
    padding: 0.8rem 1.4rem;
    border-radius: 999px;
    border: 1px solid var(--accent-color);
    font-size: 0.95rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 900;
    max-width: 90vw;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    background: var(--danger);
    border-color: #ff9aa2;
}

/* ===================== כותרת תחתונה ===================== */

.credit {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    background: rgba(10, 15, 45, 0.96);
    color: var(--accent-color);
    padding: 8px;
    text-align: center;
    font-size: 11px;
    font-weight: bold;
    z-index: 400;
    border-top: 2px solid var(--accent-color);
}

/* ===================== התאמה למסכים קטנים ===================== */

@media (max-width: 980px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .side-panel {
        position: static;
    }
}

@media (max-width: 640px) {
    .page {
        padding: 1rem;
    }

    .header {
        padding: 0.8rem 1rem;
    }

    .menu-grid {
        grid-template-columns: 1fr;
    }

    .context-bar select {
        min-width: 100%;
    }

    .page-head h1 {
        font-size: 1.35rem;
    }
}

@media print {
    .header, .credit, .page-actions, .context-bar, .no-print {
        display: none !important;
    }

    body {
        background: var(--white);
        padding: 0;
    }

    .card, .result-row {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
