/* frontend/src/styles/components/calendar-modal.css
   Calendar modal dialog: overlay, header, tabs, body, and list items */

/* ── Modal ──────────────────────────────────────────────────────── */
.cal-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 51, 53, 0.38);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.cal-modal {
    background: var(--surface-container-lowest);
    border-radius: 10px;
    width: min(480px, 92vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px -6px rgba(45, 51, 53, 0.22);
}

.cal-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 10px;
    flex-shrink: 0;
}
.cal-modal-header h3 {
    font-family: var(--font-headline);
    font-size: 0.9375rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--on-surface);
    margin: 0;
}

.cal-modal-close {
    background: none;
    border: var(--ghost-border);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    cursor: pointer;
    color: var(--on-surface-variant);
    line-height: 1;
}
.cal-modal-close:hover {
    background: var(--surface-container);
    color: var(--on-surface);
}

/* Tab underline is functional (active indicator), not decorative — kept */
.cal-modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--surface-container-high);
    padding: 0 18px;
    flex-shrink: 0;
}

.cal-modal-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 12px;
    font-family: var(--font-headline);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--on-surface-variant);
    cursor: pointer;
    margin-bottom: -1px;
    transition: color 80ms ease;
}
.cal-modal-tab--active { color: var(--primary); border-bottom-color: var(--primary); }

.cal-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
}

/* Existing panel fills the body and lets only the list scroll */
.cal-modal-panel--existing {
    flex: 1;
    min-height: 0;
}
.cal-modal-panel--existing .cal-modal-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.cal-modal-panel { display: flex; flex-direction: column; gap: 10px; }
.cal-modal-panel[hidden] { display: none; }

/* Form fields — ghost-border (interactive) */
.cal-modal-input {
    width: 100%;
    border: var(--ghost-border);
    border-radius: 5px;
    padding: 8px 10px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    background: var(--surface-container-low);
    color: var(--on-surface);
    box-sizing: border-box;
}
.cal-modal-input:focus { outline: 2px solid var(--primary); border-color: transparent; }

.cal-modal-list { display: flex; flex-direction: column; gap: 4px; }

/* Search input — flex-shrink: 0 keeps it pinned above the scrolling list */
.cal-modal-search { flex-shrink: 0; }

/* Subject group sticky headers */
.cal-modal-group-header {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 6px 0 3px;
    font-family: var(--font-headline);
    font-size: 0.625rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--on-surface-variant);
    background: var(--surface-container-lowest);
    border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 20%, transparent);
    margin-bottom: 4px;
}

/* List items are interactive → ghost-border + subject accent on left */
.cal-modal-list-item {
    background: var(--surface-container-low);
    border: var(--ghost-border);
    border-left: 3px solid var(--item-accent, #9CA3AF);
    border-radius: 5px;
    padding: 9px 12px;
    font-family: var(--font-headline);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    text-align: left;
    color: var(--on-surface);
    transition: background 80ms ease;
}
.cal-modal-list-item:hover {
    background: var(--secondary-container);
    color: var(--primary);
}

.cal-modal-redirect-desc {
    margin: 0 0 12px;
    color: var(--on-surface-variant);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    line-height: 1.5;
}

.cal-modal-redirect-btn {
    width: 100%;
    padding: 9px;
    background: var(--primary);
    color: var(--surface-container-lowest);
    border: none;
    border-radius: 5px;
    font-family: var(--font-headline);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 80ms ease;
}
.cal-modal-redirect-btn:hover { background: var(--primary-dim); }
