/**
 * Frontend Styles
 * @package Nuoria_Service_Booking_Appointments
 */

/* Base Styles */
.nuoria-service-booking-appointments-booking-widget,
.nuoria-service-booking-appointments-calendar-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    overflow-x: hidden;
    --nuoria-service-booking-appointments-border: #d9dde4;
    --nuoria-service-booking-appointments-border-strong: #2563eb;
    --nuoria-service-booking-appointments-surface: #f8fafc;
    --nuoria-service-booking-appointments-surface-strong: #eef2f7;
    --nuoria-service-booking-appointments-focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Messages */
.nuoria-service-booking-appointments-messages {
    margin-bottom: 20px;
}

.nuoria-service-booking-appointments-message {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.nuoria-service-booking-appointments-message-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #28a745;
    color: #155724;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.1);
}

.nuoria-service-booking-appointments-thank-you-message {
    font-size: 16px;
    font-weight: normal;
    line-height: 1.6;
    padding: 24px 20px;
    text-align: center;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    max-width: 800px;
    width: 100%;
    margin: 20px auto;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #28a745;
    position: relative;
}

.nuoria-service-booking-appointments-message-error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: 1px solid #dc3545;
    color: #721c24;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.1);
}

/* Step Indicators */
.nuoria-service-booking-appointments-step-indicators {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 0 20px;
}

.nuoria-service-booking-appointments-step-indicator {
    flex: 1;
    text-align: center;
    position: relative;
    padding: 10px;
}

.nuoria-service-booking-appointments-step-indicator::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e0e0e0;
    z-index: 0;
}

.nuoria-service-booking-appointments-step-indicator:first-child::before {
    left: 50%;
}

.nuoria-service-booking-appointments-step-indicator:last-child::before {
    right: 50%;
}

.nuoria-service-booking-appointments-step-indicator .step-number {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    font-weight: bold;
    position: relative;
    z-index: 1;
}

.nuoria-service-booking-appointments-step-indicator.active .step-number {
    background: #0073aa;
    color: #fff;
}

.nuoria-service-booking-appointments-step-indicator.completed .step-number {
    background: #46b450;
    color: #fff;
}

.nuoria-service-booking-appointments-step-indicator .step-label {
    display: block;
    margin-top: 8px;
    font-size: 14px;
    color: #666;
}

/* Steps Container */
.nuoria-service-booking-appointments-steps {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.nuoria-service-booking-appointments-step {
    display: none;
}

.nuoria-service-booking-appointments-step.active {
    display: block;
}

.nuoria-service-booking-appointments-step h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

/* Services List */
.nuoria-service-booking-appointments-services-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.nuoria-service-booking-appointments-service-item {
    border: 1.5px solid var(--nuoria-service-booking-appointments-border);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fff;
}

.nuoria-service-booking-appointments-service-item:hover {
    border-color: var(--nuoria-service-booking-appointments-border-strong);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.nuoria-service-booking-appointments-service-item.selected {
    border-color: var(--nuoria-service-booking-appointments-border-strong);
    background-color: var(--nuoria-service-booking-appointments-surface);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.12);
}

.nuoria-service-booking-appointments-service-name {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.nuoria-service-booking-appointments-service-description {
    margin: 0 0 15px;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.nuoria-service-booking-appointments-service-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.nuoria-service-booking-appointments-service-duration {
    color: #666;
}

.nuoria-service-booking-appointments-service-price {
    font-weight: 600;
    color: #0073aa;
    font-size: 16px;
}

/* Date & Time Selection */
.nuoria-service-booking-appointments-datetime-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .nuoria-service-booking-appointments-datetime-selection {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.nuoria-service-booking-appointments-date-section,
.nuoria-service-booking-appointments-time-section {
    padding: 20px;
    border: 1px solid var(--nuoria-service-booking-appointments-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.03);
    box-sizing: border-box;
}

@media (max-width: 768px) {

    .nuoria-service-booking-appointments-date-section,
    .nuoria-service-booking-appointments-time-section {
        padding: 15px;
    }
}

.nuoria-service-booking-appointments-section-title {
    margin: 0 0 15px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

@media (max-width: 768px) {
    .nuoria-service-booking-appointments-section-title {
        font-size: 14px;
        margin-bottom: 12px;
    }
}

.nuoria-service-booking-appointments-date-picker {
    width: 100%;
    max-width: 100%;
    padding: 10px;
    border: 1px solid var(--nuoria-service-booking-appointments-border);
    border-radius: 8px;
    background: var(--nuoria-service-booking-appointments-surface);
    font-size: 14px;
    box-sizing: border-box;
    margin: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.nuoria-service-booking-appointments-date-picker:hover {
    border-color: #c7ccd6;
    background: #fff;
}

.nuoria-service-booking-appointments-date-picker:focus {
    outline: none;
    border-color: var(--nuoria-service-booking-appointments-border-strong);
    box-shadow: var(--nuoria-service-booking-appointments-focus-ring);
}

/* Fix for Flatpickr calendar positioning */
.flatpickr-calendar {
    box-sizing: border-box;
}

/* Ensure date picker input doesn't overflow */
.nuoria-service-booking-appointments-date-section .flatpickr-input {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.nuoria-service-booking-appointments-time-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.nuoria-service-booking-appointments-time-slot {
    padding: 10px;
    border: 1px solid var(--nuoria-service-booking-appointments-border);
    border-radius: 8px;
    background: var(--nuoria-service-booking-appointments-surface);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.nuoria-service-booking-appointments-time-slot:hover {
    border-color: var(--nuoria-service-booking-appointments-border-strong);
    background-color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
}

.nuoria-service-booking-appointments-time-slot.selected {
    border-color: var(--nuoria-service-booking-appointments-border-strong);
    background-color: #1d4ed8;
    color: #fff;
    box-shadow: 0 10px 24px rgba(29, 78, 216, 0.18);
}

.nuoria-service-booking-appointments-time-slot:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Booking Form */
.nuoria-service-booking-appointments-booking-form {
    width: 100%;
    box-sizing: border-box;
}

.nuoria-service-booking-appointments-form-group {
    margin-bottom: 20px;
}

.nuoria-service-booking-appointments-form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.nuoria-service-booking-appointments-form-control {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--nuoria-service-booking-appointments-border);
    border-radius: 8px;
    background: var(--nuoria-service-booking-appointments-surface);
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.nuoria-service-booking-appointments-form-control:focus {
    outline: none;
    border-color: var(--nuoria-service-booking-appointments-border-strong);
    box-shadow: var(--nuoria-service-booking-appointments-focus-ring);
    background: #fff;
}

.nuoria-service-booking-appointments-form-control:hover {
    border-color: #c7ccd6;
    background: #fff;
}

.nuoria-service-booking-appointments-form-control::placeholder {
    color: #8a94a6;
}

/* Navigation Buttons */
.nuoria-service-booking-appointments-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.nuoria-service-booking-appointments-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nuoria-service-booking-appointments-btn-primary {
    background-color: #0073aa;
    color: #fff;
}

.nuoria-service-booking-appointments-btn-primary:hover {
    background-color: #005a87;
}

.nuoria-service-booking-appointments-btn-secondary {
    background-color: #f0f0f0;
    color: #333;
}

.nuoria-service-booking-appointments-btn-secondary:hover {
    background-color: #e0e0e0;
}

.nuoria-service-booking-appointments-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading & Empty States */
.nuoria-service-booking-appointments-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.nuoria-service-booking-appointments-no-services,
.nuoria-service-booking-appointments-no-slots {
    text-align: center;
    padding: 40px;
    color: #666;
    background: #f9f9f9;
    border-radius: 4px;
}

/* Calendar Widget */
.nuoria-service-booking-appointments-calendar-widget {
    padding: 20px;
}

/* Modal */
.nuoria-service-booking-appointments-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.nuoria-service-booking-appointments-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    position: relative;
}

.nuoria-service-booking-appointments-modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.nuoria-service-booking-appointments-modal-close:hover {
    color: #000;
}

.nuoria-service-booking-appointments-booking-info p {
    margin: 10px 0;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {

    .nuoria-service-booking-appointments-booking-widget,
    .nuoria-service-booking-appointments-calendar-widget {
        padding: 0 10px;
    }

    .nuoria-service-booking-appointments-services-list {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .nuoria-service-booking-appointments-service-item {
        padding: 15px;
    }

    .nuoria-service-booking-appointments-service-name {
        font-size: 16px;
    }

    .nuoria-service-booking-appointments-service-description {
        font-size: 13px;
    }

    .nuoria-service-booking-appointments-time-slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }

    .nuoria-service-booking-appointments-time-slot {
        padding: 8px;
        font-size: 13px;
    }

    .nuoria-service-booking-appointments-step-indicators {
        padding: 0 10px;
        margin-bottom: 20px;
    }

    .nuoria-service-booking-appointments-step-indicator {
        padding: 5px;
    }

    .nuoria-service-booking-appointments-step-indicator .step-number {
        width: 32px;
        height: 32px;
        line-height: 32px;
        font-size: 12px;
    }

    .nuoria-service-booking-appointments-step-indicator .step-label {
        font-size: 11px;
        margin-top: 5px;
    }

    .nuoria-service-booking-appointments-form-group {
        margin-bottom: 15px;
    }

    .nuoria-service-booking-appointments-form-control {
        padding: 8px;
        font-size: 13px;
    }

    .nuoria-service-booking-appointments-navigation {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
        padding-top: 15px;
    }

    .nuoria-service-booking-appointments-btn {
        width: 100%;
        padding: 10px 20px;
        font-size: 13px;
    }

    .nuoria-service-booking-appointments-message {
        padding: 10px 12px;
        font-size: 14px;
    }

    .nuoria-service-booking-appointments-thank-you-message {
        padding: 25px 15px;
        font-size: 15px;
        max-width: 100%;
        margin: 15px auto;
    }

    .nuoria-service-booking-appointments-modal-content {
        margin: 5% auto;
        padding: 20px;
        max-width: 90%;
    }
}

/* Extra small devices */
@media (max-width: 480px) {

    .nuoria-service-booking-appointments-booking-widget,
    .nuoria-service-booking-appointments-calendar-widget {
        padding: 0 5px;
    }

    .nuoria-service-booking-appointments-step-indicators {
        padding: 0 5px;
    }

    .nuoria-service-booking-appointments-step-indicator .step-label {
        font-size: 10px;
    }

    .nuoria-service-booking-appointments-date-section,
    .nuoria-service-booking-appointments-time-section {
        padding: 12px;
    }

    .nuoria-service-booking-appointments-time-slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 6px;
    }

    .nuoria-service-booking-appointments-time-slot {
        padding: 6px;
        font-size: 12px;
    }

    .nuoria-service-booking-appointments-message {
        padding: 8px 10px;
        font-size: 13px;
    }

    .nuoria-service-booking-appointments-thank-you-message {
        padding: 20px 12px;
        font-size: 14px;
    }
}

/* Page Builder Specific Fixes */
.wp-block-nuoria-service-booking-appointments-booking-widget,
.elementor-widget-nuoria_service_booking_appointments,
.fl-node,
.et_pb_module {
    box-sizing: border-box;
}

.wp-block-nuoria-service-booking-appointments-booking-widget .nuoria-service-booking-appointments-booking-widget,
.elementor-widget-nuoria_service_booking_appointments .nuoria-service-booking-appointments-booking-widget,
.fl-node .nuoria-service-booking-appointments-booking-widget,
.et_pb_module .nuoria-service-booking-appointments-booking-widget {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Beaver Builder specific fixes */
.fl-module-nuoria-service-booking-appointments-appointment-booking,
.fl-module-content,
.fl-node .fl-module-content {
    width: 100% !important;
    max-width: 100% !important;
}

.fl-node .nuoria-service-booking-appointments-booking-widget,
.fl-module-nuoria-service-booking-appointments-appointment-booking .nuoria-service-booking-appointments-booking-widget {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
}

.fl-node .nuoria-service-booking-appointments-services-list,
.fl-node .nuoria-service-booking-appointments-datetime-selection,
.fl-node .nuoria-service-booking-appointments-booking-form {
    width: 100% !important;
    max-width: 100% !important;
}

/* Ensure date picker works correctly in all page builders */
.wp-block-nuoria-service-booking-appointments-booking-widget .nuoria-service-booking-appointments-date-picker,
.elementor-widget-nuoria_service_booking_appointments .nuoria-service-booking-appointments-date-picker,
.fl-node .nuoria-service-booking-appointments-date-picker,
.et_pb_module .nuoria-service-booking-appointments-date-picker {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
}

/* Fix for Gutenberg block alignment */
.wp-block-nuoria-service-booking-appointments-booking-widget.alignwide,
.wp-block-nuoria-service-booking-appointments-booking-widget.alignfull {
    max-width: 100%;
}

.wp-block-nuoria-service-booking-appointments-booking-widget.alignwide .nuoria-service-booking-appointments-booking-widget,
.wp-block-nuoria-service-booking-appointments-booking-widget.alignfull .nuoria-service-booking-appointments-booking-widget {
    max-width: 100%;
}

/* Divi Specific Input Fixes */
.nuoria-service-booking-appointments-divi-widget-wrapper .nuoria-service-booking-appointments-booking-widget input.nuoria-service-booking-appointments-form-control,
.nuoria-service-booking-appointments-divi-widget-wrapper .nuoria-service-booking-appointments-booking-widget input.nuoria-service-booking-appointments-date-picker,
.nuoria-service-booking-appointments-divi-widget-wrapper .nuoria-service-booking-appointments-booking-widget textarea.nuoria-service-booking-appointments-form-control {
    padding: 12px 16px !important;
    height: auto !important;
    min-height: 48px !important;
    line-height: 1.5 !important;
    background-color: var(--nuoria-service-booking-appointments-surface) !important;
    border: 1px solid var(--nuoria-service-booking-appointments-border) !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    color: var(--nuoria-service-booking-appointments-text-color, #333) !important;
    width: 100% !important;
    margin-bottom: 0 !important;
}

.nuoria-service-booking-appointments-divi-widget-wrapper .nuoria-service-booking-appointments-booking-widget textarea.nuoria-service-booking-appointments-form-control {
    min-height: 120px !important;
}

/* Reset Divi's default margins on inputs */
.nuoria-service-booking-appointments-divi-widget-wrapper .nuoria-service-booking-appointments-booking-widget .nuoria-service-booking-appointments-form-group input,
.nuoria-service-booking-appointments-divi-widget-wrapper .nuoria-service-booking-appointments-booking-widget .nuoria-service-booking-appointments-form-group textarea {
    margin-bottom: 0 !important;
}