/* =========================================================================
   Staff Scheduling: net-new styles only.
   Design tokens, buttons, modals, inputs, tables, toasts come from
   /milltownprep/portal.css. This file adds the single-month bar calendar, the
   shift bars + tooltip + context menu, the requests inbox, the color swatches,
   and the pay-period panel.
   ========================================================================= */

.staff-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Header pill that shows the employee's approved-hours total. */
.hours-pill {
    background: var(--accent-soft);
    border: 1px solid rgba(204, 122, 0, 0.35);
    color: var(--accent);
    border-radius: 999px;
    padding: 0.4rem 0.95rem;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

.staff-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.staff-toolbar h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.4rem;
    line-height: 1.2;
}

.staff-toolbar-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* =========================================================================
   Month navigation
   ========================================================================= */

.cal-nav {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.cal-nav h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.4rem;
    line-height: 1.2;
    min-width: 210px;
    text-align: center;
}

.cal-nav-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.cal-nav-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }

/* =========================================================================
   Single-month bar calendar
   ========================================================================= */

.cal { overflow-x: auto; }

.cal-weekdays,
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    min-width: 760px;
}

.cal-weekdays {
    margin-bottom: 6px;
}

.cal-weekdays span {
    text-align: center;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    padding: 0.25rem 0;
}

.cal-day {
    position: relative;
    min-height: 118px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.35rem 0.35rem 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    overflow: hidden;
    transition: border-color 0.12s ease, background 0.12s ease;
}

.cal-day.is-expanded { overflow: visible; }
.cal-day.is-out { opacity: 0.4; }
/* Past days (before today) read as grayed out / done. */
.cal-day.is-past { opacity: 0.5; }
.cal-day.is-past .cal-day-num { color: var(--text-muted); }
.cal-day.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.cal-day.is-drop-target {
    border-color: var(--accent);
    background: rgba(204, 122, 0, 0.14);
    box-shadow: inset 0 0 0 2px var(--accent);
}

.cal-day-num {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    line-height: 1;
    color: var(--text);
}

.cal-day.is-today .cal-day-num { color: var(--accent); }

.cal-bars {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.cal-bar {
    --bar: #3b82f6;
    background-color: var(--bar);
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
    border-radius: 4px;
    padding: 0.18rem 0.45rem;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    user-select: none;
    touch-action: none;
    transition: filter 0.12s ease;
}
.cal-bar:hover { filter: brightness(1.08); }

/* Pending (requested) shifts read as vertical stripes over the person's color. */
.cal-bar.is-pending {
    background-image: repeating-linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0) 6px,
        rgba(255, 255, 255, 0.38) 6px,
        rgba(255, 255, 255, 0.38) 10px
    );
}

.cal-bar.is-mine { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.65); }

.cal-bar.is-dragging { opacity: 0.35; }

.cal-more {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-align: left;
    padding: 0.1rem 0.45rem;
    cursor: pointer;
}
.cal-more:hover { color: var(--text); }

/* Bottom-right hover "+" to add a shift on that day. */
.cal-add {
    position: absolute;
    bottom: 0.35rem;
    right: 0.35rem;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s ease, background 0.12s ease;
}
.cal-day:hover .cal-add { opacity: 1; }
.cal-add:hover { background: var(--accent-hover); }

/* Floating clone shown while dragging a bar. */
.cal-ghost {
    position: fixed;
    z-index: 300;
    pointer-events: none;
    opacity: 0.9;
    border-radius: 4px;
    padding: 0.18rem 0.45rem;
    font-size: 0.74rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
    box-shadow: var(--shadow);
    white-space: nowrap;
}

/* Hover tooltip for a shift bar. */
#cal-tooltip {
    position: fixed;
    z-index: 320;
    pointer-events: none;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--text);
    box-shadow: var(--shadow);
    max-width: 240px;
}
#cal-tooltip[hidden] { display: none; }
#cal-tooltip em { color: var(--text-muted); font-style: normal; }

/* Right-click context menu (bars + days). */
.ctx-menu {
    position: fixed;
    z-index: 340;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 0.3rem;
    box-shadow: var(--shadow);
    min-width: 140px;
}
.ctx-menu[hidden] { display: none; }
.ctx-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
}
.ctx-item:hover { background: var(--surface-3); }
.ctx-item.is-danger { color: var(--danger); }

/* =========================================================================
   Color swatches (Team tab)
   ========================================================================= */

.swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
}
.swatch.is-active { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }

/* =========================================================================
   Requests inbox (admin)
   ========================================================================= */

.req-list { display: flex; flex-direction: column; gap: 0.6rem; }

.req-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.req-card.is-change { border-left: 3px solid var(--accent); }
.req-info { flex: 1; min-width: 0; }
.req-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: 0.3px;
    font-size: 0.98rem;
    color: var(--text);
}
.req-when { color: var(--text-muted); font-size: 0.82rem; margin-top: 0.1rem; }
.req-note { color: var(--text-muted); font-size: 0.78rem; font-style: italic; margin-top: 0.15rem; }
.req-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

.req-actions .btn-approve {
    background: var(--success);
    color: #06210f;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.78rem;
    cursor: pointer;
}
.req-actions .btn-approve:hover { filter: brightness(1.08); }

.req-actions .btn-decline {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 0.55rem 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.78rem;
    cursor: pointer;
}
.req-actions .btn-decline:hover { background: rgba(239, 68, 68, 0.2); }

.tab-badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    min-width: 18px;
    padding: 0 0.35rem;
    font-size: 0.68rem;
    font-weight: 800;
    text-align: center;
    margin-left: 0.35rem;
    line-height: 18px;
}

/* Shift status chips (My shifts, day list) */
.shift-status {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
}
.shift-status.is-pending  { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.shift-status.is-approved { background: rgba(34,197,94,0.15);   color: var(--success); }
.shift-status.is-declined { background: rgba(239,68,68,0.15);   color: var(--danger); }
.shift-status.is-cancelled{ background: rgba(148,163,184,0.12); color: var(--text-muted); text-decoration: line-through; }

/* =========================================================================
   Pay-period panel
   ========================================================================= */

.pay-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-top: 1.25rem;
}
.pay-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.pay-panel-head h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-size: 1rem;
}
.pay-panel-range { color: var(--accent); font-weight: 700; font-size: 0.9rem; }
.pay-total-row td { border-top: 2px solid var(--border-strong); font-weight: 800; color: var(--text); }
.pay-total-row td .num { color: var(--accent); font-family: 'Outfit', sans-serif; }
.num { font-variant-numeric: tabular-nums; }

/* =========================================================================
   Modal bits
   ========================================================================= */

.field-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}
.modal-actions { display: flex; gap: 0.6rem; margin-top: 0.5rem; }
.modal-actions .btn-primary,
.modal-actions .btn-secondary { flex: 1; }

.danger-link {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 0.5rem 0;
    margin-top: 0.25rem;
}

.pay-line {
    background: var(--accent-soft);
    border: 1px solid rgba(204, 122, 0, 0.35);
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.from-to-row { display: flex; gap: 0.75rem; }
.from-to-row > div { flex: 1; }

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 760px) {
    .staff-shell { padding: 1rem; }
    .cal-nav h1 { min-width: 150px; font-size: 1.1rem; }
    .req-card { gap: 0.6rem; }
    .req-actions { width: 100%; }
    .req-actions .btn-approve,
    .req-actions .btn-decline { flex: 1; }
}

/* Mobile: fit the whole month to the screen width (no horizontal scroll) and
   size everything for touch. The employee taps a day to open its sheet (the
   hover "+" is desktop-only), so shifts stay reachable without hover. */
@media (max-width: 640px) {
    .staff-shell { padding: 0.75rem; }

    .staff-toolbar { gap: 0.6rem; }
    .cal-nav { width: 100%; justify-content: center; }
    .cal-nav h1 { min-width: 0; flex: 1; font-size: 1.05rem; }
    .staff-toolbar-buttons { width: 100%; }
    .staff-toolbar-buttons > .btn-primary,
    .staff-toolbar-buttons > .btn-secondary {
        flex: 1 1 auto;
        font-size: 0.72rem;
        padding: 0.7rem 0.5rem;
    }

    .cal { overflow-x: visible; }
    .cal-weekdays,
    .cal-grid { min-width: 0; gap: 3px; }
    .cal-weekdays span { font-size: 0.52rem; letter-spacing: 0; padding: 0.15rem 0; }

    .cal-day {
        min-height: 66px;
        padding: 0.22rem 0.2rem 0.28rem;
        border-radius: 6px;
        gap: 0.2rem;
    }
    .cal-day-num { font-size: 0.78rem; }
    .cal-bars { gap: 2px; }
    .cal-bar { font-size: 0.6rem; padding: 0.08rem 0.28rem; border-radius: 3px; }
    .cal-more { font-size: 0.56rem; padding: 0 0.2rem; }
    .cal-add { display: none; }

    .from-to-row { flex-direction: column; gap: 0; }
}
