/* General calendar styles */
.lbc-table { width: 100%; border-collapse: collapse; }
.lbc-table th, .lbc-table td { border: 1px solid #ddd; text-align: center; padding: 8px; }
.lbc-table th { background-color: #f4f4f4; font-weight: bold; }

.slot { cursor: pointer; }
.slot.available { background-color: #d4edda; color: #155724; }
.slot.available:hover { background-color: #c3e6cb; }
.slot.selected { background-color: #007cba !important; color: #fff !important; }
.slot.booked { background-color: #f8d7da; color: #721c24; cursor: not-allowed; }
.slot.unavailable { background-color: #e2e3e5; color: #6c757d; cursor: not-allowed; }

.slot-status {
    font-size: 0.9em;
    pointer-events: none; /* Prevent clicks on the status text */
}

/* Booking modal styles */
#booking-form-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#booking-form-modal .modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 100%;
}

#booking-form-modal .modal-content h2 {
    margin-top: 0;
    font-size: 1.5em;
    text-align: center;
}

#booking-form-modal .modal-content .error-message {
    color: red;
    font-size: 0.9em;
    margin-bottom: 10px;
}

#booking-form-modal .modal-content button {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

#booking-form-modal .modal-content button:hover {
    background: #0056b3;
}

/* Admin Calendar Styles */
.admin-calendar-wrapper {
    max-width: 100%;
    overflow-x: auto;
    margin: 20px 0;
}

.lbc-table.admin {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.lbc-table.admin th {
    background: #f8f9fa;
    padding: 12px 8px;
    text-align: center;
    font-weight: bold;
    border: 1px solid #dee2e6;
    font-size: 14px;
}

.lbc-table.admin td {
    padding: 4px;
    text-align: center;
    border: 1px solid #dee2e6;
    vertical-align: top;
    position: relative;
    min-height: 40px;
    width: 120px;
}

.lbc-table.admin .time-cell {
    background: #f8f9fa;
    font-weight: bold;
    font-size: 12px;
    width: 60px;
    min-width: 60px;
}

.lbc-table.admin .day-header {
    background-color: #e9ecef;
    font-weight: bold;
    width: 160px;
    min-width: 160px;
    font-size: 11px;
    padding: 10px 8px;
}

.lbc-table.admin .empty-cell {
    background-color: #fff;
    height: 60px;
}

.lbc-table.admin .booked-cell {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #fff !important;
    position: relative;
}

.lbc-table.admin .unavailable-cell {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #666 !important;
}

.lbc-table.admin .unknown-cell {
    background-color: #ffeaa7 !important;
    color: #d63031 !important;
}

.lbc-table.admin .booking-info {
    font-size: 11px;
    line-height: 1.2;
    padding: 2px;
}

.lbc-table.admin .booking-info strong {
    display: block;
    margin-bottom: 2px;
}

.lbc-table.admin .booking-info small {
    color: #666;
    font-size: 10px;
}

.lbc-table.admin .session-block {
    position: relative;
    height: 100%;
    min-height: 35px;
    padding: 2px;
}

.calendar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}

/* Cell States */
.lbc-table.admin .empty-cell {
    background-color: #fff;
    height: 60px;
}

.lbc-table.admin .booked-cell {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #fff !important;
    position: relative;
}

.lbc-table.admin .unavailable-cell {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #666 !important;
}

.lbc-table.admin .unknown-cell {
    background-color: #ffeaa7 !important;
    color: #d63031 !important;
}

/* Session Block */
.session-block {
    position: relative;
    padding: 4px;
    min-height: 50px;
    font-size: 11px;
    line-height: 1.3;
}

.booking-info strong {
    font-size: 12px;
}

.booking-info small {
    opacity: 0.9;
}

.year, .exam-board {
    font-size: 10px;
    opacity: 0.8;
}

/* Cancel Button */
/* Cancel button for grouped sessions */
.cancel-group-container {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 20; /* Increased z-index */
}

.lbc-cancel-group {
    display: inline-block;
    padding: 3px 8px;
    background: rgba(214, 48, 49, 0.95);
    color: #fff !important;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    outline: none;
    user-select: none;
}

.lbc-cancel-group:hover {
    background: #d63031 !important;
    transform: scale(1.05);
    color: #fff !important;
}

/* Individual cancel button styling */
.lbc-cancel {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(214, 48, 49, 0.95);
    color: #fff !important;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    z-index: 20; /* Increased z-index */
    text-decoration: none;
    border: none;
    outline: none;
    user-select: none;
}

.lbc-cancel:hover {
    background: #d63031 !important;
    transform: scale(1.1);
    color: #fff !important;
}

/* Ensure session blocks have relative positioning and proper stacking */
.session-block {
    position: relative;
    padding: 4px 24px 4px 4px; /* Add right padding to prevent overlap */
    min-height: 50px;
    font-size: 11px;
    line-height: 1.3;
    z-index: 1;
}

/* Make sure table cells don't interfere with click events */
.lbc-table.admin td {
    position: relative;
}

.lbc-table.admin .booked-cell {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #fff !important;
    position: relative;
    overflow: visible; /* Allow buttons to show outside cell bounds */
}

/* Debug Section */
.debug-section {
    font-family: monospace;
    font-size: 11px;
}

/* Grouped booking styles */
.lbc-table.admin .booked-cell[rowspan] {
    vertical-align: middle;
}

/* Add to your existing CSS */

/* Admin Calendar - Better date headers */
.lbc-table.admin .day-header {
    background-color: #e9ecef;
    font-weight: bold;
    width: 160px;
    min-width: 160px;
    font-size: 11px;
    padding: 10px 8px;
}

/* Selection Summary Styles */
#lbc-selection-summary {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.summary-session {
    transition: all 0.2s ease;
}

.summary-session:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Better button styling */
#show-booking-modal {
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,124,186,0.3);
}

#show-booking-modal:hover {
    background: #005a87 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,124,186,0.4);
}

/* Responsive layout for summary */
@media (max-width: 768px) {
    .summary-session {
        display: block !important;
        margin: 5px 0 !important;
    }
}

/* Add these mobile optimizations: */

@media (max-width: 768px) {
    #booking-form-modal {
        padding: 10px !important;
    }
    
    .modal-content {
        width: 95% !important;
        max-width: none !important;
        margin: 20px auto !important;
    }
    
    #confirm-booking-btn {
        font-size: 16px !important; /* Prevents zoom on iOS */
        min-height: 44px !important; /* Touch target size */
        padding: 12px 20px !important;
    }
    
    /* Prevent double-tap zoom */
    #confirm-booking-btn, input, select, textarea {
        touch-action: manipulation;
    }
    
    /* Loading spinner positioning */
    #booking-progress {
        position: relative;
        z-index: 1000;
    }
}

/* Disable button during processing */
#confirm-booking-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loading spinner styling */
#lbc-booking-spinner {
    display: inline-block;
    margin-left: 10px;
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    0% { opacity: 1; }
    100% { opacity: 0.4; }
}

/* Form validation styling */
.validation-error {
    border: 2px solid #dc3545 !important;
    background-color: #fff5f5 !important;
}

.validation-success {
    border: 2px solid #28a745 !important;
    background-color: #f8fff8 !important;
}

/* Better modal animations */
#booking-form-modal {
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { 
        opacity: 0; 
        transform: scale(0.9);
    }
    to { 
        opacity: 1; 
        transform: scale(1);
    }
}