/*
    Global styles for the ASIModule.Reminders components.
    Kept here (instead of scoped .razor.css) because the production
    deployment does not reliably regenerate the Blazor scoped CSS bundle.
    See the "Component CSS in Production" rule in .github/copilot-instructions.md.
*/

/* ---- RemindersModule ---- */

.reminders-content-area {
    padding: 16px;
    min-width: 0;
}

/* ---- RemindersList ---- */
.client-column {
    min-width: 90px;
}

.date-column {
    min-width: 95px;
}

/* Fixed columns total ~650px; the floor keeps Subject/Client from collapsing to 0
   (which made their text spill over the Date column in the "Both" view). */
.reminders-list-table {
    width: 100%;
    min-width: 820px;
    table-layout: fixed;
}

/* Clip every cell except the actions column, whose dropdown must overflow. */
.reminders-list-table > thead > tr > th:not(:last-child),
.reminders-list-table > tbody > tr > td:not(:last-child) {
    overflow: hidden;
}

.reminders-list-table > thead > tr > th:not(:last-child) {
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Pin the floated sort icon to the right of the title so it never wraps below it. */
.reminders-list-table > thead > tr > th:has(> .sort-icon) {
    position: relative;
    padding-left: 0.5rem;
    padding-right: 1.4rem;
}

.reminders-list-table > thead > tr > th > .sort-icon {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    float: none;
}

.reminders-list-table .client-column > small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reminders-list-table .date-column {
    overflow-wrap: anywhere;
}

.reminders-list-table .rl-col-type { width: 190px; }
.reminders-list-table .rl-col-date { width: 210px; }
.reminders-list-table .rl-col-assigned { width: 160px; }
.reminders-list-table .rl-col-actions { width: 90px; }

/* Side-by-side ("Both") pane: tighter fixed columns so Subject/Client keep room; text truncates/wraps. */
.reminders-list-pane .reminders-list-table {
    min-width: 600px;
}

.reminders-list-pane .reminders-list-table .rl-col-type { width: 155px; }
.reminders-list-pane .reminders-list-table .rl-col-date { width: 150px; }
.reminders-list-pane .reminders-list-table .rl-col-assigned { width: 115px; }

.reminder-subject-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reminder-info-header-content {
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: wrap;
}

.reminder-info-header-content > .badge {
    flex-shrink: 0;
}

.reminder-info-title {
    min-width: 0;
    flex: 1 1 240px;
    overflow-wrap: anywhere;
    white-space: normal;
}

.reminder-info-message {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.reminder-assignee-progress {
    border: 1px solid var(--border-color);
    border-radius: var(--bs-border-radius);
    padding: 0.75rem;
}

.reminder-assignee-progress-help {
    cursor: help;
}

.reminder-assignee-progress-list > li + li {
    margin-top: 0.35rem;
}

.reminder-assignee-progress-list > li {
    overflow-wrap: anywhere;
}

.reminder-assignee-progress-status {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    cursor: default;
}

.reminder-assignee-progress-legend {
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
}

.assigned-to-column {
    min-width: 130px;
    max-width: 160px;
    overflow: hidden;
}

.clamp-3 {
    display: -webkit-box;
    width: 100%;
    max-width: 100%;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Allow action dropdown menus to overflow the table container */
.reminders-content-area .table-responsive {
    overflow: visible;
}

.reminders-filter-panel {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease-out, opacity 0.15s ease-out;
}

.reminders-filter-panel.open {
    max-height: 600px;
    opacity: 1;
    transition: max-height 0.35s ease-in, opacity 0.25s ease-in;
}

.reminders-filter-card {
    border: 1px solid var(--theme-border-color, #d9dee6);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.reminders-filter-dropdown {
    z-index: 1060;
    max-height: 180px;
    overflow-y: auto;
    top: 100%;
}

/* ---- Recurrence bubble selectors ---- */

.rrule-day-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.rrule-day-bubble:hover {
    background-color: var(--bg-tertiary);
}

.rrule-day-bubble.selected {
    background-color: var(--primary-color);
    color: var(--text-light);
    border-color: var(--primary-color);
}

.rrule-option-bubble {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border-radius: 1.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8125rem;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.rrule-option-bubble:hover {
    background-color: var(--bg-tertiary);
}

.rrule-option-bubble.selected {
    background-color: var(--primary-color);
    color: var(--text-light);
    border-color: var(--primary-color);
}

/* ---- Calendar color swatches ---- */

.color-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s ease, border-color 0.15s ease;
    flex-shrink: 0;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--text-primary);
}

/* The "auto / default" swatch uses no background, just a border */
.color-swatch-auto {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
}

.color-swatch-auto.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--primary-color);
}

/* ---- View toggle button group ---- */

.reminders-view-toggle .btn-theme {
    border-radius: 0;
}

.reminders-view-toggle .btn-theme:first-child {
    border-radius: var(--bs-border-radius-sm) 0 0 var(--bs-border-radius-sm);
}

.reminders-view-toggle .btn-theme:last-child {
    border-radius: 0 var(--bs-border-radius-sm) var(--bs-border-radius-sm) 0;
}

/* ---- Both-view layout ---- */

/* Stacks on the module's own width: zoom and the side nav change the room the list gets, the window width does not. */
.reminders-both-host {
    container: reminders-both / inline-size;
}

.reminders-both-view {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    min-width: 0;
}

.reminders-calendar-pane {
    flex: 1 1 0;
    min-width: 460px;
}

.reminders-list-pane {
    flex: 1.35 1 0;
    min-width: 0;
    max-height: 75vh;
    overflow-y: auto;
}

/* Stay side by side as long as the calendar min (460px) + gap + a usable list (~500px) fit. */
@container reminders-both (max-width: 1000px) {
    .reminders-both-view {
        flex-direction: column;
    }

    .reminders-calendar-pane,
    .reminders-list-pane {
        flex: none;
        width: 100%;
        min-width: 0;
        max-height: none;
    }
}

/* ---- FullCalendar container ---- */

.reminders-fc-container {
    border: 1px solid var(--border-color);
    border-radius: var(--bs-border-radius);
    padding: 0.75rem;
    background-color: var(--bg-primary);
}

/* ---- FullCalendar theme overrides ---- */

/* Map FC's button CSS variables to our theme tokens */
.reminders-fc-container {
    --fc-border-color:          var(--border-color);
    --fc-page-bg-color:         var(--bg-primary);
    --fc-neutral-bg-color:      var(--bg-secondary, #f8f9fa);
    --fc-today-bg-color:        rgba(var(--bs-primary-rgb), 0.08);
    --fc-button-bg-color:       transparent;
    --fc-button-border-color:   var(--border-color);
    --fc-button-text-color:     var(--text-primary);
    --fc-button-hover-bg-color: var(--bg-secondary, #f8f9fa);
    --fc-button-hover-border-color: var(--border-color);
    --fc-button-active-bg-color:    var(--primary-color);
    --fc-button-active-border-color: var(--primary-color);
    --fc-event-bg-color:        var(--bs-primary);
    --fc-event-border-color:    var(--bs-primary);
    --fc-event-text-color:      var(--text-light);
}

.reminders-fc-container .fc {
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.reminders-fc-container .fc-toolbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.reminders-fc-container .fc-button {
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    border-radius: var(--bs-border-radius-sm) !important;
    box-shadow: none !important;
    text-transform: capitalize;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.reminders-fc-container .fc-button:focus,
.reminders-fc-container .fc-button:focus-visible {
    box-shadow: none !important;
    outline: none !important;
}

.reminders-fc-container .fc-button-active,
.reminders-fc-container .fc-button-active:hover {
    color: var(--text-light) !important;
}

/* Today cell highlight */
.reminders-fc-container .fc-day-today {
    background-color: var(--fc-today-bg-color) !important;
}

/* Day number links */
.reminders-fc-container .fc-daygrid-day-number,
.reminders-fc-container .fc-col-header-cell-cushion {
    color: var(--text-primary);
    text-decoration: none;
}

.reminders-fc-container .fc-daygrid-day-number:hover {
    text-decoration: underline;
}

/* Event pills */
.reminders-fc-container .fc-event {
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    overflow: hidden;
}

.reminders-fc-container .fc-event:hover {
    opacity: 0.88;
}

/* Truncate long event titles */
.reminders-fc-container .fc-event-main-frame,
.reminders-fc-container .fc-event-title-container {
    overflow: hidden;
    min-width: 0;
    display: flex;
    align-items: center;
}

.reminders-fc-container .fc-event-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.fc-recur-badge {
    font-size: 0.65rem;
    opacity: 0.75;
    margin-right: 0.2rem;
    flex-shrink: 0;
}

.fc-complete-badge {
    font-size: 0.75rem;
    color: var(--text-light);
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    margin-right: 0.2rem;
    flex-shrink: 0;
}

.reminders-fc-container .fc-event-time-range {
    font-size: 0.7rem;
    opacity: 0.8;
    margin-left: 0.35rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.reminders-fc-container .fc-event-complete {
    opacity: 0.55;
}

/* While the container width is changing, let FullCalendar's pixel-sized tables follow it natively. */
.reminders-fc-container.fc-width-live .fc-scrollgrid-sync-table,
.reminders-fc-container.fc-width-live .fc-col-header,
.reminders-fc-container.fc-width-live .fc-daygrid-body,
.reminders-fc-container.fc-width-live .fc-timegrid-body,
.reminders-fc-container.fc-width-live .fc-timegrid-body table {
    width: 100% !important;
}

/* ---- Calendar event popup ---- */

.reminders-cal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1054;
}

.reminders-cal-popup {
    position: fixed;
    z-index: 1055;
    width: 240px;
    transform: translateX(-50%);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 0.75rem;
}

.reminders-cal-popup-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reminders-cal-popup-recur {
    font-size: 0.7rem;
    opacity: 0.6;
    vertical-align: middle;
}

.reminders-cal-popup-meta {
    font-size: 0.75rem;
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 0.625rem;
}

.reminders-cal-popup-actions {
    display: flex;
    gap: 0.375rem;
}

.reminders-cal-popup-actions .btn {
    flex: 1;
    font-size: 0.75rem;
    padding: 0.25rem 0.375rem;
    white-space: nowrap;
}

/* Week view time grid */
.reminders-fc-container .fc-timegrid-slot {
    height: 2rem;
}

/* ---- RemindersList container ---- */

.reminders-list-container {
    border: 1px solid var(--border-color);
    border-radius: var(--bs-border-radius);
    padding: 0.75rem;
    background-color: var(--bg-primary);
}

.reminders-list-container .btn:focus,
.reminders-list-container .btn:focus-visible {
    outline: none;
    box-shadow: none;
}
