/* ===================================
   Advanced Calendar Booking System
   =================================== */

.calendar-booking {
    margin-top: 40px;
}

.booking-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 50px;
    padding: 30px;
    background: #fafafa;
    border-radius: 0;
    box-shadow: none;
    border: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dark);
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.filter-group select {
    padding: 16px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-dark);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.12);
    background: #fffef9;
}

.filter-group select:hover:not(:disabled) {
    border-color: var(--primary-color);
}

/* Calendar Navigation */
.calendar-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    padding: 20px 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
}

.calendar-nav-btn {
    background: transparent;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
}

.calendar-nav-btn:hover {
    transform: none;
    background: var(--text-dark);
    color: white;
    border-color: var(--text-dark);
}

.calendar-nav-btn:active {
    transform: none;
}

.calendar-nav-btn:disabled {
    background: transparent;
    color: var(--border-color);
    border-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.calendar-current-view {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.3px;
    flex: 1;
    padding: 0 20px;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.calendar-day {
    background: var(--bg-white);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.calendar-day:hover {
    box-shadow: var(--shadow);
    transform: translateY(-3px);
    border-color: var(--primary-color);
}

.calendar-day-header {
    background: var(--bg-light);
    color: var(--text-dark);
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.calendar-day-header::before {
    display: none;
}

@keyframes shimmer {
    0%, 100% { transform: translate(-50%, -50%); }
    50% { transform: translate(-30%, -30%); }
}

.calendar-day-name {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 6px;
    opacity: 0.7;
}

.calendar-day-date {
    font-size: 1.4rem;
    font-weight: 400;
    text-shadow: none;
    color: var(--text-dark);
}

.calendar-day-slots {
    padding: 22px;
    max-height: 450px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar */
.calendar-day-slots::-webkit-scrollbar {
    width: 6px;
}

.calendar-day-slots::-webkit-scrollbar-track {
    background: transparent;
    margin: 10px 0;
}

.calendar-day-slots::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-color), var(--accent-color));
    border-radius: 10px;
}

.calendar-day-slots::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-color), var(--primary-color));
}

/* Fade effect at bottom when scrollable */
.calendar-day-slots::after {
    content: '';
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to top, white, transparent);
    pointer-events: none;
    display: block;
    margin-top: -30px;
}

/* Time Slots */
.time-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-white);
    position: relative;
    box-shadow: none;
}

.time-slot:last-child {
    margin-bottom: 0;
}

.time-slot.available {
    border-color: var(--border-color);
    background: #ffffff;
}

.time-slot.available:hover {
    background: var(--text-dark);
    border-color: var(--text-dark);
    transform: none;
    box-shadow: none;
}

.time-slot.available:hover .slot-time,
.time-slot.available:hover .slot-status {
    color: white;
}

.time-slot.booked {
    border-color: var(--border-color);
    background: #fafafa;
    cursor: not-allowed;
    opacity: 0.5;
}

.time-slot.selected {
    background: var(--text-dark);
    border-color: var(--text-dark);
    box-shadow: none;
    transform: none;
}

.time-slot.selected .slot-time,
.time-slot.selected .slot-status {
    color: white;
}

.slot-time {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dark);
    transition: var(--transition);
    letter-spacing: 0;
}

.slot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.slot-status.available-status {
    color: #5a9d5a;
}

.slot-status.booked-status {
    color: var(--text-light);
}

.slot-icon {
    display: none;
}

/* Load More Button */
.load-more-slots {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

.load-more-slots:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(212, 175, 55, 0.05);
}

/* No slots message */
.no-slots {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.no-slots-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.3;
}

.no-slots-text {
    font-size: 1rem;
}

/* Confirmation Modal */
.booking-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.booking-modal.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.booking-modal-content {
    background: #ffffff;
    border-radius: 0;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    padding: 0;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border-color);
}

.booking-modal-content::before {
    display: none;
}

/* Modal scrollbar */
.booking-modal-content::-webkit-scrollbar {
    width: 6px;
}

.booking-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.booking-modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-color), var(--accent-color));
    border-radius: 10px;
}

.booking-modal-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-color), var(--primary-color));
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.booking-modal-header {
    text-align: left;
    padding: 30px 35px 25px;
    background: #ffffff;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    color: var(--text-dark);
    z-index: 10;
}

.modal-close-btn:hover {
    background: var(--bg-light);
    transform: none;
    border-color: var(--text-dark);
}

.booking-modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--text-dark);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
    font-weight: 400;
}

.booking-modal-header p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.booking-details {
    background: #fafafa;
    padding: 25px 35px;
    margin: 0;
    border-top: none;
    border-bottom: 1px solid var(--border-color);
}

.booking-detail-item {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.booking-detail-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.booking-detail-item:first-child {
    padding-top: 0;
}

.booking-detail-icon {
    font-size: 1.3rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border-radius: 0;
    flex-shrink: 0;
    box-shadow: none;
    border: 1px solid var(--border-color);
}

.booking-detail-info {
    flex: 1;
}

.booking-detail-info strong {
    display: block;
    color: #666;
    font-size: 0.8rem;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.booking-detail-info span {
    color: var(--text-dark);
    font-size: 1.05rem;
    font-weight: 500;
}

.booking-form-fields {
    display: grid;
    gap: 20px;
    padding: 30px 40px;
}

.booking-form-fields .form-group {
    display: flex;
    flex-direction: column;
}

.booking-form-fields label {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.booking-form-fields input,
.booking-form-fields textarea {
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 16px; /* Prevent zoom on iOS */
    transition: all 0.3s ease;
    background: white;
    -webkit-appearance: none;
    appearance: none;
}

.booking-form-fields input:focus,
.booking-form-fields textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.12);
    background: #fffef9;
}

.booking-form-fields input::placeholder,
.booking-form-fields textarea::placeholder {
    color: #aaa;
}

.booking-form-fields textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.6;
}

/* Better touch targets for mobile */
@media (hover: none) and (pointer: coarse) {
    .booking-form-fields input,
    .booking-form-fields textarea {
        min-height: 48px; /* Minimum touch target size */
    }

    .booking-modal-btn {
        min-height: 48px;
    }
}

.booking-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 0 40px 35px;
}

.booking-modal-btn {
    padding: 14px 30px;
    border: 1px solid var(--border-color);
    border-radius: 0;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.booking-modal-btn.confirm {
    background: var(--text-dark);
    color: white;
    box-shadow: none;
    border-color: var(--text-dark);
}

.booking-modal-btn.confirm:hover {
    transform: none;
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.booking-modal-btn.confirm:active {
    transform: none;
}

.booking-modal-btn.cancel {
    background: white;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.booking-modal-btn.cancel:hover {
    background: var(--bg-light);
    border-color: var(--text-dark);
}

/* Loading State */
.calendar-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .calendar-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .booking-filters {
        grid-template-columns: 1fr;
        padding: 25px 20px;
    }
}

@media (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: 1fr;
    }

    .calendar-navigation {
        padding: 15px 20px;
    }

    .calendar-current-view {
        font-size: 0.95rem;
        padding: 0 10px;
    }

    .calendar-nav-btn {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .booking-modal {
        padding: 10px;
        align-items: flex-start;
        overflow-y: auto;
        padding-top: 20px;
    }

    .booking-modal-content {
        width: 95%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px;
        margin: auto;
    }

    .booking-modal-header {
        padding: 25px 20px 15px;
    }

    .booking-modal-header h3 {
        font-size: 1.5rem;
    }

    .booking-modal-header p {
        font-size: 0.85rem;
    }

    .modal-close-btn {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .booking-details {
        padding: 20px;
    }

    .booking-detail-item {
        gap: 15px;
        padding: 12px 0;
    }

    .booking-detail-icon {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }

    .booking-detail-info strong {
        font-size: 0.75rem;
    }

    .booking-detail-info span {
        font-size: 0.95rem;
    }

    .booking-form-fields {
        padding: 20px;
        gap: 18px;
    }

    .booking-form-fields label {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }

    .booking-form-fields input,
    .booking-form-fields textarea {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .booking-modal-actions {
        grid-template-columns: 1fr;
        padding: 0 20px 25px;
        gap: 12px;
    }

    .booking-modal-btn {
        padding: 14px 25px;
        font-size: 0.85rem;
    }

    .booking-filters {
        padding: 20px;
        gap: 18px;
    }

    .filter-group label {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }

    .filter-group select {
        padding: 14px 16px;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .booking-modal {
        padding: 5px;
    }

    .booking-modal-content {
        width: 98%;
        border-radius: 12px;
        margin-top: auto;
        margin-bottom: auto;
    }

    .booking-modal-header {
        padding: 20px 15px 12px;
    }

    .booking-modal-header h3 {
        font-size: 1.3rem;
    }

    .booking-details {
        padding: 18px 15px;
    }

    .booking-detail-icon {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .booking-form-fields {
        padding: 18px 15px;
        gap: 16px;
    }

    .booking-form-fields input,
    .booking-form-fields textarea {
        padding: 11px 13px;
        font-size: 0.9rem;
    }

    .booking-modal-actions {
        padding: 0 15px 20px;
    }

    .booking-modal-btn {
        padding: 13px 20px;
        font-size: 0.8rem;
    }

    .calendar-navigation {
        padding: 12px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .calendar-current-view {
        font-size: 0.85rem;
        width: 100%;
        order: -1;
        margin-bottom: 10px;
    }

    .booking-filters {
        padding: 18px 15px;
    }

    .time-slot {
        padding: 12px 15px;
    }

    .slot-time {
        font-size: 1rem;
    }

    .slot-status {
        font-size: 0.75rem;
    }

    .appointment-success {
        padding: 30px 20px !important;
    }

    .appointment-success .success-icon {
        width: 60px !important;
        height: 60px !important;
        font-size: 2rem !important;
        margin: 0 auto 20px !important;
    }

    .appointment-success h3 {
        font-size: 1.4rem !important;
        margin-bottom: 12px !important;
    }

    .appointment-success p {
        font-size: 0.9rem !important;
        line-height: 1.6 !important;
    }
}

/* Ensure modal is always visible on screen */
@media (max-height: 700px) {
    .booking-modal {
        align-items: flex-start;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .booking-modal-content {
        max-height: 98vh;
    }

    .booking-details {
        padding: 18px 20px;
    }

    .booking-form-fields {
        padding: 20px;
    }
}
