/**
 * Calendar Booking System Styles
 * Interactive monthly calendar with time slots
 */

/* Global Message Overlay - appears above everything */
.sfb-global-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 600px;
    width: 90%;
    z-index: 999999;
    padding: 20px 50px 20px 25px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    animation: slideDownFadeIn 0.4s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sfb-message-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.1);
    border: none;
    color: inherit;
    font-size: 28px;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    padding: 0;
}

.sfb-message-close:hover {
    background: rgba(0, 0, 0, 0.2);
}

.sfb-message-text {
    flex: 1;
    padding: 0 10px;
}

@keyframes slideDownFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.sfb-calendar-container {
    max-width: 1000px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
}

.sfb-calendar-container h2 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.sfb-field-selector {
    margin-bottom: 20px;
    text-align: center;
}

.sfb-field-selector label {
    font-weight: bold;
    margin-right: 10px;
    color: #333;
}

.sfb-field-selector select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    background: white;
}

.sfb-field-selector select:focus {
    outline: none;
    border-color: #0073aa;
}

.sfb-legend {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.sfb-legend h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

.sfb-legend-items {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.sfb-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
}

.sfb-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.sfb-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
}

.sfb-calendar-header h3 {
    margin: 0;
    color: #333;
    font-size: 24px;
}

.sfb-nav-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.sfb-nav-btn:hover {
    background: #005a87;
}

.sfb-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #ddd;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 20px;
}

.sfb-day-header {
    background: #f8f9fa;
    padding: 15px 5px;
    text-align: center;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.sfb-calendar-day {
    background: white;
    padding: 15px 5px;
    text-align: center;
    cursor: pointer;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.3s ease;
    position: relative;
}

.sfb-calendar-day:hover {
    background: #f0f8ff;
}

.sfb-calendar-day.sfb-current-month {
    color: #333;
}

.sfb-calendar-day:not(.sfb-current-month) {
    color: #ccc;
    background: #f9f9f9;
}

.sfb-calendar-day.sfb-past-date {
    color: #999;
    background: #f5f5f5;
    cursor: not-allowed;
}

.sfb-calendar-day.sfb-past-date:hover {
    background: #f5f5f5;
}

.sfb-calendar-day.sfb-selected {
    background: #0073aa;
    color: white;
    font-weight: bold;
    border: 2px solid #005a87;
    box-shadow: 0 0 10px rgba(0, 115, 170, 0.5);
}

.sfb-calendar-day.sfb-selected:hover {
    background: #005a87;
}

.sfb-calendar-day.sfb-has-bookings::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: #0073aa;
    border-radius: 50%;
}

/* Field indicators for different field types */
.sfb-field-indicator {
    position: absolute;
    bottom: 5px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    z-index: 2;
}

/* Multiple indicators positioning */
.sfb-calendar-day.sfb-has-bookings .sfb-field-indicator:nth-child(1) {
    left: 10px;
}

.sfb-calendar-day.sfb-has-bookings .sfb-field-indicator:nth-child(2) {
    left: 18px;
}

.sfb-calendar-day.sfb-has-bookings .sfb-field-indicator:nth-child(3) {
    left: 26px;
}

/* Enhanced tooltip styles */
.sfb-calendar-day[title] {
    position: relative;
}

.sfb-calendar-day[title]:hover::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: pre-line;
    z-index: 1000;
    min-width: 200px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.sfb-calendar-day[title]:hover::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    pointer-events: none;
}

.sfb-time-slots {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.sfb-time-slots h4 {
    margin-top: 0;
    color: #333;
    text-align: center;
}

.sfb-time-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.sfb-time-slot {
    background: white;
    border: 2px solid #ddd;
    padding: 12px;
    text-align: center;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.sfb-time-slot:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

.sfb-time-slot.sfb-selected {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.sfb-time-slot.sfb-booked {
    background: #f5f5f5;
    color: #999;
    border-color: #ddd;
    cursor: not-allowed;
}

.sfb-time-slot.sfb-booked:hover {
    background: #f5f5f5;
    border-color: #ddd;
}

.sfb-booking-form {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.sfb-booking-form h4 {
    margin-top: 0;
    color: #333;
    text-align: center;
}

.sfb-form {
    display: grid;
    gap: 15px;
}

.sfb-form-group {
    display: flex;
    flex-direction: column;
}

.sfb-form-group label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
}

.sfb-form-group input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.sfb-form-group input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

#selected-slot-info {
    background: white;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #ddd;
    font-size: 14px;
    line-height: 1.5;
}

.sfb-submit-btn,
.sfb-cancel-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin: 5px;
}

.sfb-submit-btn {
    background: #0073aa;
    color: white;
}

.sfb-submit-btn:hover {
    background: #005a87;
}

.sfb-cancel-btn {
    background: #6c757d;
    color: white;
}

.sfb-cancel-btn:hover {
    background: #545b62;
}

.sfb-message {
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
    font-weight: bold;
    text-align: center;
}

/* Message type colors - apply to both global and modal messages */
.sfb-global-message.sfb-success,
.sfb-modal-message.sfb-success,
.sfb-message.sfb-success,
.sfb-success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.sfb-global-message.sfb-error,
.sfb-modal-message.sfb-error,
.sfb-message.sfb-error,
.sfb-error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.sfb-global-message.sfb-info,
.sfb-modal-message.sfb-info,
.sfb-message.sfb-info,
.sfb-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 2px solid #bee5eb;
}

#recaptcha-container {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive design */
@media (max-width: 768px) {
    .sfb-calendar-container {
        margin: 10px;
        padding: 15px;
    }
    
    .sfb-calendar-day {
        min-height: 50px;
        font-size: 14px;
        padding: 10px 2px;
    }
    
    .sfb-time-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .sfb-time-slot {
        padding: 10px;
        font-size: 14px;
    }
    
    .sfb-calendar-header h3 {
        font-size: 20px;
    }
    
    .sfb-nav-btn {
        padding: 8px 12px;
        font-size: 16px;
    }
    
    .sfb-legend-items {
        gap: 15px;
    }
    
    .sfb-legend-item {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .sfb-calendar-container {
        margin: 5px;
        padding: 10px;
    }
    
    .sfb-calendar-day {
        min-height: 40px;
        font-size: 12px;
        padding: 8px 1px;
    }
    
    .sfb-time-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sfb-calendar-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .sfb-calendar-header h3 {
        font-size: 18px;
    }
    
    .sfb-legend-items {
        flex-direction: column;
        gap: 8px;
    }
    
    .sfb-legend-item {
        font-size: 12px;
    }
    
    /* Global message responsive */
    .sfb-global-message {
        top: 10px;
        width: 95%;
        max-width: 95%;
        font-size: 14px;
        padding: 15px 45px 15px 20px;
    }
    
    .sfb-message-close {
        width: 28px;
        height: 28px;
        font-size: 24px;
    }
}

/* Loading states */
.sfb-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.sfb-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: sfb-spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes sfb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility improvements */
.sfb-calendar-day:focus,
.sfb-time-slot:focus,
.sfb-nav-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Modal Styles */
.sfb-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.sfb-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: sfb-modalSlideIn 0.3s ease-out;
}

@keyframes sfb-modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sfb-modal-header {
    background: #0073aa;
    color: white;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sfb-modal-header h3 {
    margin: 0;
    font-size: 24px;
}

.sfb-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.sfb-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Modal Message - appears at top of modal */
.sfb-modal-message {
    margin: 0;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sfb-modal-body {
    padding: 30px;
}

.sfb-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.sfb-form-row:first-child {
    grid-template-columns: 1fr;
}

.sfb-form-group {
    display: flex;
    flex-direction: column;
}

.sfb-form-group label {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.sfb-form-group input,
.sfb-form-group select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    background: white;
}

.sfb-form-group input:focus,
.sfb-form-group select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.sfb-form-group input:invalid {
    border-color: #d63638;
}

.sfb-form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.sfb-submit-btn,
.sfb-cancel-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.sfb-submit-btn {
    background: #0073aa;
    color: white;
}

.sfb-submit-btn:hover {
    background: #005a87;
    transform: translateY(-2px);
}

.sfb-cancel-btn {
    background: #6c757d;
    color: white;
}

.sfb-cancel-btn:hover {
    background: #545b62;
    transform: translateY(-2px);
}

.sfb-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Modal Responsive Design */
@media (max-width: 768px) {
    .sfb-modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .sfb-form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .sfb-modal-body {
        padding: 20px;
    }
    
    .sfb-modal-header {
        padding: 15px;
    }
    
    .sfb-modal-header h3 {
        font-size: 20px;
    }
    
    .sfb-form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .sfb-submit-btn,
    .sfb-cancel-btn {
        width: 100%;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .sfb-modal-content {
        width: 98%;
        margin: 5% auto;
        max-height: 95vh;
    }
    
    .sfb-modal-body {
        padding: 15px;
    }
    
    .sfb-form-group input,
    .sfb-form-group select {
        padding: 10px;
        font-size: 14px;
    }
}
