/* Frontend Appointment Booking UI */

.appointment-date {
    position: relative;
    margin: 0;
}

.appointment-date input[type="date"],
.appointment-date input[type="text"],
.appointment-date input[type="datetime-local"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    background-color: #f8fafc;
    color: #0f172a;
    transition: all 0.2s ease;
    cursor: pointer;
}

.appointment-date input[type="date"]:focus,
.appointment-date input[type="text"]:focus,
.appointment-date input[type="datetime-local"]:focus {
    outline: none;
    border-color: #0f766e;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.appointment-date input[type="date"]::-webkit-calendar-picker-indicator,
.appointment-date input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%230f766e" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>');
    background-size: 22px 22px;
    cursor: pointer;
    padding: 6px;
}

.appointment-date label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #334155;
    font-size: 13px;
}

.appointment-date .fme-date-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    margin: 0 0 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.appointment-date .fme-date-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #334155;
}

.appointment-date .fme-date-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}

.appointment-date .fme-date-legend .fme-legend-available .fme-date-legend-dot {
    background: #f0fdf4;
    border: 2px solid #059669;
}

.appointment-date .fme-date-legend .fme-legend-booked .fme-date-legend-dot {
    background: #fef2f2;
    border: 2px solid #b91c1c;
}

.appointment-date .fme-date-legend .fme-legend-unavailable .fme-date-legend-dot {
    background: #f9fafb;
    border: 2px solid #9ca3af;
}

.appointment-date #appointment_date {
    cursor: pointer;
}

.accordion-section {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}

.accordion-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f0fdfa 100%);
    padding: 16px 18px;
    font-weight: 700;
    cursor: pointer;
    color: #0f172a;
    border-bottom: 1px solid #e2e8f0;
}

.accordion-content {
    display: none;
    padding: 18px;
    background: #fff;
}

.accordion-content.open {
    display: block;
}

#appointment_slots_wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: visible;
    padding: 10px 10px 8px;
}

.slot-option,
.available-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 12px 10px;
    min-height: 48px;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.18s ease;
    background: #fff;
    text-align: center;
}

.slot-option:hover {
    background: #f0fdfa;
    border-color: #5eead4;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.12);
}

.slot-option.selected {
    background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    border-color: #0f766e;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.slot-time {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.tick-icon {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    flex-shrink: 0;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(15, 118, 110, 0.35);
    pointer-events: none;
}

.slot-option .tick-icon,
.available-slot .tick-icon {
    position: absolute;
    top: -8px;
    right: -8px;
}

.slot-option.selected .tick-icon,
.available-slot.selected .tick-icon {
    display: flex;
}

.slot-duration-info {
    margin-top: 10px;
    color: #64748b;
}

.duration-badge {
    font-size: 0.8em;
    color: #64748b;
    font-weight: normal;
}

.slot-duration {
    font-size: 0.85em;
    color: #94a3b8;
    margin-left: 5px;
}

.break-slot {
    background: #fef2f2;
    border-color: #fecaca;
    cursor: not-allowed;
    opacity: 0.75;
}

.break-icon {
    color: #dc2626;
}

#date-status-message {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 10px;
}

.off-day-message {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.available-day-message {
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.available-slot.disabled,
.available-slot.booked {
    background-color: #fde8ea;
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 7px,
        rgba(255, 255, 255, 0.72) 7px,
        rgba(255, 255, 255, 0.72) 14px
    );
    border: 1px solid #e8a0a8;
    border-radius: 6px;
    opacity: 1;
    cursor: not-allowed;
    position: relative;
    padding: 14px 16px;
    animation: none;
}

.available-slot.disabled:hover,
.available-slot.booked:hover {
    background-color: #fde8ea;
    border-color: #e8a0a8;
    transform: none;
    box-shadow: none;
}

.available-slot.disabled .slot-time,
.available-slot.booked .slot-time {
    color: #4b5563;
    font-weight: 500;
    font-size: 13px;
    text-decoration: none;
}

.available-slot.booked .slot-booked-badge,
.available-slot.disabled.booked .slot-booked-badge {
    position: absolute;
    right: 6px;
    bottom: 6px;
    left: auto;
    top: auto;
    transform: none;
    background: #fff;
    color: #dc2626;
    border: 1px solid #e8a0a8;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 3px;
    letter-spacing: 0.04em;
    z-index: 1;
    pointer-events: none;
}

.available-slot.booked .slot-lock-icon,
.available-slot.disabled.booked .slot-lock-icon {
    position: absolute;
    top: 5px;
    right: 6px;
    width: 12px;
    height: 12px;
    z-index: 2;
    pointer-events: none;
    opacity: 0.9;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f5c542'%3E%3Cpath d='M12 2a5 5 0 00-5 5v3H6a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V12a2 2 0 00-2-2h-1V7a5 5 0 00-5-5zm-3 8V7a3 3 0 016 0v3H9z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.available-slot.disabled::before,
.available-slot.disabled::after,
.available-slot.booked::before,
.available-slot.booked::after {
    content: none;
    display: none;
}

#staff_member_select {
    width: 100%;
    padding: 14px 40px 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background-color: #f8fafc;
    color: #0f172a;
    transition: all 0.2s ease;
    appearance: none;
    cursor: pointer;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%230f766e" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"><polyline points="6 9 12 15 18 9"/></svg>');
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
}

#staff_member_select:hover {
    border-color: #99f6e4;
    background-color: #fff;
}

#staff_member_select:focus {
    outline: none;
    border-color: #0f766e;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

#staff_member_select option {
    padding: 12px 16px;
    font-size: 14px;
    background-color: #fff;
    color: #0f172a;
}

#staff-message {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
}

.staff-available-message {
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.staff-error-message {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.available-slot:not(.disabled):not(.booked) {
    background-color: #fff;
    border: 2px solid #e2e8f0;
}

.available-slot:not(.disabled):not(.booked):hover {
    background-color: #f0fdfa;
    border-color: #5eead4;
}

.available-slot:not(.disabled):not(.booked).selected {
    background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    border-color: #0f766e;
}

#appointment_slots_wrapper::-webkit-scrollbar {
    width: 6px;
}

#appointment_slots_wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

#appointment_slots_wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.shake-animation {
    animation: shake 0.6s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
