/* Reservation Plugin Styles */
/* Namespaced to avoid conflicts with other styles */

/* Modal Overlay */
.zarew-reservation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.zarew-reservation-overlay.active {
    display: flex;
    opacity: 1;
}

/* Modal Window - Desktop */
.zarew-reservation-modal {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 900px;
    height: 600px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Allow text selection in input fields */
.zarew-reservation-modal input,
.zarew-reservation-modal textarea {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.zarew-reservation-overlay.active .zarew-reservation-modal {
    transform: scale(1);
}

/* Modal Header */
.zarew-reservation-header {
    height: 60px;
    padding: 0 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    flex-shrink: 0;
}

.zarew-reservation-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.zarew-reservation-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.zarew-reservation-close:hover {
    background: #e0e0e0;
    color: #333;
}

/* Navigation Bar */
.zarew-reservation-navigation {
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
    flex-shrink: 0;
}

.zarew-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.zarew-breadcrumb-item {
    color: #666;
    transition: color 0.2s ease;
}

.zarew-breadcrumb-item.active {
    color: #667eea;
    font-weight: 600;
}

.zarew-breadcrumb-separator {
    color: #999;
    margin: 0 4px;
    display: flex;
    align-items: center;
}

.zarew-breadcrumb-separator ion-icon {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.zarew-navigation-buttons {
    display: flex;
    gap: 12px;
}

/* Modal Body */
.zarew-reservation-body {
    height: 390px;
    overflow: hidden;
    padding: 24px;
    position: relative;
    flex-shrink: 0;
}

/* Body Content */
.zarew-body-content {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Summary Bar - Footer */
.zarew-reservation-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 0;
    width: 100%;
    height: 100%;
}

.zarew-summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    border-right: 1px solid #e0e0e0;
    justify-content: flex-start;
    min-width: 0;
    overflow: hidden;
}

.zarew-summary-item:first-child {
    padding-left: 24px;
}

.zarew-summary-item:last-child {
    border-right: none;
    padding-right: 24px;
}

.zarew-summary-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    font-weight: 500;
}

.zarew-summary-value {
    font-size: 10px;
    color: #333;
    font-weight: 500;
}

#zarew-summary-service-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    width: 100%;
}

.zarew-summary-value.empty {
    color: #999;
    font-style: italic;
}

.zarew-summary-price {
    font-size: 10px;
    color: #333;
    font-weight: 500;
}

.zarew-summary-item.active .zarew-summary-label {
    color: #667eea;
    font-weight: 600;
}

.zarew-summary-item.active .zarew-summary-value {
    color: #667eea;
}

.zarew-summary-item.active .zarew-summary-price {
    color: #667eea;
    font-weight: 600;
}

/* Form Steps */
.zarew-form-step {
    display: none;
    width: 100%;
    height: 100%;
}

.zarew-form-step.active {
    display: flex;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Step 1: Car Selection */
.zarew-cars-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    width: 100%;
    height: 100%;
    align-items: stretch;
    justify-items: stretch;
    padding: 0;
}

.zarew-car-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    position: relative;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.zarew-car-card:hover {
    border-color: #667eea;
}

.zarew-car-card.selected {
    border-color: #667eea;
    background: #f0f4ff;
}

.zarew-car-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: #f0f0f0;
    overflow: hidden;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zarew-car-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.zarew-car-image.fallback {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 500;
}

.zarew-car-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    padding: 16px;
    z-index: 2;
    text-align: center;
    background: linear-gradient(to top, rgba(128, 128, 128, 0.9) 0%, rgba(128, 128, 128, 0.5) 50%, transparent 100%);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 1px 2px rgba(0, 0, 0, 0.6);
    transition: background 0.2s ease;
}

.zarew-car-card.selected .zarew-car-name {
    background: linear-gradient(to top, rgba(102, 126, 234, 0.9) 0%, rgba(102, 126, 234, 0.5) 50%, transparent 100%);
}

/* Step 2: Service Selection */
.zarew-services-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.zarew-services-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.zarew-service-group {
    margin-bottom: 24px;
}

.zarew-service-group:last-child {
    margin-bottom: 0;
}

.zarew-service-group-title {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.zarew-services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0;
}

.zarew-service-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 48px;
    min-width: 0;
    overflow: hidden;
}

.zarew-service-card:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.zarew-service-card.selected {
    border-color: #667eea;
    background: #f0f4ff;
}

.zarew-service-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin: 0;
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zarew-service-card.selected .zarew-service-card-name {
    color: #667eea;
}

.zarew-service-card-price {
    color: #667eea;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    flex: none;
    flex-shrink: 0;
}

.zarew-service-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

/* Step 3: Date and Time Selection */
.zarew-date-time-container {
    display: flex;
    gap: 24px;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.zarew-calendar-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    overflow: hidden;
    height: 100%;
    width: 320px;
}

.zarew-inputs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.zarew-selected-date-input,
.zarew-selected-time-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    text-align: center;
    cursor: pointer;
    box-sizing: border-box;
}

.zarew-calendar-section .zarew-selected-date-input {
    height: 32px;
    flex-shrink: 0;
}

.zarew-time-slots-section .zarew-selected-time-input,
.zarew-time-slots-section .zarew-selected-date-input {
    height: 28px;
}

.zarew-calendar-section .zarew-selected-date-input {
    height: 32px;
}

.zarew-selected-date-input:focus,
.zarew-selected-time-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.zarew-time-slot-input-wrapper {
    display: flex;
    gap: 4px;
    align-items: stretch;
}

.zarew-selected-time-input {
    flex: 1;
}

.zarew-time-nav-btn {
    background: #667eea;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.zarew-time-nav-btn:disabled {
    background: #f0f0f0;
    color: #999;
    cursor: not-allowed;
    opacity: 1;
}

.zarew-time-nav-btn:not(:disabled):hover {
    background: #5568d3;
}

.zarew-time-nav-btn ion-icon {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Calendar */
.zarew-calendar-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    width: 100%;
}

.zarew-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.zarew-calendar-month {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.zarew-calendar-nav-buttons {
    display: flex;
    gap: 4px;
}

.zarew-calendar-nav-btn {
    background: #667eea;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s ease;
    padding: 0;
    font-size: 10px;
    font-weight: 600;
}

.zarew-calendar-nav-btn.zarew-calendar-today-btn {
    width: fit-content;
    padding: 0 8px;
    font-size: 10px;
    white-space: nowrap;
}

.zarew-calendar-nav-btn:disabled {
    background: #f0f0f0;
    color: #999;
    cursor: not-allowed;
    opacity: 1;
}

.zarew-calendar-nav-btn:not(:disabled):hover {
    background: #5568d3;
}

.zarew-calendar-nav-btn ion-icon {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.zarew-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    flex-shrink: 0;
    width: 100%;
    height: 24px;
}

.zarew-calendar-weekday {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: #666;
    padding: 4px 2px;
}

.zarew-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 44px);
    gap: 2px;
    flex: 1;
    min-height: 0;
    width: 100%;
    justify-content: start;
}

.zarew-calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    background: #fff;
    color: #333;
    font-weight: 500;
    width: 44px;
    height: 44px;
}

/* Days outside current month - light gray background, slightly darker text */
.zarew-calendar-day.outside-month {
    color: #999;
    background: #f5f5f5;
    cursor: default;
}

/* Available days inside current month - white background, light black text */
.zarew-calendar-day.available {
    background: #fff;
    color: #333;
}

/* Unavailable days inside current month - striped background */
.zarew-calendar-day.no-slots {
    background: repeating-linear-gradient(
        -45deg,
        #f5f5f5,
        #f5f5f5 4px,
        #e8e8e8 4px,
        #e8e8e8 8px
    );
    color: #333;
    cursor: not-allowed;
}

/* Current day - purple border, purple text, background depends on available slots */
/* .today has higher priority than .no-slots */
.zarew-calendar-day.today {
    border-color: #667eea !important;
    color: #667eea !important;
    cursor: pointer;
}

.zarew-calendar-day.today.available {
    background: #fff;
}

.zarew-calendar-day.today.no-slots {
    background: #fff !important; /* Override striped background - today style takes priority */
}

/* Selected day - purple background, white text (only if available) */
.zarew-calendar-day.selected {
    background: #667eea;
    color: white;
    font-weight: 600;
    border-color: #667eea;
}

/* Selected today - ensure purple background and white text override today styles */
.zarew-calendar-day.today.selected {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea;
}

.zarew-time-slots-section {
    display: flex;
    flex-direction: column;
    gap: 40px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.zarew-time-slots-section .zarew-inputs-row {
    flex-shrink: 0;
}

/* Time Slots */
.zarew-time-slots-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.zarew-time-slots-group:not(.visible) .zarew-time-slots-grid {
    display: none;
}

.zarew-time-slots-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(6, 44px);
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    flex: 1;
    min-height: 0;
}

.zarew-time-slots-grid::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* No slots message - centered, gray text */
.zarew-time-slots-grid.has-no-slots-message {
    display: flex;
    align-items: center;
    justify-content: center;
}

.zarew-no-slots-message {
    color: #666;
    text-align: center;
    padding: 20px;
    margin: 0;
    font-size: 14px;
}

.zarew-time-slot-btn {
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    text-align: center;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.zarew-time-slot-btn:hover:not(:disabled):not(.selected) {
    border-color: #667eea;
    background: #f0f4ff;
}

.zarew-time-slot-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.zarew-time-slot-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Step 3: Contact Info */
.zarew-form-group {
    margin-bottom: 12px;
}

.zarew-form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.zarew-form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.zarew-form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.zarew-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Success Message */
.zarew-success-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    height: 100%;
}

.zarew-success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 24px;
}

.zarew-success-message h3 {
    margin: 0 0 16px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.zarew-success-message p {
    margin: 0;
    font-size: 16px;
    color: #666;
    line-height: 1.5;
}

/* Step 5: Success step */
#zarew-step-5.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Footer */
.zarew-reservation-footer {
    height: 90px;
    padding: 0;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    flex-shrink: 0;
}

.zarew-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zarew-btn-primary {
    background: #667eea;
    color: white;
}

.zarew-btn-primary:hover:not(:disabled) {
    background: #5568d3;
}

.zarew-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.zarew-btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
}

.zarew-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.zarew-btn-group {
    display: flex;
    gap: 12px;
}

/* Loading State */
.zarew-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.zarew-error {
    padding: 16px;
    background: #ffe0e0;
    border: 1px solid #ff9999;
    border-radius: 6px;
    color: #cc0000;
    margin-bottom: 16px;
}

/* Responsive - Mobile/Tablet */
@media (max-width: 768px) {
    .zarew-reservation-overlay {
        align-items: flex-start;
        padding-top: env(safe-area-inset-top, 0);
    }
    
    .zarew-reservation-modal {
        width: 100vw;
        height: 100dvh;
        max-width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
        margin-top: 0;
    }
    
    .zarew-reservation-body {
        padding: 24px;
        height: calc(100dvh - 300px);
        min-height: calc(100dvh - 300px);
        overflow-y: auto;
    }
    
    .zarew-navigation-buttons {
        width: 100%;
        justify-content: flex-end;
        gap: 8px;
    }
    
    .zarew-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .zarew-btn-group {
        gap: 8px;
    }
    
    .zarew-reservation-summary {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
    }
    
    .zarew-reservation-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 180px;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    
    .zarew-summary-item {
        border-right: 1px solid #e0e0e0;
        border-bottom: 1px solid #e0e0e0;
        padding: 12px;
        padding-left: 24px;
    }
    
    .zarew-summary-item:nth-child(2n) {
        border-right: none;
    }
    
    .zarew-summary-item:nth-child(n+3) {
        border-bottom: none;
    }
    
    .zarew-cars-grid {
        grid-template-columns: 1fr;
    }
    
    .zarew-form-row {
        grid-template-columns: 1fr;
    }
    
    .zarew-time-slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        grid-template-rows: unset;
        flex: unset;
    }
    
    .zarew-date-time-container {
        flex-direction: column;
    }
    
    .zarew-calendar-section {
        width: 100%;
        height: 342px;
    }
    
    .zarew-time-slots-section {
        flex: 1;
    }
    
    .zarew-calendar-days {
        flex: none;
        grid-template-columns: repeat(7, 1fr);
    }
    
    .zarew-calendar-day {
        width: auto;
    }
    
    #zarew-reservation-form {
        width: 100%;
    }
    
    .zarew-services-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 500px) {
    .zarew-car-name {
        font-size: 14px;
    }
    
    .zarew-breadcrumb-item:not(.active),
    .zarew-breadcrumb-separator {
        display: none;
    }
    
    /* Hide all active items except the last one */
    .zarew-breadcrumb-item.active:not(.last-active) {
        display: none;
    }
    
    /* Show only the last active item */
    .zarew-breadcrumb-item.active.last-active {
        display: inline-block;
    }
    
    /* Make body content scrollable for step 3 - allows seeing calendar and time slots */
    .zarew-body-content {
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
        align-items: flex-start;
    }
    
    .zarew-body-content::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
    
    /* Ensure step 3 and date-time-container can expand to show all content */
    #zarew-step-3.active {
        height: auto;
        min-height: 100%;
    }
    
    #zarew-step-3.active .zarew-date-time-container {
        height: auto;
        min-height: 100%;
    }
}

