/* ========== CALENDAR PAGE - TeachComplete ========== */
/* All classes prefixed .cal-* to avoid conflicts */

/* ===== CONTAINER ===== */
.cal-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 1200px;
}

/* ===== TOOLBAR ===== */
.cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-shrink: 0;
    gap: 12px;
}

.cal-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cal-toolbar-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    min-width: 200px;
    letter-spacing: -0.3px;
}

.cal-toolbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cal-week-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
    background: #6366f1;
    border: 1px solid transparent;
    border-radius: 999px;
    line-height: 1;
    white-space: nowrap;
}

.cal-week-badge-readonly {
    cursor: default;
    user-select: none;
}

.cal-week-a {
    background: #059669;
}

.cal-week-b {
    background: #6366f1;
}

.cal-toolbar-btn {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}

.cal-toolbar-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #333;
}

.cal-toolbar-btn.active {
    background: #059669;
    color: #fff;
    border-color: #059669;
}

.cal-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cal-view-select {
    padding: 6px 28px 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    outline: none;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23555' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.cal-view-select:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

.cal-view-select:focus {
    border-color: #059669;
    box-shadow: 0 0 0 2px rgba(5,150,105,0.15);
}

.cal-weekends-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    user-select: none;
    padding: 5px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    transition: all 0.15s;
    white-space: nowrap;
}

.cal-weekends-toggle:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.cal-weekends-toggle input {
    width: 14px;
    height: 14px;
    accent-color: #059669;
    cursor: pointer;
    margin: 0;
}

.cal-add-btn {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #059669;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.cal-add-btn:hover {
    background: #047857;
}

.cal-edit-btn {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.cal-edit-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
}

/* Settings gear — replaces the old "Edit Calendar" text button. Same modal,
   smaller footprint, sits at the far right of the toolbar. */
.cal-settings-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.cal-settings-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
    transform: rotate(35deg);
}
.cal-settings-btn:focus-visible {
    outline: 2px solid #059669;
    outline-offset: 2px;
}

/* ===== MINI POPOVER (Google-style event edit) ===== */
.cal-pop {
    position: fixed;
    z-index: 1000;
    width: 320px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
    overflow: hidden;
    font-size: 13px;
    color: #1f2937;
    animation: cal-pop-in 0.12s ease-out;
}
@keyframes cal-pop-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.cal-pop-hd {
    display: flex;
    justify-content: flex-end;
    gap: 2px;
    padding: 6px 8px;
}
.cal-pop-icon-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.cal-pop-icon-btn:hover { background: rgba(255,255,255,0.3); }
.cal-pop-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cal-pop-title {
    width: 100%;
    border: none;
    border-bottom: 1px solid transparent;
    background: transparent;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    padding: 4px 0;
    outline: none;
    transition: border-color 0.15s;
}
.cal-pop-title:hover { border-bottom-color: #e5e7eb; }
.cal-pop-title:focus { border-bottom-color: #059669; }
.cal-pop-meta {
    font-size: 12px;
    color: #6b7280;
}
.cal-pop-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #374151;
}
.cal-pop-ico { width: 16px; text-align: center; color: #9ca3af; }
.cal-pop-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 2px;
}
.cal-pop-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.cal-pop-select {
    padding: 6px 10px;
    font-size: 13px;
    color: #1f2937;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.cal-pop-select:hover { background: #f3f4f6; }
.cal-pop-select:focus {
    border-color: #059669;
    box-shadow: 0 0 0 2px rgba(5,150,105,0.15);
    background: #fff;
}
.cal-pop-select:disabled {
    color: #9ca3af;
    cursor: not-allowed;
    background: #f3f4f6;
}
.cal-pop-desc {
    font-size: 12px;
    color: #4b5563;
    background: #f9fafb;
    border-radius: 6px;
    padding: 8px 10px;
    line-height: 1.45;
    max-height: 80px;
    overflow: auto;
}
.cal-pop-gcal {
    font-size: 11px;
    color: #059669;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}
.cal-pop-gcal::before {
    content: '\2713';
    font-weight: 700;
}

/* ===== LEGEND / FILTER BAR ===== */
.cal-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
    padding: 8px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: opacity 0.15s, background 0.15s;
    user-select: none;
}

.cal-legend-item:hover {
    background: #e5e7eb;
}

.cal-legend-item.disabled {
    opacity: 0.35;
}

.cal-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ===== MONTH VIEW ===== */
.cal-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    flex: 1;
    min-height: 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.cal-month-header {
    padding: 8px 4px;
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.cal-month-header:not(:last-child) {
    border-right: 1px solid #f0f0f0;
}

.cal-month-cell {
    min-height: 90px;
    padding: 4px 6px;
    border-bottom: 1px solid #f0f0f0;
    border-right: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.1s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cal-month-cell:nth-child(7n) {
    border-right: none;
}

.cal-month-cell:hover {
    background: #f9fafb;
}

.cal-month-cell.cal-other-month {
    background: #fafafa;
}

.cal-month-cell.cal-other-month .cal-month-date {
    color: #ccc;
}

.cal-month-cell.cal-today {
    background: #f0fdf4;
}

.cal-month-date {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 3px;
    line-height: 1;
    padding: 2px;
}

.cal-today .cal-month-date {
    background: #059669;
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-month-events {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.cal-month-event {
    padding: 2px 5px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    line-height: 1.3;
    flex-shrink: 0;
}

.cal-month-event:hover {
    filter: brightness(0.9);
}

.cal-month-more {
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    padding: 1px 4px;
    cursor: pointer;
    flex-shrink: 0;
}

.cal-month-more:hover {
    color: #059669;
}

/* ===== WEEK VIEW ===== */
.cal-week-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.cal-week-header-row {
    display: grid;
    grid-template-columns: 56px repeat(var(--cal-cols, 7), 1fr);
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: #f9fafb;
}

.cal-week-header-gutter {
    padding: 8px 4px;
    border-right: 1px solid #e5e7eb;
}

.cal-week-header-day {
    padding: 8px 6px;
    text-align: center;
    border-right: 1px solid #f0f0f0;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.cal-week-header-day:last-child {
    border-right: none;
}

.cal-week-header-day .cal-week-date-num {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin-top: 2px;
    letter-spacing: -0.5px;
}

.cal-week-header-day.cal-today-col .cal-week-date-num {
    background: #059669;
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Today's column gets a pale tint so the active day reads at a glance
   (was: only the date pill was highlighted, easy to miss). */
.cal-week-col.cal-today-col {
    background: rgba(5, 150, 105, 0.04);
}

/* Empty-week hint banner — sits between legend and the grid, pointing the
   teacher at where to add periods. Render only when no events exist
   anywhere in the visible date range. */
.cal-empty-hint {
    margin: 8px 0 12px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #059669;
    border-radius: 6px;
}
.cal-empty-hint strong {
    color: #1a1a1a;
    font-weight: 700;
}
.cal-empty-hint em {
    font-style: normal;
    font-weight: 600;
    color: #1a1a1a;
}

/* All-day events row */
.cal-allday-row {
    display: grid;
    grid-template-columns: 56px repeat(var(--cal-cols, 7), 1fr);
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    min-height: 0;
}

.cal-allday-row:empty {
    display: none;
}

.cal-allday-gutter {
    padding: 4px;
    font-size: 10px;
    color: #9ca3af;
    border-right: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-allday-cell {
    padding: 3px 4px;
    border-right: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cal-allday-cell:last-child {
    border-right: none;
}

.cal-allday-event {
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* Scrollable time grid */
.cal-week-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.cal-week-grid {
    display: grid;
    grid-template-columns: 56px repeat(var(--cal-cols, 7), 1fr);
    position: relative;
    min-height: 660px; /* 11 hours * 60px/hour */
}

.cal-week-gutter {
    border-right: 1px solid #e5e7eb;
}

.cal-week-gutter-label {
    position: absolute;
    right: 8px;
    font-size: 10px;
    color: #9ca3af;
    line-height: 1;
    transform: translateY(-50%);
    background: #fff;
    padding: 0 2px;
}

.cal-week-col {
    position: relative;
    border-right: 1px solid #f0f0f0;
}

.cal-week-col:last-child {
    border-right: none;
}

.cal-week-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid #f0f0f0;
}

.cal-week-half-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px dashed #f5f5f5;
}

.cal-week-event {
    position: absolute;
    /* left + width are set inline so overlapping events can share a column
       via _calLayoutOverlaps. Single events default to ~full width via the
       sweep algorithm (total=1). */
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    overflow: hidden;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: filter 0.1s;
    line-height: 1.3;
}

.cal-week-event:hover {
    filter: brightness(0.9);
    z-index: 3;
}

/* Deleted-class schedule blocks */
.cal-week-event.cal-deleted {
    background: #9ca3af !important;
    opacity: 0.65;
    border: 1px dashed #6b7280;
}

/* Placeholder schedule blocks (from class.meetsOn — no specific time set yet).
   Dashed border + slight transparency signals "default time, click to lock". */
.cal-week-event.cal-week-event-placeholder {
    opacity: 0.78;
    border: 1px dashed rgba(255, 255, 255, 0.85);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.cal-week-event.cal-week-event-placeholder::before {
    content: 'TBD';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.18);
    padding: 1px 5px;
    border-radius: 3px;
    pointer-events: none;
}

.cal-month-event.cal-deleted {
    background: #9ca3af !important;
    opacity: 0.65;
}

.cal-week-event-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-week-event-time {
    font-size: 10px;
    opacity: 0.85;
    white-space: nowrap;
}

/* Linked-block class header — small uppercase row at the top of any block
   that has a lesson linked. Mirrors the lesson-modal picker so the teacher
   gets the same hierarchy on either surface (CLASS / lesson title / time
   / pills bottom). Hidden on unlinked blocks where the title row already
   carries the class name. */
.cal-week-event-class {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* Bottom-RIGHT U·L pill on linked blocks — code only, no title (title
   moved into the main content row). White-on-translucent so it reads on
   any class color. */
.cal-event-code-pill {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 9px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: 0.3px;
    background: rgba(255, 255, 255, 0.92);
    color: #1f2937;
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    pointer-events: none;
}

/* Bottom-LEFT status pill — color encodes lifecycle state (Draft / Complete
   / Finalized). Slate / light green / dark green palette so a teacher can
   scan a week and see at a glance which lessons are still pending vs
   already pushed vs fully wrapped. */
.cal-event-status-pill {
    position: absolute;
    bottom: 4px;
    left: 4px;
    font-size: 9px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    pointer-events: none;
}
.cal-event-status-pill.cal-status-draft     { background: #e2e8f0; color: #334155; }
.cal-event-status-pill.cal-status-complete  { background: #d1fae5; color: #065f46; }
.cal-event-status-pill.cal-status-finalized { background: #047857; color: #ffffff; }

/* Lesson badge — shown on events linked to a specific TC lesson. Pairs a
   compact U·L code with a truncated lesson-title preview so the teacher can
   recognize what's parked on that slot at a glance. */
.cal-event-lesson-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    margin-bottom: 2px;
    padding: 1px 5px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    color: #fff;
    background: rgba(0, 0, 0, 0.28);
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.cal-event-lesson-code {
    flex-shrink: 0;
    letter-spacing: 0.2px;
}

.cal-event-lesson-title {
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    opacity: 0.95;
}

/* In week view the badge sits above the event title; in narrow columns we
   collapse the title preview so the U·L code still fits. */
.cal-week-event .cal-event-lesson-badge {
    display: inline-flex;
    max-width: calc(100% - 4px);
}

.cal-week-event-narrow .cal-event-lesson-title {
    display: none;
}

/* ----- Schedule occurrence body (lesson link chip + action button) -----
   Recurring schedule blocks can have a TC lesson linked to a specific date.
   When they do, the block grows an in-body status chip and an action button
   underneath the title/time header. Unlinked blocks show a subtle
   "+ Link lesson" affordance instead. All three shapes share vertical
   rhythm with the title/time rows above them. */
.cal-week-event.cal-week-event-sched {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 6px 6px;
}

.cal-sched-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 2px;
    padding: 3px 6px;
    font-size: 10.5px;
    line-height: 1.2;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.28);
    border-radius: 4px;
    max-width: 100%;
}

.cal-sched-chip-code { letter-spacing: 0.2px; }
.cal-sched-chip-sep { opacity: 0.7; font-weight: 400; }
.cal-sched-chip-status {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.cal-sched-chip-title {
    flex-basis: 100%;
    font-weight: 500;
    font-size: 10px;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status-driven chip colors stay inside the block background, but needs-summary
   warms toward amber and finalized cools toward a dimmer grey so the state
   is readable at a glance. */
.cal-sched-needs-summary .cal-sched-chip {
    background: rgba(120, 53, 15, 0.55); /* amber-ish */
}
.cal-sched-finalized .cal-sched-chip {
    background: rgba(0, 0, 0, 0.18);
    color: rgba(255,255,255,0.85);
}

.cal-sched-action-btn {
    align-self: flex-start;
    margin-top: 2px;
    padding: 3px 10px;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--cls-c, #059669);
    background: #fff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    letter-spacing: 0.2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
    transition: transform 0.1s, box-shadow 0.1s;
    font-family: inherit;
}

.cal-sched-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.16);
}

.cal-sched-link-btn {
    align-self: flex-start;
    margin-top: 4px;
    padding: 2px 8px;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    background: rgba(255,255,255,0.22);
    border: 1px dashed rgba(255,255,255,0.55);
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.1s, border-color 0.1s;
}

.cal-sched-link-btn:hover {
    background: rgba(255,255,255,0.32);
    border-color: rgba(255,255,255,0.8);
}

/* Short-slot degradation: on blocks under ~64px tall, we only show the chip
   (or nothing, for unlinked). Hide everything we know we can't fit. */
.cal-week-event-short .cal-sched-action-btn,
.cal-week-event-short .cal-sched-link-btn,
.cal-week-event-short .cal-sched-chip-title {
    display: none;
}

.cal-week-event-short .cal-sched-chip {
    padding: 1px 4px;
    font-size: 10px;
}

/* Link picker modal — small centered sheet with a flat list of the class's
   lessons. Reuses .cal-modal / .cal-modal-overlay for layout parity. */
.cal-modal-picker {
    width: 420px;
    max-width: 90vw;
    max-height: 72vh;
    display: flex;
    flex-direction: column;
}

.cal-picker-list {
    overflow-y: auto;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
}

.cal-picker-row {
    padding: 10px 20px;
    text-align: left;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    color: #1f2937;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f4;
    transition: background 0.12s;
}

.cal-picker-row:hover {
    background: #f3f4f6;
}

.cal-picker-row:last-child {
    border-bottom: none;
}

.cal-picker-unit {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
}

.cal-picker-empty {
    padding: 20px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
}

/* In month + all-day rows the badge sits inline with the title. */
.cal-month-event .cal-event-lesson-badge,
.cal-allday-event .cal-event-lesson-badge {
    margin-right: 4px;
    margin-bottom: 0;
    padding: 0 4px;
    font-size: 9px;
}

.cal-month-event .cal-event-lesson-title,
.cal-allday-event .cal-event-lesson-title {
    display: none;
}

.cal-week-now-line {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 5;
    pointer-events: none;
}

.cal-week-now-line::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -4px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
}

.cal-week-now-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    border-top: 2px solid #ef4444;
}

/* Click/drag target for creating events on empty space */
.cal-week-col-bg {
    position: absolute;
    inset: 0;
    z-index: 1;
    cursor: crosshair;
}

/* Drag-to-create preview */
.cal-drag-preview {
    position: absolute;
    left: 3px;
    right: 3px;
    background: rgba(5, 150, 105, 0.2);
    border: 2px solid rgba(5, 150, 105, 0.6);
    border-radius: 4px;
    z-index: 4;
    pointer-events: none;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 3px 6px;
    box-sizing: border-box;
}

.cal-drag-time {
    font-size: 11px;
    font-weight: 600;
    color: #059669;
    white-space: nowrap;
}

/* ===== EVENT MODAL ===== */
.cal-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: cal-fade-in 0.15s ease;
}

@keyframes cal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cal-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 420px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    animation: cal-slide-up 0.2s ease;
}

.cal-modal.cal-modal-gcal {
    width: 460px;
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
}

@keyframes cal-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Google-style title row */
.cal-gcal-title-row {
    display: flex;
    align-items: center;
    padding: 20px 16px 0 56px;
    gap: 8px;
}

.cal-gcal-title {
    flex: 1;
    font-size: 22px;
    font-weight: 400;
    color: #3c4043;
    border: none;
    border-bottom: 2px solid #e0e0e0;
    outline: none;
    padding: 4px 0 8px;
    font-family: inherit;
    background: transparent;
    transition: border-color 0.2s;
}

.cal-gcal-title::placeholder {
    color: #80868b;
}

.cal-gcal-title:focus {
    border-bottom-color: #059669;
}

.cal-gcal-title-error {
    border-bottom-color: #d93025 !important;
}

.cal-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #5f6368;
    cursor: pointer;
    border: none;
    background: none;
    border-radius: 50%;
    transition: background 0.15s;
    flex-shrink: 0;
}

.cal-modal-close:hover {
    background: #f1f3f4;
}

/* Google-style modal body */
.cal-gcal-body {
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Icon-row layout (Google Calendar style) */
.cal-gcal-row {
    display: flex;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f4;
}

.cal-gcal-row:last-child {
    border-bottom: none;
}

.cal-gcal-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #5f6368;
}

.cal-gcal-icon-top {
    align-items: flex-start;
    padding-top: 8px;
}

.cal-gcal-field {
    flex: 1;
    min-width: 0;
    padding-top: 8px;
}

/* Utility */
.cal-hidden {
    display: none !important;
}

/* Date & time section */
.cal-gcal-datetime {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.cal-gcal-date {
    font-size: 14px;
    font-family: inherit;
    color: #3c4043;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 6px 8px;
    background: transparent;
    cursor: pointer;
    outline: none;
    transition: background 0.15s;
}

.cal-gcal-date:hover {
    background: #f1f3f4;
}

.cal-gcal-date:focus {
    border-color: #059669;
    background: #fff;
}

.cal-gcal-times {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cal-gcal-time-select {
    font-size: 14px;
    font-family: inherit;
    color: #3c4043;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 6px 8px;
    background: transparent;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: background 0.15s;
    min-width: 95px;
}

.cal-gcal-time-select:hover {
    background: #f1f3f4;
}

.cal-gcal-time-select:focus {
    border-color: #059669;
    background: #fff;
    appearance: auto;
    -webkit-appearance: menulist;
}

.cal-gcal-time-dash {
    color: #5f6368;
    font-size: 14px;
    padding: 0 2px;
}

.cal-gcal-duration {
    font-size: 12px;
    color: #70757a;
    padding-left: 4px;
    white-space: nowrap;
}

/* Sub-rows (all-day, recurrence) */
.cal-gcal-sub-row {
    padding-top: 6px;
}

.cal-gcal-allday {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #3c4043;
    cursor: pointer;
    padding: 4px 0;
}

.cal-gcal-allday input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #059669;
    cursor: pointer;
}

.cal-gcal-recurrence {
    font-size: 14px;
    font-family: inherit;
    color: #1a73e8;
    border: none;
    background: transparent;
    cursor: pointer;
    outline: none;
    padding: 4px 0;
    appearance: none;
    -webkit-appearance: none;
}

.cal-gcal-recurrence:hover {
    text-decoration: underline;
}

.cal-gcal-recurrence:focus {
    appearance: auto;
    -webkit-appearance: menulist;
    color: #3c4043;
    padding: 4px 8px;
    border: 1px solid #dadce0;
    border-radius: 4px;
}

/* Text inputs (location, etc.) */
.cal-gcal-text-input {
    width: 100%;
    font-size: 14px;
    font-family: inherit;
    color: #3c4043;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    outline: none;
    padding: 4px 0 8px;
    background: transparent;
    transition: border-color 0.2s;
}

.cal-gcal-text-input::placeholder {
    color: #80868b;
}

.cal-gcal-text-input:focus {
    border-bottom-color: #059669;
}

/* Select inputs (class, lesson) */
.cal-gcal-select {
    width: 100%;
    font-size: 14px;
    font-family: inherit;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 8px 10px;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}

.cal-gcal-select:focus {
    border-color: #059669;
    box-shadow: 0 0 0 2px rgba(5,150,105,0.12);
}

/* Textarea (description) */
.cal-gcal-textarea {
    width: 100%;
    font-size: 14px;
    font-family: inherit;
    color: #3c4043;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    outline: none;
    padding: 4px 0 8px;
    background: transparent;
    resize: vertical;
    min-height: 48px;
    transition: border-color 0.2s;
}

.cal-gcal-textarea::placeholder {
    color: #80868b;
}

.cal-gcal-textarea:focus {
    border-bottom-color: #059669;
}

/* Notification items */
.cal-notif-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.cal-notif-select {
    flex: 1;
    font-size: 14px;
    font-family: inherit;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 6px 8px;
    background: #fff;
    cursor: pointer;
    outline: none;
}

.cal-notif-select:focus {
    border-color: #059669;
}

.cal-notif-remove {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: #5f6368;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.15s;
    flex-shrink: 0;
}

.cal-notif-remove:hover {
    background: #f1f3f4;
    color: #d93025;
}

.cal-gcal-add-link {
    font-size: 14px;
    color: #1a73e8;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    font-family: inherit;
}

.cal-gcal-add-link:hover {
    text-decoration: underline;
}

/* Color picker swatches */
.cal-color-swatches {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 2px 0;
}

.cal-color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    outline: none;
    transition: transform 0.1s;
}

.cal-color-swatch:hover {
    transform: scale(1.2);
}

.cal-color-swatch.active {
    border-color: #3c4043;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #3c4043;
}

/* Footer */
.cal-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
}

.cal-modal-footer-left {
    display: flex;
}

.cal-modal-footer-right {
    display: flex;
    gap: 8px;
}

.cal-btn-delete {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #d93025;
    background: none;
    border: 1px solid #dadce0;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.cal-btn-delete:hover {
    background: #fce8e6;
    border-color: #d93025;
}

.cal-btn-cancel {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #3c4043;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.cal-btn-cancel:hover {
    background: #f1f3f4;
}

.cal-btn-save {
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: #059669;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.cal-btn-save:hover {
    background: #047857;
}

/* Legacy modal classes kept for schedule block modal */
.cal-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.cal-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
}

.cal-modal-body:not(.cal-gcal-body) {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cal-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cal-form-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.cal-form-input {
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
}

.cal-form-input:focus {
    border-color: #059669;
    box-shadow: 0 0 0 2px rgba(5,150,105,0.15);
}

.cal-form-row {
    display: flex;
    gap: 12px;
}

.cal-form-row .cal-form-group {
    flex: 1;
}

.cal-form-select {
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #1a1a1a;
    outline: none;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
}

.cal-form-select:focus {
    border-color: #059669;
    box-shadow: 0 0 0 2px rgba(5,150,105,0.15);
}

.cal-form-textarea {
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #1a1a1a;
    outline: none;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.cal-form-textarea:focus {
    border-color: #059669;
    box-shadow: 0 0 0 2px rgba(5,150,105,0.15);
}

.cal-form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
}

.cal-form-checkbox input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #059669;
}

/* ===== EMPTY STATE ===== */
.cal-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #9ca3af;
    text-align: center;
}

.cal-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.cal-empty-text {
    font-size: 14px;
    color: #6b7280;
}
