/* Appointments Section Styles */
.appointments {
    padding: 40px 0;
}

.appointments h1 {
    margin-bottom: 30px;
}

.calendar-container {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    color: #333;
}

.week-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.week-info {
    font-weight: bold;
    font-size: 1.1em;
    flex: 1;
    min-width: 0;
}

.nav-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.nav-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.nav-btn:active {
    transform: translateY(0) scale(0.98);
}

.nav-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.mobile-scroll-hint {
    animation: fadeInOut 3s infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.calendar-wrapper {
    overflow-x: auto;
    margin: 0 -10px;
    padding: 0 10px;
}

.appointments-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    min-width: 600px;
}

.appointments-table th,
.appointments-table td {
    border: 1px solid #000000; /* Changed from #dee2e6 to black */
    padding: 8px;
    text-align: center;
    vertical-align: middle;
}

.appointments-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

.day-header.today {
    background-color: #007bff;
    color: white;
}

.day-header small {
    font-weight: normal;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

/* Mobile specific table adjustments */
.mobile-view {
    width: 100%;
}

.mobile-view .appointments-table {
    width: 100%;
    table-layout: fixed;
}

.time-slot {
    background-color: #f8f9fa;
    font-weight: bold;
    width: 80px;
    min-width: 80px;
    position: sticky;
    left: 0;
    z-index: 11;
}

.appointment-cell {
    width: calc((100% - 80px) / 7);
    min-width: 80px;
    height: 50px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Mobile view cell widths */
.mobile-view .appointment-cell {
    width: calc((100% - 40px) / 3); /* Distribute width evenly for 3 columns */
}

.appointment-cell.available {
    background-color: #d4edda;
    color: #155724;
}

.appointment-cell.available:hover {
    background-color: #c3e6cb;
    transform: scale(1.02);
}

.appointment-cell.available:active {
    transform: scale(0.98);
}

/* Touch-specific styles */
@media (hover: none) and (pointer: coarse) {
    .appointment-cell.available:hover {
        background-color: #d4edda;
        transform: none;
    }
    
    .appointment-cell.available:active {
        background-color: #c3e6cb;
        transform: scale(0.95);
    }
}

.appointment-cell.booked {
    background-color: #f8d7da;
    color: #721c24;
    cursor: not-allowed;
}

.appointment-cell.unavailable {
    background-color: #e2e3e5;
    color: #6c757d;
    cursor: not-allowed;
}

.appointment-cell.past {
    background-color: #e2e3e5;
    color: #6c757d;
    cursor: not-allowed;
}

.appointment-status {
    font-size: 0.8em;
    font-weight: bold;
}

.booked-info {
    font-size: 0.7em;
    line-height: 1.2;
}

/* Calendar Legend Styles */
.calendar-legend {
    border-top: 1px solid #000000; /* Changed from #dee2e6 to black */
    padding-top: 15px;
}

.legend-title {
    margin-bottom: 10px;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
    border: 1px solid;
    flex-shrink: 0;
}

.legend-color.available {
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.legend-color.booked {
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.legend-color.unavailable {
    background-color: #e2e3e5;
    border-color: #d1d3d4;
}

/* Booking Modal Styles */
.booking-modal .modal-content {
    border-radius: 10px;
}

.booking-modal .modal-header {
    background-color: #007bff;
    color: white;
    border-radius: 10px 10px 0 0;
}

.booking-modal .btn-close {
    filter: invert(1);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
    display: block;
}

.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    text-align: center;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    text-align: center;
}

/* Responsive Design */
/* Tablet styles */
@media (max-width: 992px) {
    .appointments {
        padding: 30px 0;
    }
    
    .calendar-container {
        padding: 15px;
    }
    
    .week-navigation {
        margin-bottom: 15px;
    }
    
    .week-info {
        font-size: 1em;
    }
    
    .appointments-table {
        font-size: 0.9em;
    }
    
    .appointment-cell {
        min-width: 70px;
        height: 45px;
    }
    
    .time-slot {
        width: 70px;
        min-width: 70px;
    }
}

/* Mobile landscape */
@media (max-width: 768px) {
    .appointments {
        padding: 20px 0;
    }
    
    .calendar-container {
        margin: 0 -15px;
        border-radius: 0;
    }
    
    .week-navigation {
        flex-direction: row;
        gap: 5px;
        margin-bottom: 10px;
    }
    
    .week-info {
        font-size: 0.9em;
        text-align: center;
    }
    
    .nav-btn {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    
    .appointments-table {
        font-size: 0.8em;
        min-width: 500px;
    }
    
    .appointment-cell {
        min-width: 60px;
        height: 40px;
        padding: 2px;
    }
    
    /* Enhanced styling for 3-day mobile view */
    .mobile-view .appointment-cell {
        min-width: 90px;
        width: calc(33.333% - 20px); /* Distribute width evenly for 3 columns */
    }
    
    .mobile-view .appointments-table {
        table-layout: fixed; /* Fixed table layout for better width control */
        width: 100%;
    }
    
    .time-slot {
        width: 60px;
        min-width: 60px;
        font-size: 0.8em;
    }
    
    .appointment-status {
        font-size: 0.7em;
    }
    
    .calendar-legend {
        padding-top: 10px;
    }
    
    .legend-items {
        gap: 10px;
        font-size: 0.9em;
    }
    
    .legend-color {
        width: 12px;
        height: 12px;
    }
}

/* Mobile portrait */
@media (max-width: 576px) {
    .appointments h1 {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }
    
    .calendar-container {
        padding: 10px;
    }
    
    .week-navigation {
        margin-bottom: 10px;
    }
    
    .week-info {
        font-size: 0.8em;
    }
    
    .nav-btn {
        padding: 6px 8px;
        font-size: 0.8em;
    }
    
    .mobile-scroll-hint {
        font-size: 0.8em;
        margin-bottom: 5px;
    }
    
    .calendar-wrapper {
        margin: 0 -5px;
        padding: 0 5px;
    }
    
    .appointments-table {
        font-size: 0.7em;
        min-width: 100%; /* Change from fixed pixel width to 100% */
        width: 100%;
    }
    
    .appointment-cell {
        min-width: 30px; /* Reduced minimum width */
        height: 35px;
        padding: 1px;
    }
    
    .mobile-view .appointment-cell {
        width: 30%; /* Percentage-based width for mobile */
    }
    
    .time-slot {
        width: 40px;
        min-width: 40px;
        font-size: 0.7em;
        padding: 2px;
    }
    
    .appointment-status {
        font-size: 0.6em;
        line-height: 1.1;
    }
    
    .booked-info {
        font-size: 0.5em;
    }
    
    .calendar-legend {
        padding-top: 8px;
    }
    
    .legend-items {
        gap: 8px;
        font-size: 0.8em;
        justify-content: space-around;
    }
    
    .legend-color {
        width: 10px;
        height: 10px;
    }
    
    /* Modal improvements for mobile */
    .booking-modal .modal-dialog {
        margin: 10px;
    }
    
    .booking-modal .modal-content {
        border-radius: 8px;
    }
    
    .form-group {
        margin-bottom: 0.8rem;
    }
    
    .form-group input {
        padding: 0.6rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Extra small screens */
@media (max-width: 400px) {
    .appointments-table {
        min-width: 100%;
        width: 100%;
    }
    
    .mobile-view .appointments-table {
        table-layout: fixed;
        width: 100%;
    }
    
    .mobile-view .appointment-cell {
        width: 33.333%;
        padding: 0;
        min-width: 0;
    }
    
    .appointment-cell {
        min-width: 40px;
        height: 30px;
    }
    
    .time-slot {
        width: 40px;
        min-width: 40px;
        font-size: 0.6em;
    }
    
    .appointment-status {
        font-size: 0.5em;
    }
    
    .nav-btn {
        padding: 4px 6px;
        font-size: 0.7em;
    }
    
    .legend-items {
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }
}
