.calendar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-radius: 12px;
    box-sizing: border-box;
    overflow: hidden;
}

.calendar-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    width: 100%;
    position: relative;
    padding-bottom: 10px;
}

.calendar-toolbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #cbd5e1;
}

body[data-theme="dark"] .calendar-toolbar::after {
    background-color: rgba(255, 255, 255, 0.2) !important;
}

.calendar-nav-wrapper {
    width: auto !important;
    padding-bottom: 0 !important;
}

.calendar-nav-wrapper::after {
    display: none !important;
}

.settings-title {
    font-size: 28px !important;
    font-weight: 300 !important;
    color: #6f6a6a !important;
    margin-bottom: 20px !important;
    top: 13px;
    left: 0px;
    position: relative !important;
    display: inline-block !important;
    z-index: 1 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.calendar-title-display h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 500;
    color: #3c4043;
}

.calendar-view-modes {
    display: flex;
    gap: 8px;
}

.calendar-view-modes button.active {
    background: #e8f0fe;
    color: #1a73e8;
    border-color: #1a73e8;
    font-weight: 600;
}

.calendar-main-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.calendar-hours-grid {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex: 1;
    padding-right: 5px;
}

.calendar-day-row {
    display: flex;
    align-items: stretch;
    gap: 24px;
    min-height: 90px;
    border-bottom: 1px solid #f1f3f4;
}

.calendar-events-container .calendar-event-badge {
    width: 100%;
    max-width: 236px;
    min-height: 75px;
}

.calendar-time-col {
    width: 65px;
    text-align: right;
    user-select: none;
    padding-top: 10px;
}

.calendar-time-col.full-hour { font-size: 18px; font-weight: 600; color: #3c4043; }
.calendar-time-col.half-hour { font-size: 13px; font-weight: 400; color: #70757a; }

.calendar-events-container {
    flex: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 2px 2px;
}

.calendar-events-container:hover { background-color: #f8f9fa; }

.calendar-month-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    border: 1px solid #9c8a8c;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: none;
    border: 1px solid #b2b1b080;
}

.calendar-month-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid #b2b1b080;
    background: #ffffff;
}

.weekday-head {
    text-align: center;
    padding: 14px 0;
    font-size: 13px;
    font-weight: 600;
    color: #5c4b4d;
    border-right: 1px solid #9c8a8c;
}

.weekday-head:last-child { border-right: none; }

.calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(0, 1fr);
    flex: 1;
    min-height: 0;
    background-color: #eae7e6;
    gap: 4px;
    padding: 4px;
}

.calendar-month-day {
    padding: 6px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
    background: #ffffff;
    transition: background-color 0.2s ease;
    border-radius: 4px;
    min-height: 0;
    overflow: hidden;
}

.calendar-month-day:hover {
    background-color: rgba(0, 0, 0, 0.01);
}

.month-day-number {
    font-size: 13px;
    font-weight: 600;
    color: #5c4b4d;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    user-select: none;
    border-radius: 50%;
}

.calendar-month-day.other-month {
    opacity: 0.35;
}

.calendar-month-day.today .month-day-number {
    background: #5c4b4d;
    color: #ffffff;
    font-weight: bold;
}

.month-day-events {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    min-height: 0;
    padding-right: 2px;
}

.month-day-events::-webkit-scrollbar {
    width: 4px;
}

.month-day-events::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.calendar-event-badge {
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    overflow: hidden;
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
    user-select: none;
    transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.month-day-events .calendar-event-badge {
    width: 100%;
    flex-shrink: 0;
}

.season-spring .calendar-month-weekdays { background: #e8f5e9; }
.season-spring .calendar-month-day { background: #f1f8f3; }
.season-spring .calendar-event-badge {
    background: #c8e6c9;
    color: #1b5e20;
    border-left: 4px solid #4caf50;
    box-shadow: 0 2px 5px rgba(76, 175, 80, 0.15);
}
.season-spring .calendar-event-badge:hover {
    background-color: #a5d6a7;
    transform: translateY(-1px);
}

.season-summer .calendar-month-weekdays { background: #fff3e0; }
.season-summer .calendar-month-day { background: #fffde7; }
.season-summer .calendar-event-badge {
    background: #ffe082;
    color: #5d4037;
    box-shadow: 0 2px 5px rgba(255, 179, 0, 0.2);
}
.season-summer .calendar-event-badge:hover {
    background-color: #ffd54f;
    transform: translateY(-1px);
}

.season-autumn .calendar-month-weekdays { background: #fbe9e7; }
.season-autumn .calendar-month-day { background: #fdf5e6; }
.season-autumn .calendar-event-badge {
    background: #e7e7ed61;
    color: #e65100;
    border-left: 4px solid #ff9800;
    box-shadow: 0 2px 5px rgba(255, 152, 0, 0.2);
}
.season-autumn .calendar-event-badge:hover {
    background-color: #ffb74d;
    transform: translateY(-1px);
}

.season-winter .calendar-month-weekdays { background: #eceff1; }
.season-winter .calendar-month-day { background: #f0f4f8; }
.season-winter .calendar-event-badge {
    background: #bde5f8;
    color: #004085;
    border-left: 4px solid #007bff;
    box-shadow: 0 2px 5px rgba(0, 123, 255, 0.15);
}
.season-winter .calendar-event-badge:hover {
    background-color: #96d3f2;
    transform: translateY(-1px);
}

.calendar-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(32, 33, 36, 0.6);
    z-index: 200000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-modal-content {
    background: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: none;
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
}

.calendar-modal-content h3 { margin-top: 0; margin-bottom: 20px; font-size: 17px; font-weight: 500; color: #202124; }

#calendar-modal-input {
    width: 100%;
    border: none;
    border-bottom: 2px solid #1a73e8;
    padding: 8px 0;
    font-size: 15px;
    color: #202124;
    box-sizing: border-box;
    margin-bottom: 24px;
}

#calendar-modal-input:focus { outline: none; border-bottom-color: #185abc; }
.calendar-modal-actions { display: flex; justify-content: flex-end; gap: 12px; }
.btn-modal-primary { background: #1a73e8; color: #ffffff; border: none; padding: 8px 20px; border-radius: 4px; font-size: 14px; font-weight: 500; cursor: pointer; }
.btn-modal-primary:hover { background: #1557b0; }
.btn-modal-secondary { background: transparent; color: #5f6368; border: 1px solid #dadce0; padding: 8px 20px; border-radius: 4px; font-size: 14px; font-weight: 500; cursor: pointer; }
.btn-modal-secondary:hover { background: #f8f9fa; color: #202124; }

.calendar-month-day.has-course {
    background-color: var(--course-color) !important;
}

.calendar-month-day.has-course .month-day-number {
    color: #1f2937 !important;
}

.calendar-event-badge.course-special-badge {
    background-color: transparent !important;
    color: #1f2937 !important;
    border-left: none !important;
    box-shadow: none !important;
    font-weight: 600 !important;
}

.calendar-event-tooltip {
    position: fixed;
    z-index: 999999;
    background: #1e293b;
    color: #f8fafc;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    max-width: 280px;
    word-wrap: break-word;
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.calendar-event-tooltip .tooltip-title {
    font-weight: 700;
    font-size: 13px;
    color: #38bdf8;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 4px;
}

.calendar-event-tooltip .tooltip-row {
    margin-bottom: 3px;
}

.calendar-event-tooltip .tooltip-row strong {
    color: #cbd5e1;
}

.calendar-event-tooltip .tooltip-comment {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(255, 255, 255, 0.2);
    font-style: italic;
    color: #e2e8f0;
}

.modal-hidden {
    display: none;
}

.modal-content-wide {
    max-width: 500px;
}

.modal-form-container {
    gap: 10px;
    margin-bottom: 20px;
    text-align: left;
    display: flex;
    flex-direction: column;
}

.modal-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.modal-student-label, .modal-student-select {
    display: none;
}

.modal-input-full {
    max-width: 100%;
    box-sizing: border-box;
}

.modal-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.modal-checkbox {
    width: 16px;
    height: 16px;
}

.modal-recurring-container {
    margin-top: 5px;
}

.modal-comment-label {
    margin-top: 10px;
}

.modal-textarea {
    max-width: 100%;
    height: 60px;
    resize: none;
    box-sizing: border-box;
}

.calendar-title-display {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-prev {
    transform: scaleX(-1);
}

.btn-delete-event {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
    align-items: center;
    justify-content: center;
}

.custom-colored-badge {
    color: #1f2937;
    border-left: 4px solid rgba(0, 0, 0, 0.2);
    font-weight: 600;
}

.calendar-event-badge.badge-has-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 8px;
}

.badge-text-content {
    flex: 1;
    overflow: hidden;
}

.badge-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-left: 10px;
    flex-shrink: 0;
}

.badge-action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: inherit;
    transition: background-color 0.2s, color 0.2s;
}

.badge-action-btn svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.2px;
}

.badge-edit-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.badge-del-btn:hover {
    background-color: #fee2e2;
    color: #991b1b;
}

.btn-row-add-note {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-top: 6px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    border-radius: 4px;
    color: #70757a;
    transition: background-color 0.2s, color 0.2s;
}

.btn-row-add-note:hover {
    background-color: #f1f3f4;
    color: #1a73e8;
}

.calendar-event-badge {
    border-left: none !important;
}

.custom-colored-badge {
    border-left: none !important;
}

.calendar-main-content .calendar-event-badge.note-badge-display {
    background-color: #f8fafc !important;
    color: #334155 !important;
    border: 1px solid #e2e8f0 !important;
    border-left: none !important;
    box-shadow: none !important;
    font-weight: 500;
}

.calendar-main-content .calendar-event-badge.note-badge-display:hover {
    background-color: #f1f5f9 !important;
}

.calendar-events-container {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.calendar-events-container .calendar-event-badge {
    width: 100%;
    max-width: 350px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.calendar-modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

.calendar-modal-actions button,
.calendar-modal-actions .btn-modal-secondary,
.calendar-modal-actions .btn-settings-action,
.calendar-modal-actions .btn-modal-primary {
    box-sizing: border-box !important;
    height: 40px !important;
    padding: 0 20px !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    line-height: 1 !important;
    vertical-align: middle !important;
}

#dashboard-section[data-theme="dark"] .calendar-overlay,
body[data-theme="dark"] .calendar-overlay,
[data-theme="dark"] .calendar-overlay {
    background: rgb(58 68 81 / 91%) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(181, 174, 174, 0.2) !important;
    box-shadow: 16px 16px 24px rgba(0, 0, 0, 0.95) !important;
    color: #f3f4f6 !important;
}

#dashboard-section[data-theme="dark"] .calendar-title-display,
#dashboard-section[data-theme="dark"] .calendar-title-display h2,
#dashboard-section[data-theme="dark"] .btn-calendar-nav,
body[data-theme="dark"] .calendar-title-display,
body[data-theme="dark"] .calendar-title-display h2,
body[data-theme="dark"] .btn-calendar-nav,
[data-theme="dark"] .calendar-title-display * {
    color: #f3f4f6 !important;
    stroke: #f3f4f6 !important;
}

#dashboard-section[data-theme="dark"] .calendar-view-modes button,
body[data-theme="dark"] .calendar-view-modes button {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #f3f4f6 !important;
}

#dashboard-section[data-theme="dark"] .calendar-view-modes button.active,
body[data-theme="dark"] .calendar-view-modes button.active {
    background: #3b82f6 !important;
    color: #ffffff !important;
    border-color: #3b82f6 !important;
}

#dashboard-section[data-theme="dark"] .calendar-day-row,
body[data-theme="dark"] .calendar-day-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

#dashboard-section[data-theme="dark"] .calendar-time-col,
#dashboard-section[data-theme="dark"] .calendar-time-col.full-hour,
#dashboard-section[data-theme="dark"] .calendar-time-col.half-hour,
#dashboard-section[data-theme="dark"] .btn-row-add-note,
body[data-theme="dark"] .calendar-time-col,
body[data-theme="dark"] .calendar-time-col.full-hour,
body[data-theme="dark"] .calendar-time-col.half-hour,
body[data-theme="dark"] .btn-row-add-note {
    color: #cbd5e1 !important;
    stroke: #cbd5e1 !important;
}

#dashboard-section[data-theme="dark"] .calendar-events-container:hover,
#dashboard-section[data-theme="dark"] .calendar-month-day:hover,
body[data-theme="dark"] .calendar-events-container:hover,
body[data-theme="dark"] .calendar-month-day:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

#dashboard-section[data-theme="dark"] .calendar-modal-content,
body[data-theme="dark"] .calendar-modal-content,
[data-theme="dark"] .calendar-modal-content,
.calendar-modal .calendar-modal-content {
    background: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #f3f4f6 !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5) !important;
}

#dashboard-section[data-theme="dark"] .calendar-modal-content h3,
#dashboard-section[data-theme="dark"] .modal-label,
#dashboard-section[data-theme="dark"] .modal-checkbox-label,
body[data-theme="dark"] .calendar-modal-content h3,
body[data-theme="dark"] .modal-label,
body[data-theme="dark"] .modal-checkbox-label,
[data-theme="dark"] .calendar-modal-content h3,
[data-theme="dark"] .modal-label,
[data-theme="dark"] .modal-checkbox-label {
    color: #f3f4f6 !important;
}

#dashboard-section[data-theme="dark"] .calendar-modal-content input,
#dashboard-section[data-theme="dark"] .calendar-modal-content select,
#dashboard-section[data-theme="dark"] .calendar-modal-content textarea,
#dashboard-section[data-theme="dark"] #calendar-modal-input,
body[data-theme="dark"] .calendar-modal-content input,
body[data-theme="dark"] .calendar-modal-content select,
body[data-theme="dark"] .calendar-modal-content textarea,
body[data-theme="dark"] #calendar-modal-input,
[data-theme="dark"] .calendar-modal-content input,
[data-theme="dark"] .calendar-modal-content select,
[data-theme="dark"] .calendar-modal-content textarea {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #f3f4f6 !important;
    border-radius: 6px !important;
}

#dashboard-section[data-theme="dark"] .calendar-modal-content option,
body[data-theme="dark"] .calendar-modal-content option,
[data-theme="dark"] .calendar-modal-content option {
    background: #0f172a !important;
    color: #f3f4f6 !important;
}

#dashboard-section[data-theme="dark"] .btn-modal-primary,
body[data-theme="dark"] .btn-modal-primary,
[data-theme="dark"] .btn-modal-primary {
    background: #3b82f6 !important;
    color: #ffffff !important;
    border: none !important;
}

#dashboard-section[data-theme="dark"] .btn-modal-secondary,
body[data-theme="dark"] .btn-modal-secondary,
[data-theme="dark"] .btn-modal-secondary {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f3f4f6 !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

#dashboard-section[data-theme="dark"] .btn-delete-event,
body[data-theme="dark"] .btn-delete-event,
[data-theme="dark"] .btn-delete-event {
    background-color: rgba(239, 68, 68, 0.2) !important;
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
}

#dashboard-section[data-theme="dark"] .calendar-month-wrapper,
#dashboard-section[data-theme="dark"] .calendar-month-weekdays,
#dashboard-section[data-theme="dark"] .calendar-month-day,
body[data-theme="dark"] .calendar-month-wrapper,
body[data-theme="dark"] .calendar-month-weekdays,
body[data-theme="dark"] .calendar-month-day {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

#dashboard-section[data-theme="dark"] .weekday-head,
#dashboard-section[data-theme="dark"] .month-day-number,
body[data-theme="dark"] .weekday-head,
body[data-theme="dark"] .month-day-number {
    color: #f3f4f6 !important;
}

#dashboard-section[data-theme="dark"] .calendar-month-grid,
body[data-theme="dark"] .calendar-month-grid {
    background-color: rgba(0, 0, 0, 0.2) !important;
}

#dashboard-section[data-theme="dark"] .season-spring .calendar-month-weekdays,
#dashboard-section[data-theme="dark"] .season-summer .calendar-month-weekdays,
#dashboard-section[data-theme="dark"] .season-autumn .calendar-month-weekdays,
#dashboard-section[data-theme="dark"] .season-winter .calendar-month-weekdays,
body[data-theme="dark"] .season-spring .calendar-month-weekdays,
body[data-theme="dark"] .season-summer .calendar-month-weekdays,
body[data-theme="dark"] .season-autumn .calendar-month-weekdays,
body[data-theme="dark"] .season-winter .calendar-month-weekdays {
    background: rgba(255, 255, 255, 0.08) !important;
}

#dashboard-section[data-theme="dark"] .season-spring .calendar-month-day,
#dashboard-section[data-theme="dark"] .season-summer .calendar-month-day,
#dashboard-section[data-theme="dark"] .season-autumn .calendar-month-day,
#dashboard-section[data-theme="dark"] .season-winter .calendar-month-day,
body[data-theme="dark"] .season-spring .calendar-month-day,
body[data-theme="dark"] .season-summer .calendar-month-day,
body[data-theme="dark"] .season-autumn .calendar-month-day,
body[data-theme="dark"] .season-winter .calendar-month-day {
    background: rgba(255, 255, 255, 0.05) !important;
}