/* ============================================
   SCHEDULE V2 — Timeline-inspired clean design
   Inspired by Medigini schedule UI

   To revert: remove this stylesheet link from index.html
   ============================================ */

/* Schedule wrapper — card container with border and padding */
.schedule-container {
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 20px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02) !important;
}

/* Role badge — editor/viewer indicator */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 10px;
    letter-spacing: 0.02em;
    position: relative;
    top: -2px;
}

.role-badge.role-editor {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.role-badge.role-viewer {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* Override table — contained card look with border */
.schedule-table {
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03) !important;
    border-radius: 10px !important;
    background: #fff !important;
    font-size: 13px;
    overflow: hidden;
}

/* Header — clean with subtle background */
.schedule-table thead th {
    background: #f8fafc !important;
    color: var(--text-secondary) !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    border-bottom: 2px solid #e2e8f0 !important;
    border-right: 1px solid #edf0f4 !important;
    padding: 12px 8px 10px !important;
    position: sticky;
    top: 0;
    z-index: 5;
}

.schedule-table thead th:first-child {
    border-top-left-radius: 10px !important;
}

.schedule-table thead th:last-child {
    border-right: none !important;
    border-top-right-radius: 10px !important;
}

/* Day name bold, date lighter */
.st-day-name {
    font-weight: 600 !important;
    font-size: 13px !important;
    color: var(--text-primary) !important;
    text-transform: none !important;
}

.st-day-date {
    font-size: 11px !important;
    color: var(--text-secondary) !important;
    margin-top: 1px;
}

/* Hours badge — subtle pill */
.st-day-hours {
    background: #f3f4f6 !important;
    color: var(--text-secondary) !important;
    font-size: 10px !important;
    padding: 2px 8px !important;
    border-radius: 10px !important;
    font-weight: 500 !important;
}

.st-day-hours.st-ok {
    background: #dcfce7 !important;
    color: #166534 !important;
}

.st-day-hours.st-over {
    background: #fee2e2 !important;
    color: #991b1b !important;
}

.st-day-hours.st-under {
    background: #dbeafe !important;
    color: #1e40af !important;
}

/* Today column — soft blue highlight instead of heavy red */
.st-today {
    background: rgba(59, 130, 246, 0.04) !important;
    box-shadow: none !important;
}

.schedule-table thead th.st-today {
    background: rgba(59, 130, 246, 0.06) !important;
    color: #1d4ed8 !important;
    box-shadow: none !important;
}

.schedule-table thead th.st-today .st-day-name {
    color: #1d4ed8 !important;
    font-weight: 700 !important;
}

.schedule-table thead th.st-today::after {
    content: '' !important;
    display: none !important;
}

.st-totals-row td.st-today {
    background: rgba(59, 130, 246, 0.04) !important;
}

/* Body cells — visible borders for readability */
.schedule-table tbody td {
    border-bottom: 1px solid #e9ecf1 !important;
    border-right: 1px solid #f0f2f5 !important;
    padding: 8px 6px !important;
    vertical-align: middle !important;
    background: #fff;
    min-width: 112px;
    min-height: 48px;
}

.schedule-table tbody td:last-child {
    border-right: none !important;
}

/* Alternating rows — visible zebra for readability */
.st-row:nth-child(odd) {
    background: #fff !important;
}

.st-row:nth-child(even) {
    background: #f7f9fb !important;
}

.st-row:hover {
    background: #eef4ff !important;
}

.st-row:hover td:first-child {
    border-left: 3px solid #3b82f6 !important;
}

.st-row td:first-child {
    border-left: 3px solid transparent !important;
    transition: border-color 0.15s;
}

/* Employee name — clean typography, sticky left column */
.st-name {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
    padding-left: 12px !important;
    min-width: 160px !important;
    white-space: nowrap !important;
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 2;
}

.st-lastname {
    font-weight: 400 !important;
    color: #6b7280 !important;
}

/* Function badge — soft, round */
.st-func-badge {
    background: #eff6ff !important;
    color: #3b82f6 !important;
    font-size: 9px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    padding: 2px 6px !important;
}

/* Type badge */
.contract-type-badge {
    background: #f3f4f6 !important;
    color: #6b7280 !important;
    font-size: 10px !important;
    border-radius: 6px !important;
}

/* Group rows — section dividers */
.st-group-row {
    background: #f1f5f9 !important;
}

.schedule-table .st-group-row td {
    background: #f1f5f9 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-top: 1px solid #d1d5db !important;
    padding: 8px 12px !important;
    font-size: 11px !important;
    color: #374151 !important;
    font-weight: 700 !important;
}

.st-group-row td:first-child {
    border-left: 3px solid #3b82f6 !important;
}

.st-group-badge {
    background: #e0e7ff !important;
    color: #3730a3 !important;
    font-size: 10px !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
}

/* ============================================
   SHIFT CARDS — Timeline blocks
   Colored rounded bars instead of bordered cards
   ============================================ */

.st-shift {
    height: auto !important;
    min-height: 36px !important;
    border: none !important;
    border-left: none !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    margin: 2px 0 !important;
    font-size: 13px !important;
    transition: opacity 0.15s, box-shadow 0.15s, transform 0.1s !important;
    box-shadow: none !important;
    cursor: pointer;
}

.st-shift:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
}

/* Published shifts — solid blue/teal blocks */
/* Published shifts — solid green left border, clear background */
.st-shift.st-published {
    background: #f0fdf4 !important;
    border: none !important;
    border-left: 3px solid #4CAF50 !important;
    opacity: 1 !important;
}

.st-shift.st-published:hover {
    background: #dcfce7 !important;
    box-shadow: 0 1px 4px rgba(76,175,80,0.2) !important;
}

/* Concept/unpublished shifts — dashed orange left border */
.st-shift.st-concept {
    background: #fffbeb !important;
    border: 1.5px dashed #f59e0b !important;
    border-left: 3px dashed #FF9800 !important;
    opacity: 0.85 !important;
}

.st-shift.st-concept:hover {
    opacity: 1 !important;
    background: #fef3c7 !important;
}

/* Published badge */
.st-pub-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    margin-left: 4px;
}
.st-pub-badge.pub {
    background: #dcfce7;
    color: #166534;
}
.st-pub-badge.draft {
    background: #fef3c7;
    color: #92400e;
}

/* Selected shift */
.st-shift.st-sel {
    background: #93c5fd !important;
    box-shadow: 0 0 0 2px #3b82f6 !important;
}

/* Shift times — prominent and readable */
.st-shift-times {
    display: flex;
    align-items: center;
    gap: 1px;
}

.st-shift-time {
    font-weight: 700 !important;
    color: #1e40af !important;
    font-size: 13px !important;
}

.st-shift-sep {
    color: #93c5fd !important;
    font-size: 12px !important;
    margin: 0 2px !important;
}

/* Task abbreviation */
.st-task-abbr {
    display: block;
    color: #6b7280 !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    opacity: 0.8 !important;
    margin-top: 2px;
}

/* Task blocks — colored mini pills */
.st-task-blocks {
    gap: 1px !important;
}

.st-task-block {
    font-size: 8px !important;
    padding: 0 3px !important;
    border-radius: 3px !important;
    line-height: 14px !important;
    border-left: none !important;
}

/* Status badges — soft colored */
.st-status {
    border-radius: 6px !important;
    font-size: 10px !important;
    padding: 3px 8px !important;
    border: none !important;
}

/* Absence with soft peach background */
.st-status[data-absence="true"] {
    background-image: none !important;
    background: #fff7ed !important;
    color: #c2410c !important;
}

/* ============================================
   FILLED CELLS — subtle highlight
   ============================================ */

.st-filled {
    background: rgba(59, 130, 246, 0.02) !important;
}

/* Empty row — subtle but readable */
.st-empty-row {
    opacity: 0.55 !important;
}

.st-empty-row:hover {
    opacity: 0.85 !important;
}

/* ============================================
   ACTION BUTTONS — centered, visible
   ============================================ */

.st-cell-actions {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
}

.st-add {
    color: #94a3b8 !important;
    border: 1.5px dashed #cbd5e1 !important;
    background: transparent !important;
    font-size: 16px !important;
    width: 26px !important;
    height: 26px !important;
    border-radius: 6px !important;
    opacity: 0.6 !important;
}

.st-cell:hover .st-add {
    opacity: 1 !important;
    color: #64748b !important;
    border-color: #94a3b8 !important;
}

.st-add:hover {
    color: #fff !important;
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    border-style: solid !important;
    opacity: 1 !important;
}

.st-reserve {
    color: #94a3b8 !important;
    border: 1.5px dashed #cbd5e1 !important;
    background: transparent !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    width: 26px !important;
    height: 26px !important;
    border-radius: 6px !important;
    opacity: 0.6 !important;
}

.st-cell:hover .st-reserve {
    opacity: 1 !important;
    color: #64748b !important;
    border-color: #94a3b8 !important;
}

.st-reserve:hover {
    background: #64748b !important;
    color: #fff !important;
    border-color: #64748b !important;
    border-style: solid !important;
    opacity: 1 !important;
}

/* ============================================
   HOURS & DIFF COLUMNS
   ============================================ */

.st-hours {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    border-left: 2px solid #e2e8f0 !important;
}

.st-hours-ok {
    color: #16a34a !important;
    background: transparent !important;
}

.st-hours-over {
    color: #dc2626 !important;
    background: transparent !important;
}

.st-diff {
    font-size: 11px !important;
    border-left: 1px solid #f0f0f0 !important;
}

/* ============================================
   TOTALS ROW — clean
   ============================================ */

.st-totals-row {
    background: #f1f5f9 !important;
}

.st-totals-row td {
    border-top: 3px solid #1976D2 !important;
    font-size: 14px !important;
    padding: 12px 8px !important;
    border-bottom: none !important;
    text-align: center;
    font-weight: 600;
}

.st-totals-row td:first-child {
    border-bottom-left-radius: 10px !important;
}

.st-totals-row td:last-child {
    border-bottom-right-radius: 10px !important;
}

.st-total-cell.st-over {
    color: #dc2626 !important;
}

.st-total-cell.st-under {
    color: #16a34a !important;
}

.st-budget-label {
    color: #9ca3af !important;
    font-size: 10px !important;
}

/* ============================================
   DEPARTMENT CHIPS — clean pills
   ============================================ */

.st-dept-row {
    background: #fafbfc !important;
}

.st-dept-row td {
    border-top: 1px solid #edf0f4 !important;
    border-bottom: none !important;
}

.st-dept-row td:first-child {
    border-bottom-left-radius: 10px !important;
}

.st-dept-row td:last-child {
    border-bottom-right-radius: 10px !important;
}

/* When dept row exists, totals row shouldn't have bottom radius */
.st-totals-row + .st-dept-row ~ .st-totals-row td:first-child,
.st-totals-row:has(+ .st-dept-row) td:first-child {
    border-bottom-left-radius: 0 !important;
}

.st-totals-row:has(+ .st-dept-row) td:last-child {
    border-bottom-right-radius: 0 !important;
}

.st-dept-chip {
    border-radius: 999px !important;
    padding: 4px 12px !important;
    font-size: 11px !important;
    border: 1px solid #e5e7eb !important;
    background: #fff !important;
    border-left-width: 1px !important;
}

.st-dept-label {
    font-size: 9px !important;
}

/* ============================================
   DARK MODE OVERRIDES
   ============================================ */

[data-theme="dark"] .schedule-table thead th {
    background: var(--bg-card) !important;
    color: var(--text-secondary) !important;
    border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] .schedule-table tbody td {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .st-row:nth-child(even) {
    background: rgba(255,255,255,0.02) !important;
}

[data-theme="dark"] .st-shift.st-published {
    background: rgba(59,130,246,0.15) !important;
}

[data-theme="dark"] .st-shift.st-concept {
    background: rgba(255,255,255,0.05) !important;
    border-color: rgba(255,255,255,0.15) !important;
}

[data-theme="dark"] .st-shift-time {
    color: #93c5fd !important;
}

[data-theme="dark"] .st-group-row td,
[data-theme="dark"] .st-group-row {
    background: var(--bg-main) !important;
}

[data-theme="dark"] .st-day-hours {
    background: rgba(255,255,255,0.08) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .st-totals-row {
    background: var(--bg-main) !important;
}

[data-theme="dark"] .st-totals-row td {
    border-top-color: var(--border-color) !important;
}

[data-theme="dark"] .st-dept-chip {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .st-func-badge {
    background: rgba(59,130,246,0.15) !important;
}

/* ============================================
   SCHEDULE WRAPPER — horizontal scroll
   ============================================ */
.schedule-grid-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -8px;
    padding: 0 8px;
}

/* ============================================
   PRINT STYLES — clean minimal output
   ============================================ */
@media print {
    .schedule-container,
    .schedule-grid-wrapper {
        overflow: visible !important;
    }

    .st-task-blocks, .st-task-abbr, .st-pub-badge,
    .st-cell-actions, .st-reserve, .st-add,
    #selectionActionBar, #clipboardIndicator,
    .schedule-actions, .btn, button,
    nav, .sidebar, .header, .page-header-actions,
    .role-badge, .rooster-toolbar,
    .no-print {
        display: none !important;
    }

    .schedule-table {
        font-size: 11px !important;
        width: 100% !important;
        border: 1px solid #999 !important;
    }

    .schedule-table thead th {
        background: #eee !important;
        color: #000 !important;
        font-size: 11px !important;
        padding: 6px 4px !important;
    }

    .schedule-table tbody td {
        padding: 4px !important;
        border: 1px solid #ccc !important;
        min-width: auto !important;
    }

    .st-shift {
        background: none !important;
        border: none !important;
        border-left: none !important;
        color: #000 !important;
        padding: 1px 2px !important;
        margin: 0 !important;
        min-height: auto !important;
        height: auto !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .st-shift-time {
        color: #000 !important;
        font-size: 10px !important;
    }

    .st-shift-sep {
        color: #666 !important;
    }

    .st-name {
        position: static !important;
        font-size: 11px !important;
    }

    .st-dept-row, .st-dept-summary {
        display: none !important;
    }
}
