/**
 * Frontend Styles
 * Appointment Scheduler Plugin
 */

/* Main Container */
.appointment-scheduler-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.appointment-scheduler-header {
    text-align: center;
    margin-bottom: 30px;
}

.appointment-scheduler-header h2 {
    color: #333;
    margin-bottom: 10px;
}

.appointment-scheduler-header p {
    color: #666;
    font-size: 16px;
}

/* Legend */
.appointment-scheduler-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.legend-color.available {
    background-color: #297233;
}

.legend-color.booked {
    background-color: #9E9E9E;
}

.legend-color.blocked {
    background-color: #ed694e;
}

/* Calendar */
.appointment-calendar {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.calendar-week {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Always 4 columns: Mon-Thu */
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid #eee;
}

.calendar-week:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.calendar-day {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.calendar-day.no-slots {
    opacity: 0.5;
}

.calendar-day.calendar-day-empty {
    background: #f5f5f5;
    opacity: 0.6;
}

.day-header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.day-name {
    display: block;
    font-weight: bold;
    color: #333;
    font-size: 14px;
    margin-bottom: 5px;
}

.day-date {
    display: block;
    color: #666;
    font-size: 13px;
}

/* Time Slots */
.day-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.time-slot {
    position: relative;
}

.slot-button {
    width: 100%;
    padding: 10px;
    background: #297233;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.slot-button:hover {
    background: #1f5626;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(41, 114, 51, 0.3);
}

.slot-button:active {
    transform: translateY(0);
}

.time-slot.booked .slot-unavailable,
.time-slot.blocked .slot-unavailable,
.time-slot.past .slot-unavailable {
    display: block;
    width: 100%;
    padding: 10px;
    background: #9E9E9E;
    color: white;
    border-radius: 5px;
    text-align: center;
    font-size: 14px;
    cursor: not-allowed;
}

.time-slot.blocked .slot-unavailable {
    background: #ed694e;
}

.time-slot.past .slot-unavailable {
    background: #E0E0E0;
    color: #999;
}

.no-slots-message {
    text-align: center;
    color: #999;
    font-style: italic;
    margin: 10px 0;
}

/* Modal */
.appointment-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: #fefefe;
    margin: 3% auto;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #000;
}

.modal-content h3 {
    margin-top: 0;
    color: #333;
    margin-bottom: 15px;
    font-size: 20px;
}

.modal-appointment-info {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
}

.modal-appointment-info p {
    margin: 5px 0;
    color: #333;
}

/* Form Styles */
.form-group {
    margin-bottom: 6px;
}

.form-group-inline {
    display: flex;
    gap: 8px;
}

.form-group-inline .input-postal {
    flex: 0 0 120px;
}

.form-group-inline .input-city {
    flex: 1;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
    margin-bottom: 0px !important;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #297233;
}

.form-info-text {
    background: #e3f2fd;
    padding: 12px;
    border-radius: 5px;
    margin: 15px 0 12px 0;
    border-left: 4px solid #2196F3;
}

.form-info-text p {
    margin: 0;
    color: #1976D2;
    font-size: 13px;
    line-height: 1.4;
}

.form-privacy-text {
    background: #f5f5f5;
    padding: 8px;
    border-radius: 5px;
    margin-top: 12px;
    text-align: center;
}

.form-privacy-text p {
    margin: 0;
    color: #666;
    font-size: 12px;
    font-style: italic;
}

.form-message {
    margin: 15px 0;
    padding: 10px;
    border-radius: 5px;
    display: none;
}

.form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.form-actions .button {
    flex: 1;
}

.button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.button-primary {
    background: #297233;
    color: white;
}

.button-primary:hover {
    background: #1f5626;
}

.button-secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.button-secondary:hover {
    background: #e0e0e0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .calendar-week {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on tablets */
    }
}

@media (max-width: 768px) {
    .calendar-week {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
        gap: 10px;
    }
    
    .appointment-scheduler-wrapper {
        padding: 10px;
    }
    
    .appointment-calendar {
        padding: 15px;
    }
    
    .calendar-day {
        padding: 10px;
    }
    
    .day-name {
        font-size: 12px;
    }
    
    .day-date {
        font-size: 11px;
    }
    
    .slot-button,
    .slot-unavailable {
        padding: 8px;
        font-size: 12px;
    }
    
    .appointment-scheduler-legend {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}

/* Loading State */
.appointment-calendar.loading {
    opacity: 0.5;
    pointer-events: none;
}

.appointment-calendar.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #297233;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}
