/* ============================================================
   Shared roster styles
   Used by Department roster and Employee roster pages.
   Loaded globally from App.razor (alongside shared.css), so both
   pages reference the same selectors without duplicating rules
   in their isolated .razor.css files.
   ============================================================ */

/* ── Container ─────────────────────────────────── */
.roster-container {
    padding: 1.5rem;
    font-family: var(--font-sans);
}

/* ── Top bar ───────────────────────────────────── */
.roster-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 0.4rem;
}

    .roster-header h2 {
        margin: 0;
        font-size: 1.3rem;
        font-weight: 600;
        color: var(--color-text-strong);
    }

/* ── Roster changed banner ────────────────────── */
.roster-changed-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--color-warning-soft);
    border: 1px solid #fec84b;
    border-radius: var(--radius-lg);
    color: #93370d;
    font-size: 0.85rem;
    font-weight: 500;
    animation: roster-banner-slide-in 0.3s ease-out;
}

@keyframes roster-banner-slide-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Historical roster banner ─────────────────────── */

.roster-historical-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: var(--radius-lg);
    color: #1e40af;
    font-size: 0.85rem;
    font-weight: 500;
    animation: roster-banner-slide-in 0.3s ease-out;
}

/* ── Inactive employee badge in roster rows ───────── */

.employee-inactive-badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.4rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    color: #6b7280;
    font-size: 0.7rem;
    font-weight: 600;
    vertical-align: middle;
}

/* ── Toolbar ───────────────────────────────────── */
.roster-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    gap: 0.5rem;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.toolbar-split {
    width: 1px;
    height: 1.4rem;
    background: var(--color-border-light);
    margin: 0 0.15rem;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-white);
    color: var(--color-text-strong);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
    white-space: nowrap;
}

    .toolbar-btn:hover {
        background: var(--color-surface-hover);
    }

    .toolbar-btn.publish {
        background: var(--color-success-bright);
        border-color: var(--color-success-bright);
        color: var(--color-white);
    }

        .toolbar-btn.publish:hover {
            background: var(--color-success-mid);
        }

    .toolbar-btn.danger {
        color: var(--color-danger);
        border-color: var(--color-danger-border);
    }

        .toolbar-btn.danger:hover {
            background: var(--color-danger-soft);
        }

.publish-pill {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    line-height: 1.3;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

    .publish-pill.draft {
        background: rgba(255, 255, 255, 0.25);
        color: var(--color-white);
    }

    .publish-pill.partial {
        background: var(--color-warning-soft);
        color: var(--color-warning);
    }

    .publish-pill.published {
        background: var(--color-white);
        color: var(--color-success-deep);
    }

.toolbar-icon {
    font-size: 0.9rem;
    line-height: 1;
}

.toolbar-chevron {
    font-size: 0.6rem;
    margin-left: 0.1rem;
    opacity: 0.6;
}

/* Dropdown */
.toolbar-dropdown-wrapper {
    position: relative;
}

.notify-dropdown {
    min-width: 260px;
}

.notify-pill {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    line-height: 1.3;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    background: var(--color-primary-soft);
    color: var(--color-primary-strong);
}

.notify-hint {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

    .notify-hint.not-sent {
        font-style: italic;
        color: var(--color-text-subtle);
    }

.toolbar-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 200px;
    background: var(--color-white);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 100;
    padding: 0.25rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: none;
    border-radius: var(--radius-md);
    background: none;
    color: var(--color-text-strong);
    font-size: 0.82rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}

    .dropdown-item:hover {
        background: var(--color-surface-hover);
    }

.dropdown-divider {
    height: 1px;
    background: var(--color-border-light);
    margin: 0.25rem 0.5rem;
}

.publish-check {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    width: 1.1rem;
    text-align: center;
}

    .publish-check.checked {
        color: var(--color-success-bright);
    }

    .publish-check.unchecked {
        color: var(--color-text-subtle);
    }

    .publish-check.partial {
        color: var(--color-warning-accent);
    }

.publish-label {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
}

    .publish-label.published {
        color: var(--color-success-deep);
        background: var(--color-success-soft);
    }

    .publish-label.draft {
        color: var(--color-warning);
        background: var(--color-warning-soft);
    }

/* ── Header row corner & day headers ───────────── */
.grid-corner {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    border-right: 1px solid var(--color-border-light);
}

.grid-day-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.6rem 0.25rem;
    border-right: 1px solid var(--color-border-light);
    gap: 0.15rem;
}

    .grid-day-header:last-child {
        border-right: none;
    }

    .grid-day-header.today {
        background: var(--color-primary-soft);
        box-shadow: inset 0 -2px 0 var(--color-primary);
    }

.day-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-strong);
}

.day-date {
    font-size: 0.75rem;
    color: var(--color-text-subtle);
}

/* ── Day messages ──────────────────────────────── */
.day-message {
    font-size: 0.68rem;
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.3;
    cursor: pointer;
    transition: filter var(--transition-fast);
}

    .day-message:hover {
        filter: brightness(0.92);
    }

    .day-message.company {
        background: var(--color-warning-amber);
        color: var(--color-warning-strong);
        margin-top: 0.15rem;
    }

    .day-message.dept {
        background: var(--color-primary-soft);
        color: #1849a9;
    }

.day-message-add {
    padding: 0.05rem 0.35rem;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--color-border);
    background: none;
    color: var(--color-text-subtle);
    font-size: 0.68rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

    .day-message-add:hover {
        border-color: var(--color-primary);
        color: var(--color-primary);
        background: var(--color-primary-bg-3);
    }

.day-shift-add {
    padding: 0.05rem 0.35rem;
    margin: 0 3px 0 0;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--color-border);
    background: none;
    color: var(--color-text-subtle);
    font-size: 0.68rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

    .day-shift-add:hover {
        border-color: var(--color-primary);
        color: var(--color-primary);
        background: var(--color-primary-bg-3);
    }

/* ── Days grid (layered: bg + content) ─────────── */
.days-bg-layer {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.day-bg {
    cursor: pointer;
    transition: background var(--transition-fast);
    border-right: 1px solid var(--color-border-faint);
    position: relative;
}

    .day-bg:hover {
        background: rgba(46, 144, 250, 0.04);
    }

    .day-bg:hover::before {
        content: '+';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 2rem;
        color: rgba(46, 144, 250, 0.3);
        font-weight: 300;
        pointer-events: none;
        line-height: 1;
    }

    .day-bg:last-child {
        border-right: none;
    }

    .day-bg.drop-target {
        background: var(--color-drop-target) !important;
        box-shadow: inset 0 0 0 2px var(--color-primary);
        border-radius: var(--radius-sm);
    }

    .day-bg.range-selected {
        background: var(--color-range-selected) !important;
        box-shadow: inset 0 0 0 2px var(--color-primary);
        border-radius: var(--radius-sm);
    }

.days-content {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-flow: dense;
    grid-auto-rows: min-content;
    gap: 4px;
    padding: 6px 4px;
    align-content: center;
    position: relative;
    pointer-events: none;
}

    .days-content.drag-active,
    .days-content.drag-active .shift-card {
        pointer-events: none;
    }

/* ── Shift cards ───────────────────────────────── */
.shift-card {
    display: flex;
    flex-direction: column;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-md);
    background: var(--color-surface-alt);
    font-size: 0.78rem;
    transition: box-shadow var(--transition-fast);
    pointer-events: auto;
    min-width: 0;
    overflow: hidden;
    cursor: pointer;
}

    /* Type modifiers for shift cards live in ShiftCard.razor.css (scoped to that component). */

    .shift-card:hover {
        box-shadow: var(--shadow-card);
    }

    .shift-card.dragging {
        opacity: 0.4;
        box-shadow: none;
    }

    .shift-card[draggable="true"] {
        cursor: grab;
    }

        .shift-card[draggable="true"]:active {
            cursor: grabbing;
        }

    .shift-card.editing {
        box-shadow: 0 0 0 2px var(--color-primary);
    }

.shift-time {
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.shift-badge {
    display: inline-block;
    padding: 0.05rem 0.35rem;
    border-radius: var(--radius-sm);
    background: var(--color-info-soft);
    color: var(--color-info);
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
}

.shift-hours {
    color: var(--color-text-subtle);
    font-size: 0.7rem;
}

/* ── Item type pill ────────────────────────────── */
.shift-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.05rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.6rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    margin-bottom: 0.15rem;
}

/* Item type pill colors live in /css/shared.css. */

/* ── Totals ────────────────────────────────────── */
.roster-totals {
    display: grid;
    grid-template-columns: 160px repeat(7, minmax(0, 1fr));
    border: 1px solid var(--color-border-light);
    border-top: 2px solid var(--color-border-light);
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    background: var(--color-surface-alt);
}

.totals-label {
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    border-right: 1px solid var(--color-border-light);
}

.totals-value {
    padding: 0.6rem 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-strong);
    border-right: 1px solid var(--color-border-light);
}

    .totals-value:last-child {
        border-right: none;
    }

/* ── Modal ─────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    background: var(--color-white);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 480px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border-light);
}

    .modal-head h3 {
        margin: 0;
        font-size: 1.1rem;
        font-weight: 600;
    }

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--color-text-subtle);
    padding: 0.25rem;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

    .modal-close:hover {
        background: var(--color-surface-hover);
        color: var(--color-text-strong);
    }

.modal-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border-light);
}

.modal-foot-spacer {
    flex: 1;
}

/* ── Form elements ─────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-strong);
}

.form-input,
.form-select {
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--color-text-strong);
    background: var(--color-white);
    transition: border-color var(--transition-fast);
}

    .form-input:focus,
    .form-select:focus {
        outline: none;
        border-color: var(--color-primary);
        box-shadow: 0 0 0 3px var(--color-focus-ring);
    }

    .form-select option:disabled {
        color: var(--color-text-subtle);
    }

.form-fieldset {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
}

    .form-fieldset legend {
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--color-text-muted);
        padding: 0 0.4rem;
    }

.form-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--color-text-strong);
    cursor: pointer;
    padding-bottom: 0.45rem;
}

    .form-check input[type="checkbox"] {
        width: 1rem;
        height: 1rem;
        accent-color: var(--color-primary);
    }

/* ── Edit summary ──────────────────────────────── */
.edit-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-surface-alt);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
}

.edit-total {
    color: var(--color-text-strong);
}

.edit-error {
    color: var(--color-danger-strong);
    font-size: 0.8rem;
    font-weight: 500;
}

/* Action buttons (.btn-cancel/.btn-save/.btn-delete) live in /css/shared.css. */

/* ── Header row ─────────────────────────────────── */
.roster-header-row {
    display: grid;
    grid-template-columns: 160px repeat(7, minmax(0, 1fr));
    border: 1px solid var(--color-border-light);
    border-radius: 10px 10px 0 0;
    overflow: hidden;
    background: var(--color-surface-alt);
}

/* ── Department rows ─────────────────────────────── */
/* Scoped to .roster-container so it does not bleed onto <tr class="dept-row">
   elements in other pages (e.g. AbsenceCalendar table rows). */
.roster-container .dept-row {
    display: flex;
    border: 1px solid var(--color-border-light);
    border-top: none;
    background: var(--color-white);
}

.grid-dept {
    display: flex;
    flex-direction: column;
    justify-content: start;
    gap: 0.35rem;
    padding: 0.75rem;
    background: #fcfcfd;
    border-right: 1px solid var(--color-border-light);
    min-height: 90px;
    min-width: 160px;
    width: 160px;
    flex-shrink: 0;
}

.roster-container .dept-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dept-icon {
    font-size: 1.2rem;
}

.dept-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-strong);
}

.dept-days {
    flex: 1;
    position: relative;
    min-height: 90px;
}

/* ── Message row inside department days ─────────── */
.days-messages {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0 4px;
    padding: 4px 4px 0;
    position: relative;
    pointer-events: none;
}

.day-message-cell {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
    min-height: 0;
}

.day-message-visible {
    display: block !important;
}

.days-messages.drag-active,
.days-messages.drag-active .day-message-cell {
    pointer-events: none;
}

/* Show + buttons on row hover */
.grid-day-header:hover .day-message-add,
.dept-days:hover .day-message-add,
.dept-days:hover .day-shift-add {
    display: inline-block;
}

/* ── Open shifts section ─────────────────────────── */
.open-shifts-section {
    border-top: 1px dashed #e4c76a;
    border-bottom: 1px dashed #e4c76a;
    background: rgba(255, 254, 245, 0.85);
}

/* ── Shift card top row ──────────────────────────── */
.shift-card-top {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

    .shift-card-top .shift-employee {
        flex: 1 1 auto;
        min-width: 0;
    }

.shift-employee {
    font-weight: 600;
    color: var(--color-text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Totals column grid ──────────────────────────── */
/* Individual pages override grid-template-columns via roster-totals in roster.css below. */

/* ============================================================
   Dark-theme overrides for the shared roster chrome.
   These apply on any page that includes a roster-container.
   ============================================================ */
[data-theme="dark"] .btn-reload:hover {
    background: var(--color-warning-soft);
}

[data-theme="dark"] .roster-changed-banner {
    border-color: var(--color-warning-accent);
    color: var(--color-warning);
}

[data-theme="dark"] .roster-header h2 {
    color: var(--color-text-strong);
}

[data-theme="dark"] .toolbar-btn {
    color: var(--color-text-strong);
    border-color: var(--color-border);
}

[data-theme="dark"] .toolbar-btn {
    background: var(--color-surface);
}

    [data-theme="dark"] .toolbar-btn:hover {
        background: var(--color-surface-hover);
    }

[data-theme="dark"] .shift-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

/* "+ bericht v.d. dag" / inline "+ shift" buttons in day cells. */
[data-theme="dark"] .day-message-add,
[data-theme="dark"] .day-shift-add {
    background: #0f172a;
    color: #ffffff;
    border: 1px dashed #475569;
}

    [data-theme="dark"] .day-message-add:hover,
    [data-theme="dark"] .day-shift-add:hover {
        background: #1e293b;
        border-color: var(--color-primary);
        color: #ffffff;
    }

/* Day messages — keep amber/blue identity but bump contrast. */
[data-theme="dark"] .day-message.company {
    background: rgba(247, 144, 9, 0.22);
    color: #fde68a;
}

[data-theme="dark"] .day-message.dept {
    background: rgba(46, 144, 250, 0.22);
    color: #bfdbfe;
}

[data-theme="dark"] .grid-dept {
    background: var(--color-surface-alt);
}

[data-theme="dark"] .open-shifts-section {
    border-top-color: var(--color-warning-accent);
    border-bottom-color: var(--color-warning-accent);
    background: var(--color-warning-bg-2);
}

/* The "+ shift" buttons inside dept rows sit on the dark grid-dept;
   keep them readable but visually subordinate to the toolbar. */
[data-theme="dark"] .grid-dept .btn-nav {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}

    [data-theme="dark"] .grid-dept .btn-nav:hover {
        background: #1e293b;
        border-color: #334155;
        color: #ffffff;
    }
