/* Calendar page - SaaS task planning view */

.calendar-header {
    align-items: flex-start;
}

.calendar-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.calendar-toolbar {
    overflow: visible;
}

.calendar-toolbar-row {
    display: grid;
    grid-template-columns: minmax(260px, .8fr) auto minmax(520px, 1.4fr);
    gap: 16px;
    align-items: center;
}

.calendar-nav-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.calendar-current-period {
    min-width: 190px;
    display: grid;
    gap: 2px;
}

.calendar-current-period b {
    color: #F8FAFC;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -.02em;
}

.calendar-current-period span {
    color: #94A3B8;
    font-size: 12px;
    font-weight: 700;
}

.calendar-view-toggle {
    display: inline-flex;
    padding: 4px;
    border-radius: 14px;
    background: rgba(15, 23, 42, .62);
    border: 1px solid rgba(148, 163, 184, .14);
    gap: 4px;
}

.calendar-view-toggle button {
    height: 36px;
    padding: 0 14px;
    border-radius: 10px;
    border: 0;
    background: transparent;
    color: #CBD5E1;
    font-weight: 900;
    cursor: pointer;
}

.calendar-view-toggle button.active {
    background: #2563EB;
    color: #FFFFFF;
    box-shadow: 0 10px 24px rgba(37, 99, 235, .32);
}

.calendar-filter-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 10px;
}

.calendar-filter-control {
    width: 100%;
}

.calendar-filter-control .mud-input-root,
.calendar-filter-control .mud-input,
.calendar-filter-control .mud-select,
.calendar-filter-control .mud-select-input,
.calendar-filter-control input,
.calendar-filter-control input[readonly] {
    color: #F8FAFC !important;
    -webkit-text-fill-color: #F8FAFC !important;
}

.calendar-filter-control .mud-input-outlined-border {
    border-color: rgba(148, 163, 184, .35) !important;
}

.calendar-filter-control .mud-icon-root {
    color: #CBD5E1 !important;
}

.calendar-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

.calendar-board-panel,
.selected-day-panel {
    min-height: 720px;
}

.task-calendar-grid.month-view {
    display: grid;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    gap: 10px;
}

.calendar-weekday {
    padding: 0 8px 2px;
    color: #94A3B8;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.calendar-day-cell {
    min-height: 118px;
    width: 100%;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, .14);
    background: rgba(15, 23, 42, .52);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.calendar-day-cell:hover {
    transform: translateY(-1px);
    border-color: rgba(59, 130, 246, .45);
    background: rgba(30, 41, 59, .75);
}

.calendar-day-cell.today {
    border-color: rgba(59, 130, 246, .58);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, .18);
}

.calendar-day-cell.selected {
    border-color: rgba(139, 92, 246, .70);
    background: rgba(79, 70, 229, .14);
}

.calendar-day-cell.muted-month {
    opacity: .48;
}

.calendar-day-cell.has-critical {
    border-color: rgba(239, 68, 68, .42);
}

.calendar-day-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.calendar-day-top span {
    color: #F8FAFC;
    font-size: 15px;
    font-weight: 900;
}

.calendar-day-top b {
    min-width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    color: #BFDBFE;
    background: rgba(59, 130, 246, .18);
    border: 1px solid rgba(59, 130, 246, .28);
    font-size: 12px;
}

.calendar-events-list {
    display: grid;
    gap: 6px;
    overflow: hidden;
}

.calendar-event-chip {
    display: block;
    min-width: 0;
    border-radius: 9px;
    padding: 5px 7px;
    color: #F8FAFC;
    background: rgba(59, 130, 246, .15);
    border-left: 3px solid #60A5FA;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
}

.calendar-event-chip span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event-chip.critical,
.calendar-event-card.critical,
.selected-task-card.critical,
.day-timeline-item.critical {
    border-left-color: #EF4444;
}

.calendar-event-chip.high,
.calendar-event-card.high,
.selected-task-card.high,
.day-timeline-item.high {
    border-left-color: #F59E0B;
}

.calendar-event-chip.medium,
.calendar-event-card.medium,
.selected-task-card.medium,
.day-timeline-item.medium {
    border-left-color: #8B5CF6;
}

.calendar-event-chip.low,
.calendar-event-card.low,
.selected-task-card.low,
.day-timeline-item.low {
    border-left-color: #22C55E;
}

.calendar-event-chip.done {
    opacity: .72;
}

.calendar-more {
    color: #93C5FD;
    font-size: 12px;
    font-weight: 900;
}

.task-calendar-grid.week-view {
    display: grid;
    grid-template-columns: repeat(5, minmax(190px, 1fr));
    gap: 12px;
}

.week-day-column {
    min-height: 650px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, .14);
    background: rgba(15, 23, 42, .46);
    padding: 12px;
    text-align: left;
    cursor: pointer;
}

.week-day-column.today {
    border-color: rgba(59, 130, 246, .58);
}

.week-day-column.selected {
    border-color: rgba(139, 92, 246, .70);
    background: rgba(79, 70, 229, .14);
}

.week-day-header {
    display: grid;
    gap: 4px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, .14);
}

.week-day-header span {
    color: #93C5FD;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.week-day-header b {
    color: #F8FAFC;
    font-size: 18px;
}

.week-day-header small {
    color: #94A3B8;
}

.week-day-events {
    display: grid;
    gap: 10px;
}

.calendar-event-card {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(30, 41, 59, .70);
    border: 1px solid rgba(148, 163, 184, .14);
    border-left: 4px solid #60A5FA;
    cursor: pointer;
}

.calendar-event-card b {
    color: #F8FAFC;
    font-size: 13px;
}

.calendar-event-card span,
.calendar-event-card small {
    color: #94A3B8;
    font-size: 12px;
}

.calendar-empty-slot {
    padding: 16px;
    border-radius: 14px;
    border: 1px dashed rgba(148, 163, 184, .22);
    color: #64748B;
    text-align: center;
    font-size: 13px;
}

.day-view-panel {
    min-height: 660px;
}

.day-view-title {
    margin-bottom: 18px;
}

.day-view-title span {
    color: #93C5FD;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.day-view-title h2 {
    margin: 4px 0 0;
    color: #F8FAFC;
    font-size: 28px;
    letter-spacing: -.03em;
}

.day-timeline {
    display: grid;
    gap: 12px;
}

.day-timeline-item {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 12px;
    align-items: stretch;
    border-left: 4px solid #60A5FA;
}

.day-timeline-time {
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(59, 130, 246, .14);
    color: #BFDBFE;
    font-size: 12px;
    font-weight: 900;
}

.day-timeline-item button {
    text-align: left;
    border: 1px solid rgba(148, 163, 184, .14);
    background: rgba(15, 23, 42, .62);
    border-radius: 14px;
    padding: 14px;
    display: grid;
    gap: 5px;
    cursor: pointer;
}

.day-timeline-item button b {
    color: #F8FAFC;
}

.day-timeline-item button span,
.day-timeline-item button small {
    color: #94A3B8;
}

.selected-day-panel {
    position: sticky;
    top: 84px;
}

.selected-day-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(148, 163, 184, .14);
}

.selected-day-header span {
    color: #93C5FD;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.selected-day-header h2 {
    margin: 4px 0 0;
    color: #F8FAFC;
    font-size: 22px;
    letter-spacing: -.03em;
}

.selected-day-list {
    display: grid;
    gap: 12px;
}

.selected-task-card {
    border-radius: 16px;
    background: rgba(15, 23, 42, .62);
    border: 1px solid rgba(148, 163, 184, .14);
    border-left: 4px solid #60A5FA;
    padding: 13px;
    display: grid;
    gap: 10px;
}

.selected-task-top {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.selected-task-title {
    padding: 0;
    border: 0;
    background: transparent;
    color: #F8FAFC;
    font-weight: 900;
    text-align: left;
    cursor: pointer;
}

.selected-task-title:hover {
    color: #93C5FD;
    text-decoration: underline;
}

.selected-task-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.selected-task-meta span {
    color: #CBD5E1;
    background: rgba(148, 163, 184, .10);
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
}

.selected-task-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selected-task-progress .progress-track.small {
    flex: 1;
    width: auto;
}

.selected-task-progress small {
    color: #CBD5E1;
    font-weight: 900;
}

.selected-task-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(148, 163, 184, .12);
    padding-top: 8px;
}

.calendar-empty-state,
.calendar-empty-day {
    min-height: 180px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 22px;
    border-radius: 16px;
    border: 1px dashed rgba(148, 163, 184, .24);
    background: rgba(15, 23, 42, .42);
    text-align: center;
}

.calendar-empty-state .mud-icon-root,
.calendar-empty-day .mud-icon-root {
    color: #93C5FD;
    font-size: 34px;
}

.calendar-empty-state b,
.calendar-empty-day b {
    color: #F8FAFC;
}

.calendar-empty-state span,
.calendar-empty-day span {
    color: #94A3B8;
    max-width: 320px;
}

/* Light mode */
.light-mode .calendar-current-period b,
.light-mode .calendar-day-top span,
.light-mode .week-day-header b,
.light-mode .day-view-title h2,
.light-mode .selected-day-header h2,
.light-mode .calendar-event-card b,
.light-mode .selected-task-title,
.light-mode .day-timeline-item button b,
.light-mode .calendar-empty-state b,
.light-mode .calendar-empty-day b {
    color: #111827;
}

.light-mode .calendar-current-period span,
.light-mode .calendar-weekday,
.light-mode .calendar-event-card span,
.light-mode .calendar-event-card small,
.light-mode .day-timeline-item button span,
.light-mode .day-timeline-item button small,
.light-mode .selected-task-meta span,
.light-mode .selected-task-progress small,
.light-mode .calendar-empty-state span,
.light-mode .calendar-empty-day span {
    color: #64748B;
}

.light-mode .calendar-view-toggle {
    background: #F1F5F9;
    border: 1px solid #E5E7EB;
}

.light-mode .calendar-view-toggle button {
    color: #475569;
}

.light-mode .calendar-view-toggle button.active {
    background: #2563EB;
    color: #FFFFFF;
}

.light-mode .calendar-filter-control .mud-input-root,
.light-mode .calendar-filter-control .mud-input,
.light-mode .calendar-filter-control .mud-select,
.light-mode .calendar-filter-control .mud-select-input,
.light-mode .calendar-filter-control input,
.light-mode .calendar-filter-control input[readonly] {
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
}

.light-mode .calendar-filter-control .mud-input-outlined-border {
    border-color: #CBD5E1 !important;
}

.light-mode .calendar-filter-control .mud-icon-root {
    color: #64748B !important;
}

.light-mode .calendar-day-cell,
.light-mode .week-day-column,
.light-mode .calendar-event-card,
.light-mode .selected-task-card,
.light-mode .day-timeline-item button,
.light-mode .calendar-empty-state,
.light-mode .calendar-empty-day,
.light-mode .calendar-empty-slot {
    background: #F8FAFC;
    border-color: #E5E7EB;
}

.light-mode .calendar-day-cell:hover {
    background: #EFF6FF;
    border-color: #93C5FD;
}

.light-mode .calendar-day-cell.selected,
.light-mode .week-day-column.selected {
    background: #EEF2FF;
    border-color: #818CF8;
}

.light-mode .calendar-day-cell.today,
.light-mode .week-day-column.today {
    border-color: #60A5FA;
}

.light-mode .calendar-event-chip {
    background: #FFFFFF;
    color: #111827;
    border-top: 1px solid #E5E7EB;
    border-right: 1px solid #E5E7EB;
    border-bottom: 1px solid #E5E7EB;
}

.light-mode .calendar-day-top b {
    background: #DBEAFE;
    border-color: #93C5FD;
    color: #2563EB;
}

.light-mode .week-day-header,
.light-mode .selected-day-header,
.light-mode .selected-task-actions {
    border-color: #E5E7EB;
}

.light-mode .day-timeline-time {
    background: #DBEAFE;
    color: #1D4ED8;
}

.light-mode .selected-task-meta span {
    background: #FFFFFF;
    border-color: #E5E7EB;
}

@media (max-width: 1450px) {
    .calendar-toolbar-row {
        grid-template-columns: 1fr;
    }

    .calendar-filter-row {
        grid-template-columns: repeat(4, minmax(180px, 1fr));
    }
}

@media (max-width: 1200px) {
    .calendar-layout {
        grid-template-columns: 1fr;
    }

    .selected-day-panel {
        position: static;
    }

    .task-calendar-grid.month-view {
        grid-template-columns: repeat(7, minmax(105px, 1fr));
    }
}

@media (max-width: 850px) {
    .calendar-header,
    .calendar-header-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .calendar-filter-row,
    .task-calendar-grid.week-view {
        grid-template-columns: 1fr;
    }

    .task-calendar-grid.month-view {
        grid-template-columns: 1fr;
    }

    .calendar-weekday {
        display: none;
    }

    .calendar-day-cell {
        min-height: auto;
    }
}

/* Shared pill badge polish for Calendar selected cards */
.selected-day-panel .badge,
.calendar-board-panel .badge {
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    gap: 7px;
    background: rgba(15, 23, 42, .48);
}

.selected-day-panel .badge::before,
.calendar-board-panel .badge::before {
    width: 7px;
    height: 7px;
    box-shadow: 0 0 14px currentColor;
}

.selected-day-panel .badge.priority.medium { color: #F59E0B; border-color: rgba(245,158,11,.48); background: rgba(245,158,11,.10); }
.selected-day-panel .badge.priority.high,
.selected-day-panel .badge.priority.critical { color: #FF4D57; border-color: rgba(239,68,68,.50); background: rgba(239,68,68,.10); }
.selected-day-panel .badge.priority.low { color: #22C55E; border-color: rgba(34,197,94,.38); background: rgba(34,197,94,.10); }
.selected-day-panel .badge.status.new { color: #38BDF8; border-color: rgba(14,165,233,.45); background: rgba(14,165,233,.13); }
.selected-day-panel .badge.status.inprogress { color: #F59E0B; border-color: rgba(245,158,11,.50); background: rgba(245,158,11,.12); }
.selected-day-panel .badge.status.review { color: #A78BFA; border-color: rgba(139,92,246,.45); background: rgba(139,92,246,.12); }
.selected-day-panel .badge.status.blocked { color: #FF4D57; border-color: rgba(239,68,68,.50); background: rgba(239,68,68,.13); }
.selected-day-panel .badge.status.done { color: #22C55E; border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.13); }
