/**
 * Frontend Booking Form Styles
 * 
 * @package KindHomeScheduling
 */

/* Container */
.khs-booking-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.khs-booking-title {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 600;
}

/* Booking Type Selector */
.khs-booking-type-selector {
    margin-bottom: 40px;
}

.khs-booking-type-selector h3 {
    color: #333;
    font-size: 20px;
    margin-bottom: 20px;
    font-weight: 500;
}

.khs-booking-type-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.khs-booking-type-option {
    position: relative;
    cursor: pointer;
    display: block;
}

.khs-booking-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.khs-option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
    background: #fafafa;
}

.khs-booking-type-option input[type="radio"]:checked + .khs-option-content {
    border-color: #2271b1;
    background: #f0f6fc;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.khs-option-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.khs-option-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 16px;
}

.khs-option-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

/* Form Sections */
.khs-customer-info,
.khs-datetime-selection,
.khs-callback-preferences,
.khs-project-details {
    margin-bottom: 30px;
}

.khs-customer-info h3,
.khs-datetime-selection h3,
.khs-callback-preferences h3,
.khs-project-details h3 {
    color: #333;
    font-size: 20px;
    margin-bottom: 20px;
    font-weight: 500;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

/* Form Rows */
.khs-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .khs-form-row {
        grid-template-columns: 1fr;
    }
}

/* Form Fields */
.khs-form-field {
    margin-bottom: 20px;
}

.khs-form-field:last-child {
    margin-bottom: 0;
}

.khs-form-field label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.khs-form-field label .required {
    color: #d63638;
    font-weight: bold;
}

.khs-form-field input[type="text"],
.khs-form-field input[type="email"],
.khs-form-field input[type="tel"],
.khs-form-field input[type="date"],
.khs-form-field select,
.khs-form-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: #fff;
}

.khs-form-field input:focus,
.khs-form-field select:focus,
.khs-form-field textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.khs-form-field input.error,
.khs-form-field select.error,
.khs-form-field textarea.error {
    border-color: #d63638;
}

.khs-form-field textarea {
    resize: vertical;
    min-height: 100px;
}

/* Time Slots Loading */
.khs-time-slots-loading {
    display: flex;
    align-items: center;
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

.khs-time-slots-loading .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: khs-spin 1s linear infinite;
    margin-right: 8px;
}

.khs-date-availability-message {
    margin-top: 6px;
    font-size: 13px;
    color: #1f2937;
    background: #f8fafc;
    border-radius: 4px;
    padding: 10px 12px;
    display: none;
}

.khs-date-availability-message.is-info {
    color: #0f4c81;
    background: #e6f0fb;
}

.khs-date-availability-message.is-error {
    color: #d63638;
    background: #fde8e8;
}

.khs-calendar-field,
.khs-time-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.khs-calendar {
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    transition: opacity 0.3s ease;
}

.khs-calendar.is-disabled {
    opacity: 0.6;
}

.khs-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    color: #1f2937;
}

.khs-calendar-nav {
    border: 1px solid #dcdcde;
    background: #fff;
    color: #2271b1;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.khs-calendar-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.khs-calendar-nav:not(:disabled):hover {
    border-color: #94c4e5;
    background: #f0f6fc;
    color: #135e96;
}

.khs-calendar-day-labels,
.khs-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.khs-calendar-day-label {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.khs-calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    font-size: 14px;
}

.khs-calendar-day.is-empty {
    visibility: hidden;
}

button.khs-calendar-day {
    border: none;
    background: transparent;
    padding: 0;
}

button.khs-calendar-day.is-available {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    margin: 0 auto;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button.khs-calendar-day.is-available:hover {
    background: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.25);
}

button.khs-calendar-day.is-available.is-selected,
button.khs-calendar-day.is-available:focus {
    outline: none;
    background: #15803d;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.35);
}

.khs-calendar-day.is-disabled {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    color: #1f2937;
    border: 1px solid transparent;
    margin: 0 auto;
    pointer-events: none;
}

.khs-time-slot-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
}

.khs-time-slot-btn {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #1f2937;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.khs-time-slot-btn:hover {
    border-color: #16a34a;
    color: #16a34a;
}

.khs-time-slot-btn.is-selected {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}

.khs-time-slot-btn.is-selected .khs-time-slot-availability {
    color: rgba(255, 255, 255, 0.85);
}

.khs-time-slot-label {
    font-weight: 600;
}

.khs-time-slot-availability {
    font-size: 12px;
    color: #64748b;
}

.khs-time-slot-empty {
    font-size: 13px;
    color: #64748b;
}

@keyframes khs-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Submit Button */
.khs-form-actions {
    text-align: center;
    margin-top: 40px;
}

.khs-submit-btn {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.khs-submit-btn:hover {
    background: #135e96;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.khs-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.khs-submit-btn .btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.khs-submit-btn .btn-loading .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: khs-spin 1s linear infinite;
    margin-right: 8px;
}

/* Messages */
.khs-form-messages {
    margin-top: 20px;
}

.khs-success-message,
.khs-error-message {
    padding: 15px 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.khs-success-message {
    background: #d4f4dd;
    border: 1px solid #00ba37;
    color: #00ba37;
}

.khs-error-message {
    background: #fce4e4;
    border: 1px solid #d63638;
    color: #d63638;
}

.khs-success-message .dashicons,
.khs-error-message .dashicons {
    font-size: 24px;
    margin-right: 10px;
}

.khs-success-message .message-text,
.khs-error-message .message-text {
    flex: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .khs-booking-form-container {
        padding: 20px;
    }
    
    .khs-booking-title {
        font-size: 24px;
    }
    
    .khs-booking-type-options {
        grid-template-columns: 1fr;
    }
    
    .khs-form-row {
        grid-template-columns: 1fr;
    }
    
    .khs-submit-btn {
        width: 100%;
    }
}

/* Theme Integration */
.theme-default .khs-booking-form-container {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.theme-modern .khs-submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.theme-modern .khs-submit-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4093 100%);
}

.theme-minimal .khs-booking-form-container {
    box-shadow: none;
    border: 2px solid #e0e0e0;
}

.theme-minimal .khs-submit-btn {
    background: #333;
    border-radius: 0;
}

.theme-corporate .khs-submit-btn {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

/* Loading States */
.khs-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Accessibility */
.khs-booking-form-container *:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.khs-form-address-status {
    margin-top: 6px;
    font-size: 0.875rem;
    color: rgba(17, 24, 39, 0.68);
}

/* Print Styles */
@media print {
    .khs-booking-form-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .khs-submit-btn {
        display: none;
    }
}
