/*
 * Bira Nekuda — Shift Management Styles
 * ======================================
 * Mobile-first, RTL Hebrew, Heebo font.
 * Color system: deep purple primary, clean neutrals.
 */

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

/* ── Variables ────────────────────────────────────────── */
:root {
    --bg:            #f5f4f0;
    --surface:       #ffffff;
    --primary:       #2d2b55;
    --primary-light: #eae7ff;
    --primary-dark:  #1e1c3f;
    --text:          #1a1a2e;
    --text2:         #6b6880;
    --border:        #e2dff0;
    --green:         #1a9d5c;
    --green-bg:      #e6f7ee;
    --red:           #d93652;
    --red-bg:        #fdedf0;
    --amber:         #c88a12;
    --amber-bg:      #fef6e0;
    --blue:          #2b6fd4;
    --blue-bg:       #e8f0fb;
    --radius:        18px;
    --radius-sm:     12px;
    --shadow:        0 4px 20px rgba(45,43,85,.08);
    --shadow-lg:     0 12px 40px rgba(45,43,85,.14);
}

/* ── Base ─────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Heebo', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── App container ────────────────────────────────────── */
#app {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 14px 100px;
}

/* ── Header ───────────────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    margin: 0 -14px;
    padding: 14px 14px 12px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.header-logo   { height: 42px; width: auto; }
.header-sub    { font-size: 12px; font-weight: 800; color: var(--text2); margin-top: 2px; }
.header-right  { display: flex; align-items: center; gap: 8px; }
.user-name     { font-size: 13px; font-weight: 700; color: var(--text2); }

/* ── Bottom navigation ────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    padding: 0 0 env(safe-area-inset-bottom, 0);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px 8px;
    background: none;
    border: none;
    color: var(--text2);
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    position: relative;
    transition: color .15s;
}

.nav-item.active { color: var(--primary); font-weight: 900; }

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 4px 4px;
}

.nav-icon { font-size: 20px; margin-bottom: 2px; }
.hidden   { display: none !important; }

/* ── Cards ────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 0;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

/* ── Buttons ──────────────────────────────────────────── */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 999px;
    padding: 12px 20px;
    font-family: inherit;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    transition: all .15s;
    min-height: 46px;
    background: var(--primary-light);
    color: var(--primary);
}

button:active   { transform: scale(.97); }
button:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(45,43,85,.22); }
.btn-primary:active { background: var(--primary-dark); }
.btn-green   { background: var(--green-bg); color: var(--green); border: 1px solid rgba(26,157,92,.2); }
.btn-red     { background: var(--red-bg); color: var(--red); border: 1px solid rgba(217,54,82,.2); }
.btn-ghost   { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-sm      { padding: 8px 14px; font-size: 13px; min-height: 36px; }
.btn-block   { width: 100%; }

/* ── Forms ────────────────────────────────────────────── */
input, select {
    width: 100%;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 12px 14px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    min-height: 48px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45,43,85,.1);
}

label {
    display: block;
    font-weight: 800;
    font-size: 14px;
    color: var(--text2);
    margin: 12px 0 6px;
}

.form-group { margin-bottom: 4px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ltr        { direction: ltr; text-align: left; }

/* ── Pills / badges ───────────────────────────────────── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 900;
}

.pill-green { color: var(--green); background: var(--green-bg); }
.pill-red   { color: var(--red);   background: var(--red-bg);   }
.pill-blue  { color: var(--blue);  background: var(--blue-bg);  }
.pill-amber { color: var(--amber); background: var(--amber-bg); }
.pill-muted { color: var(--text2); background: #f0eff5; }

/* ── Section titles ───────────────────────────────────── */
.section-title {
    font-size: 22px;
    font-weight: 900;
    color: var(--primary);
    margin: 0;
    letter-spacing: -.01em;
}

.section-sub {
    font-size: 13px;
    color: var(--text2);
    font-weight: 600;
    margin-top: 2px;
}

/* ── Day headers ──────────────────────────────────────── */
.day-header {
    font-size: 17px;
    font-weight: 900;
    color: var(--primary);
    margin: 20px 0 8px;
    padding-right: 10px;
    border-right: 4px solid var(--primary);
}

/* ── Shift cards ──────────────────────────────────────── */
.shift {
    border: 1.5px solid var(--border);
    background: #fff;
    border-radius: var(--radius);
    padding: 14px;
    margin: 8px 0;
    transition: all .15s;
}

.shift.selectable        { cursor: pointer; }
.shift.selectable:active { transform: scale(.98); }

.shift.selected {
    border-color: var(--primary);
    background: #fbfaff;
    box-shadow: 0 0 0 3px rgba(45,43,85,.1), var(--shadow);
}

.shift.status-approved { border-color: rgba(26,157,92,.3); background: #fafff8; }
.shift.status-pending  { border-color: rgba(43,111,212,.3); background: #f8faff; }
.shift.status-denied   { border-color: rgba(217,54,82,.2);  background: #fffafa; opacity: .7; }
.shift.full            { opacity: .6; }

.shift-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.shift-label { font-weight: 900; font-size: 16px; color: var(--text); }
.shift-meta  { font-size: 13px; color: var(--text2); margin-top: 3px; font-weight: 600; }
.shift-pills { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Workers ──────────────────────────────────────────── */
.workers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.worker {
    background: var(--primary-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-weight: 800;
    font-size: 13px;
    color: var(--primary);
}

.worker.empty {
    border: 1.5px dashed var(--red);
    color: var(--red);
    background: var(--red-bg);
}

/* ── Role sections ────────────────────────────────────── */
.role-section { margin: 16px 0; }

.role-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--primary);
    padding: 10px 14px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

/* ── Auth page ────────────────────────────────────────── */
.auth-wrapper { max-width: 420px; margin: 40px auto 0; }

.auth-logo {
    display: block;
    width: 180px;
    max-width: 50vw;
    margin: 0 auto 16px;
}

.auth-title {
    text-align: center;
    font-size: 20px;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 4px;
}

.auth-sub {
    text-align: center;
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 20px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 16px;
    background: #f0eff5;
    border-radius: 999px;
    padding: 4px;
}

.auth-tab {
    border-radius: 999px;
    padding: 10px;
    font-size: 15px;
    min-height: 42px;
    background: transparent;
    color: var(--text2);
}

.auth-tab.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* ── Week picker bar ──────────────────────────────────── */
.week-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.week-bar input[type="date"] {
    max-width: 180px;
    font-size: 15px;
    min-height: 42px;
    padding: 8px 12px;
}

.week-label {
    font-size: 14px;
    font-weight: 800;
    color: var(--text2);
}

/* ── Approval cards ───────────────────────────────────── */
.approval-card {
    border: 1.5px solid var(--border);
    background: #fff;
    border-radius: var(--radius);
    padding: 14px;
    margin: 8px 0;
}

.approval-card.pending  { border-right: 5px solid var(--blue);  }
.approval-card.approved { border-right: 5px solid var(--green); }
.approval-card.denied   { border-right: 5px solid var(--red); opacity: .6; }

.approval-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.approval-name   { font-weight: 900; font-size: 16px; }
.approval-detail { font-size: 13px; color: var(--text2); font-weight: 600; margin-top: 3px; }

.approval-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    align-items: center;
}

.override-label {
    font-size: 12px;
    color: var(--text2);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

.override-label input { width: auto; min-height: auto; margin: 0; }

/* ── Editor cards ─────────────────────────────────────── */
.editor-card {
    border: 1.5px solid var(--border);
    background: #fff;
    border-radius: var(--radius);
    padding: 14px;
    margin: 8px 0;
}

.editor-card.inactive { opacity: .5; }

/* ── Employee list ────────────────────────────────────── */
.emp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}

.emp-row:last-child { border-bottom: none; }
.emp-info    { flex: 1; }
.emp-name    { font-weight: 800; font-size: 15px; }
.emp-detail  { font-size: 12px; color: var(--text2); font-weight: 600; }

/* ── Sticky submit footer ─────────────────────────────── */
.sticky-footer {
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    padding: 12px 14px env(safe-area-inset-bottom, 12px);
    background: linear-gradient(0deg, var(--bg) 60%, transparent);
    z-index: 40;
}

.sticky-footer .btn-primary {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
}

/* ── Toast ────────────────────────────────────────────── */
.toast {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: 80px;
    z-index: 200;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-lg);
    font-weight: 800;
    font-size: 15px;
    text-align: center;
    color: var(--primary);
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all .25s;
}

.toast.show   { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast.error  { border-color: rgba(217,54,82,.4); color: var(--red); }
.toast.success { border-color: rgba(26,157,92,.4); color: var(--green); }

/* ── Utilities ────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--text2); }
.mt-8  { margin-top: 8px;  }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8  { margin-bottom: 8px; }

hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Desktop enhancements ─────────────────────────────── */
@media (min-width: 768px) {
    #app           { padding: 0 20px 100px; }
    .auth-wrapper  { margin-top: 60px; }
    .header-logo   { height: 52px; }
    .schedule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

    .bottom-nav {
        max-width: 720px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius) var(--radius) 0 0;
        border: 1px solid var(--border);
        border-bottom: none;
    }
}

/* ── Calendar grid (apply page) ─────────────────────── */
.cal-grid {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin: 12px 0;
}

.cal-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.cal-row:last-child { border-bottom: none; }

.cal-day {
    font-size: 13px;
    font-weight: 900;
    color: var(--primary);
    min-width: 52px;
    padding-top: 8px;
}

.cal-shifts {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    flex: 1;
}

.cal-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 10px;
    padding: 7px 11px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    min-height: 36px;
    border: 1.5px solid transparent;
    transition: all .15s;
    background: var(--primary-light);
    color: var(--primary);
}

.cal-chip.role-bar { background: var(--blue-bg); color: var(--blue); }
.cal-chip.role-kit { background: var(--green-bg); color: var(--green); }

.cal-chip.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 3px 10px rgba(45,43,85,.25);
}

.cal-chip.status-pending  { border-color: var(--blue); }
.cal-chip.status-approved { border-color: var(--green); opacity: .7; }
.cal-chip.status-denied   { opacity: .4; }
.cal-chip.locked          { cursor: not-allowed; }
.cal-chip:active:not(.locked) { transform: scale(.96); }

.chip-role {
    font-size: 10px;
    font-weight: 900;
    opacity: .7;
    background: rgba(255,255,255,.35);
    border-radius: 6px;
    padding: 1px 4px;
}

.chip-status {
    font-size: 10px;
    font-weight: 900;
    opacity: .8;
}

.chip-status.approved { color: var(--green); }

/* ── Constraints modal ─────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 500;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 0 env(safe-area-inset-bottom, 0);
}

.modal-box {
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 24px 18px 28px;
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-title {
    font-size: 20px;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 4px;
}

.modal-sub {
    font-size: 13px;
    color: var(--text2);
    font-weight: 600;
    margin-bottom: 16px;
}

.constraint-day {
    margin: 12px 0;
}

.constraint-day-label {
    font-size: 14px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 5px;
}

.constraint-note {
    font-size: 12px;
    font-weight: 700;
    color: var(--amber);
    background: var(--amber-bg);
    border-radius: 8px;
    padding: 5px 9px;
    margin-top: 5px;
    display: inline-block;
}
