* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-height: 100vh;
    background-image: url('Apple.jpg') !important;
    background-repeat: repeat;
    background-size: 150px 150px;
    opacity: 0.3;
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

header {
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
}

.header-nav-dropdown {
    padding: 10px 15px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s;
    justify-self: start;
}

.header-nav-dropdown:hover {
    border-color: #3788d8;
}

.header-nav-dropdown:focus {
    outline: none;
    border-color: #3788d8;
}

.header-content {
    text-align: center;
}

header h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2em;
}

header p {
    color: #666;
    font-size: 1em;
}

.header-login-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    justify-self: end;
}

.header-login-status {
    font-size: 12px;
    color: #666;
    text-align: right;
}

.header-login-btn {
    padding: 10px 20px;
    background: #3788d8;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.header-login-btn:hover {
    background: #2d6fb8;
}

#calendar {
    margin: 0 auto;
    max-width: 100%;
}

.fc .fc-button {
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 6px;
}

.fc .fc-button-group .fc-button {
    margin-right: 6px;
}

.fc .fc-button:last-child {
    margin-right: 0;
}

.fc .fc-toolbar-title {
    font-size: 1.5em;
}

.fc-event {
    cursor: pointer;
}

.fc-event:hover {
    opacity: 0.85;
}

/* Make event dots smaller */
.fc-daygrid-event-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    border-width: 2px !important;
    box-sizing: border-box !important;
    margin-right: 1px !important;
}

.fc-list-event-dot {
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    border-width: 6px !important;
    box-sizing: border-box !important;
    margin-right: 8px !important;
}

/* Styled roster member name in events */
.fc-event-title {
    display: inline-block;
    font-size: 10px;
    line-height: 1.2;
    font-weight: 500;
}

.fc-event-title span {
    display: inline-block;
    margin-left: 2px;
    font-size: 10px;
    padding: 1px 4px;
    font-weight: 600;
    letter-spacing: 0.1px;
}

/* Improve event text readability */
.fc-event {
    font-size: 10px;
    line-height: 1.2;
    padding: 1px 3px;
}

.fc-event-main {
    font-size: 10px;
    line-height: 1.2;
}

/* Better text sizing for day grid events */
.fc-daygrid-event {
    font-size: 10px;
    line-height: 1.1;
    padding: 1px 3px;
    min-height: 14px;
    margin-bottom: 1px !important;
    margin-top: 0 !important;
}

.fc-daygrid-event-dot {
    margin-right: 1px !important;
}

/* Improve readability on mobile */
@media (max-width: 768px) {
    .fc-event-title {
        font-size: 10px !important;
        line-height: 1.2;
    }
    
    .fc-event-title span {
        font-size: 10px !important;
        padding: 1px 4px !important;
        font-weight: 600;
    }
    
    .fc-event {
        font-size: 10px;
        line-height: 1.2;
        padding: 1px 2px;
    }
    
    .fc-daygrid-event {
        font-size: 10px;
        line-height: 1.1;
        padding: 1px 2px;
        min-height: 14px;
        margin-bottom: 1px !important;
        margin-top: 0 !important;
    }
    
    /* Ensure event text doesn't get cut off */
    .fc-daygrid-event-frame {
        overflow: visible;
    }
    
    /* Mobile: ensure dots display properly when text is hidden */
    .fc-daygrid-event .fc-event-title {
        display: none !important;
    }
    
    /* Ensure proper spacing between dots on mobile */
    .fc-daygrid-event > div[style*="display: flex"] {
        gap: 3px !important;
    }
}

@media (max-width: 480px) {
    .fc-event-title {
        font-size: 9px !important;
        line-height: 1.2;
    }
    
    .fc-event-title span {
        font-size: 9px !important;
        padding: 1px 3px !important;
        font-weight: 600;
    }
    
    .fc-event {
        font-size: 9px;
        line-height: 1.2;
        padding: 1px 2px;
    }
    
    .fc-daygrid-event {
        font-size: 9px;
        line-height: 1.1;
        padding: 1px 2px;
        min-height: 12px;
        margin-bottom: 1px !important;
        margin-top: 0 !important;
    }
}


/* Calendar day cells - default to default cursor */
.fc-day {
    cursor: default;
    transition: background-color 0.2s;
}

/* Only show pointer cursor and hover effect when calendar is interactive */
#calendar.interactive .fc-day {
    cursor: pointer;
}

#calendar.interactive .fc-day:hover {
    background-color: #f0f0f0;
}

/* All departments calendar - non-interactive */
#calendar.non-interactive .fc-event {
    cursor: default;
}

#calendar.non-interactive .fc-event:hover {
    opacity: 1;
}

#calendar.non-interactive .fc-day {
    cursor: default;
}

#calendar.non-interactive .fc-day:hover {
    background-color: transparent;
}

/* Highlighted calendar day cells */
.fc-day-highlighted {
    background-color: #fff3cd !important;
    border: 2px solid #ffc107 !important;
    box-shadow: inset 0 0 0 1px #ffc107 !important;
}

.fc-day-highlighted:hover {
    background-color: #ffe69c !important;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    /* Ensure the main details modal always sits above calendar popovers */
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e5e5e5;
}

.modal-header h2 {
    color: #333;
    font-size: 1.5em;
}

.close {
    font-size: 24px;
    color: #999;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

/* Read-only view event modal */
.view-event-body {
    padding: 20px 25px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.view-event-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    color: #333;
}

.view-event-label {
    min-width: 110px;
    font-weight: 600;
    color: #111827;
}

.view-event-value {
    flex: 1;
}

.view-event-description-row {
    flex-direction: column;
}

.view-event-description {
    margin-top: 4px;
    padding: 10px 12px;
    border-radius: 6px;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    font-size: 14px;
    white-space: pre-wrap;
}

.view-event-login-hint {
    margin-top: 8px;
    font-size: 13px;
    color: #6b7280;
}

@media (max-width: 480px) {
    .view-event-body {
        padding: 16px 18px 20px;
        gap: 10px;
    }

    .view-event-row {
        flex-direction: column;
        gap: 4px;
    }

    .view-event-label {
        min-width: auto;
    }
}

form {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    resize: vertical;
}

/* Color Picker */
.color-picker-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

input[type="color"] {
    width: 60px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.color-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-preset {
    width: 36px;
    height: 36px;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
}

.color-preset:hover {
    border-color: #333;
}

.color-preset.active {
    border-color: #333;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #e5e5e5;
    color: #333;
}

.btn-secondary:hover {
    background: #d4d4d4;
}

.btn-delete {
    background: #dc2626;
    color: white;
}

.btn-delete:hover {
    background: #b91c1c;
}

.btn-delete.hidden {
    display: none;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.form-actions-right {
    display: flex;
    gap: 10px;
}

/* Login Page */
.login-container {
    max-width: 450px;
    margin: 80px auto;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2em;
}

.login-header p {
    color: #666;
    font-size: 1em;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    margin-top: 10px;
}

.login-btn:hover {
    background: #5568d3;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
        overflow-x: hidden;
    }

    .container {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        padding: 15px;
        box-shadow: none;
    }

    header {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .header-login-container,
    .header-nav-dropdown {
        justify-self: center;
    }

    .header-login-container {
        align-items: center;
    }

    header h1 {
        font-size: 1.5em;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
    }

    .form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .form-actions-right {
        width: 100%;
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .header-login-btn,
    .header-nav-dropdown {
        width: auto;
        min-width: 120px;
        font-size: 13px;
        padding: 10px 14px;
    }

    .fc .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .fc .fc-toolbar-chunk {
        width: 100%;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .fc .fc-button {
        padding: 8px 12px;
        font-size: 12px;
    }

    .fc .fc-button-group {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .department-legend {
        margin-left: -12px;
        margin-right: -12px;
        padding: 12px;
    }

    .legend-section {
        margin-left: -12px;
        margin-right: -12px;
        padding: 12px;
    }

    header h1 {
        font-size: 1.3em;
    }

    .header-login-btn,
    .header-nav-dropdown {
        min-width: 100px;
        padding: 9px 12px;
        font-size: 12px;
    }

    .fc .fc-button {
        padding: 7px 10px;
        font-size: 12px;
    }

    .fc .fc-toolbar-title {
        font-size: 1.2em;
    }
}

/* Mobile-friendly "more" link styling for multiple events */
.fc-daygrid-more-link {
    font-size: 9px !important;
    padding: 1px 3px !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    display: inline-block !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
}

@media (max-width: 768px) {
    .fc-daygrid-more-link {
        font-size: 9px !important;
        padding: 1px 3px !important;
        font-weight: 600;
        letter-spacing: 0px;
        line-height: 1.2 !important;
    }
    
    /* Ensure the more link doesn't get cut off */
    .fc-daygrid-day-frame {
        overflow: visible !important;
    }
    
    .fc-daygrid-day-events {
        min-height: auto !important;
    }
    
    /* Prevent text truncation in day cells */
    .fc-daygrid-day-bottom {
        overflow: visible !important;
    }
    
    .fc-daygrid-day {
        overflow: visible !important;
    }
}

@media (max-width: 480px) {
    .fc-daygrid-more-link {
        font-size: 8px !important;
        padding: 1px 2px !important;
        letter-spacing: 0px;
        line-height: 1.2 !important;
    }
    
    /* Make day cells taller on very small screens */
    .fc-daygrid-day-frame {
        min-height: 130px !important;
    }
    
    /* Prevent text truncation in events */
    .fc-daygrid-event-title {
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow: visible !important;
    }
}

/* Prevent text truncation in calendar events */
.fc-daygrid-event-title {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

/* Ensure event containers don't cut off text */
.fc-daygrid-event-frame {
    overflow: visible !important;
}

.fc-daygrid-day-events {
    overflow: visible !important;
    gap: 0 !important;
}

/* Reduce spacing between event entries */
.fc-daygrid-day-events .fc-daygrid-event {
    margin-bottom: 1px !important;
    margin-top: 0 !important;
}

/* Improve minimum cell height for better text display */
.fc-daygrid-day-frame {
    min-height: 180px;
}

/* Significantly taller cells for all-departments page on desktop */
.department-legend ~ #calendar .fc-daygrid-day-frame {
    min-height: 200px;
}

@media (max-width: 768px) {
    .fc-daygrid-day-frame {
        min-height: 150px;
    }
    
    /* Keep normal height on mobile for all-departments */
    .department-legend ~ #calendar .fc-daygrid-day-frame {
        min-height: 150px;
    }
}

/* Department Legend (for all-departments page) */
.department-legend {
    margin-bottom: 30px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

.department-legend h2 {
    color: #333;
    font-size: 1.3em;
    margin: 0 0 12px 0;
}

.department-legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.department-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    font-weight: 500;
}

.department-legend-item:hover {
    background: #e9ecef;
    border-color: #3788d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

.department-legend-item-active {
    background: #3788d8;
    border-color: #3788d8;
    border-width: 2px;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 6px rgba(55, 136, 216, 0.4);
}

.department-legend-item-active .department-legend-name {
    color: white;
}

.department-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.department-legend-name {
    color: #333;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .department-legend {
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
        padding: 12px;
    }

    .department-legend-items {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 6px;
    }

    .department-legend-item {
        padding: 8px 12px;
        gap: 6px;
    }

    .department-legend-dot {
        width: 12px;
        height: 12px;
    }

    .department-legend-name {
        font-size: 12px;
    }
}

/* Legend Section (for department pages - roster) */
.legend-section {
    margin-bottom: 30px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

.legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.legend-header h2 {
    color: #333;
    font-size: 1.3em;
    margin: 0;
}

.legend-edit-btn {
    padding: 8px 16px;
    font-size: 14px;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    transition: all 0.2s;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    font-weight: 500;
}

.legend-item-editable {
    cursor: pointer;
}

.legend-item-editable:hover {
    background: #e9ecef;
    border-color: #3788d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

.legend-item:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.legend-item-color {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.legend-item-name {
    color: #333;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.legend-item-name[onclick] {
    cursor: pointer;
    transition: color 0.2s;
}

.legend-item-name[onclick]:hover {
    color: #3788d8;
}

.legend-item-name.highlightable {
    cursor: pointer;
    transition: color 0.2s;
}

.legend-item-name.highlightable:hover {
    color: #3788d8;
}

.legend-item-highlighted {
    background: #fff3cd !important;
    border-color: #ffc107 !important;
    border-width: 2px !important;
}


.legend-item-actions {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.legend-item-edit-btn,
.legend-item-delete-btn {
    padding: 4px 8px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    display: none;
}

.legend-item-edit-btn {
    background: #667eea;
    color: white;
}

.legend-item-edit-btn:hover {
    background: #5568d3;
}

.legend-item-delete-btn {
    background: #dc2626;
    color: white;
}

.legend-item-delete-btn:hover {
    background: #b91c1c;
}

.legend-empty {
    color: #666;
    font-style: italic;
    padding: 10px;
}

.legend-add-item-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 10px;
}

.legend-add-item-btn:hover {
    background: #5568d3;
}

.legend-add-item-btn::before {
    content: '+';
    font-size: 18px;
    font-weight: bold;
}

@media (max-width: 768px) {
    .legend-section {
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
        padding: 12px;
    }

    .legend-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .legend-edit-btn {
        width: 100%;
    }

    .legend-items {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 6px;
    }

    .legend-item {
        padding: 8px 12px;
        gap: 6px;
    }

    .legend-item-color {
        width: 16px;
        height: 16px;
    }

    .legend-item-name {
        font-size: 12px;
    }
}

/* Print styles - only show the calendar */
@media print {
    @page {
        margin: 0.15in !important;
        size: landscape;
    }
    
    /* Hide everything except the calendar */
    header,
    .legend-section,
    .department-legend,
    .header-nav-dropdown,
    .header-login-container,
    .modal,
    .btn,
    button {
        display: none !important;
    }
    
    /* Show print header with department name */
    .print-header {
        display: block !important;
        text-align: center;
        margin-top: 0 !important;
        margin-bottom: 1px !important;
        padding-top: 0 !important;
        padding-bottom: 1px !important;
        border-bottom: 1px solid #333;
        line-height: 1 !important;
    }
    
    .print-header h1 {
        font-size: 10px !important;
        color: #333;
        margin: 0;
        font-weight: bold;
        line-height: 1 !important;
    }
    
    /* Make calendar month/year title smaller in print */
    .fc-toolbar-title {
        font-size: 9px !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
        line-height: 1 !important;
    }
    
    /* Reduce spacing in calendar toolbar for print */
    .fc-toolbar {
        margin-bottom: 0 !important;
        padding: 0 !important;
        min-height: 12px !important;
        max-height: 12px !important;
    }
    
    /* Hide toolbar buttons in print to save space */
    .fc-button-group,
    .fc-button {
        display: none !important;
    }
    
    /* Keep only the title visible and centered */
    .fc-toolbar {
        display: flex !important;
        justify-content: center !important;
    }
    
    .fc-toolbar-chunk {
        flex: 0 0 auto !important;
    }
    
    /* Show only the calendar */
    #calendar {
        display: block !important;
    }
    
    /* Remove background and shadows for cleaner print */
    body::before {
        display: none !important;
    }
    
    body {
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }
    
    .container {
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        height: 550px !important;
        max-height: 550px !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }
    
    /* Force calendar to fit page height - landscape is ~612px, minus margins = ~550px */
    #calendar {
        width: 100% !important;
        max-width: 100% !important;
        height: 520px !important;
        max-height: 520px !important;
        overflow: visible !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Ensure FullCalendar root elements don't cut off content */
    .fc,
    .fc-view-harness,
    .fc-view-harness-active {
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }
    
    /* Ensure header section doesn't get cut off */
    .fc-scrollgrid-section {
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }
    
    .fc-scrollgrid-section > table {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
    }
    
    /* Reduce calendar table spacing for print */
    .fc-daygrid-body {
        margin: 0 !important;
    }
    
    .fc-scrollgrid {
        border-spacing: 0 !important;
        border-collapse: collapse !important;
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Ensure all 7 columns fit - each gets equal width */
    .fc-scrollgrid-sync-table {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .fc-col-header-cell,
    .fc-daygrid-day {
        width: 14.2857% !important; /* 100% / 7 days = exactly 14.2857% */
        min-width: 0 !important;
        max-width: 14.2857% !important;
        box-sizing: border-box !important;
    }
    
    /* Ensure Saturday column is fully visible */
    .fc-col-header-cell:last-child,
    .fc-daygrid-day:last-child {
        width: 14.2857% !important;
        max-width: 14.2857% !important;
        overflow: visible !important;
    }
    
    .fc-col-header {
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }
    
    .fc-col-header-cell {
        padding: 1px !important;
        font-size: 7px !important;
        line-height: 1 !important;
        height: 12px !important;
        overflow: visible !important;
        width: 14.2857% !important;
        max-width: 14.2857% !important;
        box-sizing: border-box !important;
    }
    
    .fc-col-header-cell-cushion {
        padding: 0 !important;
        font-size: 7px !important;
        overflow: visible !important;
        white-space: nowrap !important;
    }
    
    /* Ensure header row is fully visible */
    .fc-scrollgrid-section-header {
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }
    
    .fc-scrollgrid-section-header table {
        width: 100% !important;
        table-layout: fixed !important;
    }
    
    /* Prevent page breaks within calendar */
    .fc-daygrid-body,
    .fc-scrollgrid-section {
        page-break-inside: avoid !important;
    }
    
    /* Force calendar table to fit height */
    .fc-scrollgrid {
        height: 520px !important;
        max-height: 520px !important;
    }
    
    .fc-scrollgrid-sync-table {
        height: 520px !important;
    }
    
    .fc-daygrid-body {
        height: 500px !important;
        max-height: 500px !important;
        width: 100% !important;
    }
    
    .fc-daygrid-body tr {
        height: 30px !important;
    }
    
    .fc-daygrid-body td {
        width: 14.28% !important;
        overflow: visible !important;
    }
    
    /* Ensure event names are visible when printing - override mobile styles */
    .fc-event-title,
    .fc-event-title span,
    .fc-daygrid-event-title,
    .fc-daygrid-event .fc-event-title {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        font-size: 6px !important;
        white-space: normal !important;
        overflow: visible !important;
        line-height: 1 !important;
    }
    
    /* Show any text content in event containers */
    .fc-daygrid-event > div {
        display: flex !important;
    }
    
    .fc-daygrid-event > div > span {
        display: inline-block !important;
    }
    
    /* Make sure event text content is visible */
    .fc-event-main,
    .fc-event-main-frame {
        display: block !important;
        visibility: visible !important;
    }
    
    /* Much smaller day cell height for print to fit on one page - calculate for 5-6 rows */
    .fc-daygrid-day-frame {
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        overflow: hidden !important;
    }
    
    /* Reduce table cell padding for print */
    .fc-daygrid-day {
        padding: 0 !important;
        height: 30px !important;
        vertical-align: top !important;
        width: 14.28% !important;
        overflow: visible !important;
    }
    
    .fc-daygrid-day-top {
        padding: 0 2px !important;
        font-size: 7px !important;
        line-height: 1 !important;
        height: 10px !important;
    }
    
    .fc-daygrid-day-number {
        padding: 0 1px !important;
        font-size: 7px !important;
    }
    
    /* Make events more compact when printing */
    .fc-daygrid-event {
        font-size: 6px !important;
        padding: 0 1px !important;
        height: 8px !important;
        min-height: 8px !important;
        max-height: 8px !important;
        margin-bottom: 0 !important;
        margin-top: 0 !important;
        line-height: 1 !important;
    }
    
    /* Reduce event dot size for print */
    .fc-daygrid-event-dot {
        width: 3px !important;
        height: 3px !important;
        margin-right: 1px !important;
    }
    
    /* Ensure event containers don't hide text */
    .fc-daygrid-event-frame {
        overflow: visible !important;
        padding: 0 !important;
    }
    
    .fc-daygrid-day-events {
        overflow: visible !important;
        gap: 0 !important;
        margin-top: 0 !important;
        padding: 0 1px !important;
    }
    
    /* Reduce spacing between event entries when printing */
    .fc-daygrid-day-events .fc-daygrid-event {
        margin-bottom: 0 !important;
        margin-top: 0 !important;
    }
    
    /* Remove any extra spacing */
    .fc-daygrid-day-bottom {
        height: 0 !important;
        min-height: 0 !important;
        display: none !important;
    }
    
    .fc-scrollgrid-sync-table {
        height: 100% !important;
    }
    
    /* Ensure rows distribute evenly */
    .fc-daygrid-body tr {
        height: 30px !important;
    }
    
    .fc-daygrid-body td {
        height: 30px !important;
    }
}

/* Print header - hidden by default, shown only when printing */
.print-header {
    display: none;
}

