/* Kals Calendar Styles */
.kals-calendar-wrapper {
    max-width: 100%;
    margin: 0 auto;
}

.calendar-grid {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
}

.calendar-month-year {
    background: #224B9F;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    width: 100%;
    box-sizing: border-box;
}

.month-title {
    flex: 1;
    text-align: center;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
}

/* Elementor compatibility and button overrides */
.kals-calendar-wrapper .btn-nav,
.kals-calendar-wrapper .btn-nav:link,
.kals-calendar-wrapper .btn-nav:visited {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 0.375rem !important;
    cursor: pointer !important;
    transition: all 0.15s ease-in-out !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    text-align: center !important;
    text-decoration: none !important;
    vertical-align: middle !important;
    user-select: none !important;
    min-width: 4rem !important;
    height: 2.5rem !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
    outline: none !important;
    flex-shrink: 0 !important;
}

.kals-calendar-wrapper .btn-nav:hover,
.kals-calendar-wrapper .btn-nav:focus {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    transform: translateY(-1px) !important;
    text-decoration: none !important;
    outline: none !important;
}

.kals-calendar-wrapper .btn-nav:active {
    transform: translateY(0) !important;
    background: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    text-decoration: none !important;
    outline: none !important;
}

.kals-calendar-wrapper .btn-nav svg {
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    fill: currentColor !important;
}

.calendar-week-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #e9ecef;
    width: 100%;
}

.calendar-day-header {
    padding: 0.75rem;
    text-align: center;
    font-weight: bold;
    color: #495057;
    border-right: 1px solid #dee2e6;
    box-sizing: border-box;
}

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

.calendar-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #dee2e6;
    width: 100%;
}

.calendar-day {
    background: white;
    min-height: 120px;
    padding: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.calendar-day:hover {
    background: #f8f9fa;
}

.calendar-day.empty {
    background: #f8f9fa;
    cursor: default;
}

.calendar-day.empty:hover {
    background: #f8f9fa;
}

.day-number {
    font-weight: bold;
    color: #495057;
    margin-bottom: 0.25rem;
    flex-shrink: 0;
    line-height: 1.2;
}

.courses-container {
    flex: 1;
    overflow-y: auto;
    margin-top: 0.25rem;
    display: flex;
    flex-direction: column;
}

.course-item {
    background: #224B9F;
    color: white;
    padding: 0.2rem 0.4rem;
    margin-bottom: 0.2rem;
    border-radius: 0.2rem;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    word-wrap: break-word;
    hyphens: auto;
    line-height: 1.1;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.course-item:hover {
    background: #1a3d85;
}

.course-item small {
    display: block;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Modal customizations */
.modal-lg {
    max-width: 900px;
}

.modal-body {
    text-align: left;
    padding: 1.5rem;
}

.modal-body h4 {
    color: #224B9F;
    margin-bottom: 1rem;
    text-align: left;
}

.modal-body h5,
.modal-body h6 {
    color: #495057;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    text-align: left;
}

/* Force modal close button styling - Bootstrap 5 - Override Elementor */
.modal-header .btn-close,
.modal-header .btn-close:hover,
.modal-header .btn-close:focus,
.modal-header .btn-close:active,
.modal .btn-close,
.modal .btn-close:hover,
.modal .btn-close:focus,
.modal .btn-close:active {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    opacity: 0.5 !important;
    padding: 0.5rem !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    font-size: 1.25rem !important;
    /* Keep default background for visibility */
    /* Override Elementor button styles */
    background-color: transparent !important;
    color: inherit !important;
    text-decoration: none !important;
    border-radius: 0 !important;
    transform: none !important;
    transition: opacity 0.15s ease-in-out !important;
}

.modal-header .btn-close:hover,
.modal .btn-close:hover {
    opacity: 0.75 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background-color: transparent !important;
    color: inherit !important;
    text-decoration: none !important;
    transform: none !important;
}

.modal-header .btn-close:focus,
.modal .btn-close:focus {
    opacity: 1 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background-color: transparent !important;
    color: inherit !important;
    text-decoration: none !important;
    transform: none !important;
}

.modal-header .btn-close:active,
.modal .btn-close:active {
    opacity: 1 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background-color: transparent !important;
    color: inherit !important;
    text-decoration: none !important;
    transform: none !important;
}

/* Force modal close button styling - Bootstrap 4 fallback */
.modal-header .close,
.modal-header .close:hover,
.modal-header .close:focus,
.modal-header .close:active,
.modal .close,
.modal .close:hover,
.modal .close:focus,
.modal .close:active {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    opacity: 0.5 !important;
    padding: 0.5rem !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    font-size: 1.5rem !important;
    color: #000 !important;
    text-shadow: none !important;
    /* Override Elementor button styles */
    text-decoration: none !important;
    border-radius: 0 !important;
    transform: none !important;
    transition: opacity 0.15s ease-in-out !important;
}

.modal-header .close:hover,
.modal .close:hover {
    opacity: 0.75 !important;
    color: #000 !important;
    background-color: transparent !important;
    text-decoration: none !important;
    transform: none !important;
}

.course-description {
    padding: 1rem;
    background: #f8f9fa;
    border-left: 4px solid #224B9F;
    border-radius: 0.25rem;
    line-height: 1.6;
}

.course-description p {
    margin-bottom: 0.5rem;
}

.course-description p:last-child {
    margin-bottom: 0;
}

.course-details {
    border-top: 1px solid #dee2e6;
    padding-top: 1.5rem;
}

.detail-item {
    display: block;
    text-align: left;
    margin-bottom: 1rem;
}

.detail-item strong {
    color: #495057;
    font-weight: 600;
    display: inline;
    margin-right: 0.5rem;
}

.detail-item .text-muted {
    color: #6c757d !important;
    font-size: 0.95rem;
    line-height: 1.4;
    margin-top: 0;
    display: inline;
}

.session-date {
    padding: 0.25rem 0;
    border-bottom: 1px solid #f1f1f1;
    font-size: 0.9rem;
}

.session-date:last-child {
    border-bottom: none;
}

.instructor-bio,
.additional-info {
    border-top: 1px solid #e9ecef;
    padding-top: 1rem;
}

.instructor-bio .text-muted,
.additional-info .text-muted {
    line-height: 1.6;
}

/* Ensure all modal text is left-aligned */
.modal-body * {
    text-align: left;
}

.modal-body .text-center {
    text-align: center !important;
}

/* Day events modal styling */
.day-events-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.day-event-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: all 0.2s ease;
}

.day-event-item:hover {
    background: #e9ecef;
    border-color: #224B9F;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(34, 75, 159, 0.1);
}

.day-event-item .event-title {
    font-weight: 500;
    color: #495057;
    flex: 1;
    line-height: 1.4;
}

.day-event-item .event-arrow {
    color: #224B9F;
    font-weight: bold;
    font-size: 1.2rem;
    margin-left: 1rem;
    transition: transform 0.2s ease;
}

.day-event-item:hover .event-arrow {
    transform: translateX(3px);
}

/* Mobile and tablet specific styling */
@media (max-width: 1024px) {
    .day-event-item {
        padding: 0.875rem;
    }
    
    .day-event-item .event-title {
        font-size: 0.95rem;
    }
    
    .day-events-list {
        gap: 0.5rem;
    }
}

/* Responsive styles */
@media (max-width: 768px) {
    .calendar-month-year {
        flex-direction: row;
        padding: 0.75rem;
        font-size: 1.25rem;
    }
    
    .month-title {
        font-size: 1.25rem;
    }
    
    .btn-nav {
        min-width: 3rem !important;
        height: 2rem !important;
        padding: 0.375rem 0.5rem !important;
        font-size: 0.8rem !important;
    }
    
    .btn-nav svg {
        width: 14px !important;
        height: 14px !important;
    }
    
    .calendar-day {
        min-height: 80px;
        padding: 0.25rem;
    }
    
    .calendar-day-header {
        padding: 0.5rem 0.25rem;
        font-size: 0.875rem;
    }
    
    .course-item {
        font-size: 0.65rem;
        padding: 0.15rem 0.3rem;
        margin-bottom: 0.15rem;
    }
    
    .day-number {
        font-size: 0.875rem;
        margin-bottom: 0.2rem;
    }
    
    .courses-container {
        margin-top: 0.2rem;
    }
}

@media (max-width: 576px) {
    .calendar-month-year {
        padding: 0.5rem;
        font-size: 1rem;
    }
    
    .month-title {
        font-size: 1rem;
    }
    
    .btn-nav {
        min-width: 2.5rem !important;
        height: 1.75rem !important;
        padding: 0.25rem 0.4rem !important;
        font-size: 0.75rem !important;
    }
    
    .btn-nav svg {
        width: 12px !important;
        height: 12px !important;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 0.2rem;
    }
    
    .calendar-day-header {
        padding: 0.4rem 0.1rem;
        font-size: 0.75rem;
    }
    
    .course-item {
        font-size: 0.6rem;
        padding: 0.1rem 0.25rem;
        margin-bottom: 0.1rem;
    }
    
    .day-number {
        font-size: 0.75rem;
        margin-bottom: 0.15rem;
    }
    
    .courses-container {
        margin-top: 0.15rem;
    }
}

/* Print styles */
@media print {
    .calendar-header {
        display: none;
    }
    
    .calendar-grid {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .course-item {
        background: #f0f0f0 !important;
        color: #000 !important;
        border: 1px solid #ccc;
    }
}

/* Loading spinner */
.calendar-loading {
    text-align: center;
    padding: 2rem;
}

.calendar-loading::after {
    content: '';
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility improvements */
.calendar-day:focus {
    outline: 2px solid #007bff;
    outline-offset: -2px;
}

.course-item:focus {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .calendar-day {
        border: 1px solid #000;
    }
    
    .course-item {
        border: 1px solid #000;
    }
    
    .calendar-day-header {
        border: 1px solid #000;
    }
}
