/**
 * Calendar Booking Widget Styles
 * Maintains Bootstrap consistency with responsive design
 */

/* Ensure Bootstrap utility classes work within our widget */
.vib-booking-calendar-widget .d-none {
    display: none !important;
}

.vib-booking-calendar-widget .d-flex {
    display: flex !important;
}

.vib-booking-calendar-widget .d-block {
    display: block !important;
}

/* Main Widget Container */
.vib-booking-calendar-widget {
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

/* Progress Indicator */
.vib-progress-container {
    margin-bottom: 1.5rem;
}

.vib-progress-container .step-label {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.vib-progress-container .step-label.active {
    opacity: 1;
    color: var(--bs-primary) !important;
    font-weight: 600;
}

/* Card Styling - Match Bootstrap theme */
.vib-step .card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
}

.vib-step .card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    padding: 1rem 1.5rem;
}

.vib-step .card-header h4 {
    font-weight: 600;
    font-size: 1.25rem;
}

.vib-step .card-body {
    padding: 2rem 1.5rem;
}

/* Form Check Cards for Seller Type */
.form-check-card {
    position: relative;
    margin-bottom: 0.75rem; /* Better spacing on mobile */
}

.form-check-card .form-check-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.form-check-card .card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background-color: #f8f9fa;
    min-height: 120px; /* Better touch targets */
}

.form-check-card .card:hover {
    border-color: var(--bs-primary);
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.form-check-card .form-check-input:checked + .form-check-label .card {
    border-color: var(--bs-primary);
    background-color: rgba(13, 110, 253, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(13, 110, 253, 0.25);
}

.form-check-card .card-body {
    padding: 1.5rem;
}

/* Calendar Container */
#vib-calendar-container {
    min-height: 400px;
}

.vib-calendar {
    background: white;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    overflow: hidden;
}

.vib-calendar-header {
    background: var(--bs-primary);
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.vib-calendar-nav {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.vib-calendar-nav:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.vib-calendar-title {
    font-weight: 600;
    font-size: 1.25rem;
    margin: 0;
}

.vib-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.vib-calendar-day-header {
    padding: 1rem 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: #6c757d;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.vib-calendar-day {
    padding: 0.75rem 0.5rem;
    text-align: center;
    cursor: pointer;
    border: 1px solid #dee2e6;
    border-top: none;
    border-left: none;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
}

.vib-calendar-day:nth-child(7n) {
    border-right: none;
}

.vib-calendar-day.other-month {
    color: #adb5bd;
    background-color: #f8f9fa;
}

.vib-calendar-day.available {
    background-color: #d1ecf1;
    color: #0c5460;
}

.vib-calendar-day.available:hover {
    background-color: #b8daff;
    color: #004085;
    transform: scale(1.05);
}

.vib-calendar-day.selected {
    background-color: var(--bs-primary);
    color: white;
    font-weight: 600;
}

.vib-calendar-day.unavailable {
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Time Slots */
.vib-time-slots {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
}

.vib-time-slots h6 {
    margin-bottom: 1rem;
    color: var(--bs-primary);
    font-weight: 600;
}

.vib-time-slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.vib-time-slot {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.vib-time-slot:hover {
    border-color: var(--bs-primary);
    background-color: rgba(13, 110, 253, 0.1);
}

.vib-time-slot.selected {
    background-color: var(--bs-primary);
    color: white;
    border-color: var(--bs-primary);
}

.vib-time-slot.unavailable {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.5;
}

/* First Available Button */
.vib-first-available {
    background: linear-gradient(45deg, #28a745, #20c997);
    border: none;
    border-radius: 0.375rem;
    padding: 0.75rem 1.5rem;
    color: white;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.vib-first-available:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(40, 167, 69, 0.25);
}

/* Form Styling */
.vib-step input.form-control,
.vib-step select.form-select,
.vib-step textarea.form-control {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    min-height: 48px; /* Better touch targets */
}

.vib-step input.form-control:focus,
.vib-step select.form-select:focus,
.vib-step textarea.form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.vib-step .form-control-lg {
    padding: 1rem 1.25rem;
    font-size: 1.125rem;
}

/* Buttons */
.vib-step .btn {
    border-radius: 0.375rem;
    font-weight: 600;
    padding: 0.75rem 2rem;
    transition: all 0.3s ease;
}

.vib-step .btn-primary {
    background: linear-gradient(45deg, #0d6efd, #6610f2);
    border: none;
}

.vib-step .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(13, 110, 253, 0.25);
}

.vib-step .btn:disabled {
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

/* Service Area Messages */
#service-area-message .alert {
    border-radius: 0.375rem;
    border: none;
    padding: 1rem;
}

#service-area-message .alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

#service-area-message .alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

#territory-upcharge .alert {
    border-left: 4px solid var(--bs-info);
    background-color: #d1ecf1;
    border-radius: 0.375rem;
    color: #0c5460;
}

/* Loading States */
.vib-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.95);
    z-index: 1050;
    backdrop-filter: blur(2px);
}

/* Ensure loading overlay is hidden by default */
.vib-loading-overlay.d-none {
    display: none !important;
}

.spinner-border {
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 1200px) {
    .vib-step .card-body {
        padding: 1.5rem;
    }
}

@media (max-width: 992px) {
    .vib-time-slot-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.5rem;
    }
    
    .vib-calendar-day {
        min-height: 50px;
        font-size: 0.875rem;
    }
}

@media (max-width: 768px) {
    .vib-booking-calendar-widget {
        padding: 0 0.5rem;
    }
    
    .vib-step .card-body {
        padding: 1rem;
    }
    
    .vib-step .card-header {
        padding: 0.75rem 1rem;
    }
    
    .vib-step .card-header h4 {
        font-size: 1.125rem;
    }
    
    /* Make form fields larger on mobile */
    .vib-step input.form-control,
    .vib-step select.form-select,
    .vib-step textarea.form-control {
        min-height: 52px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Better spacing between sections */
    .form-check-card {
        margin-bottom: 1rem;
    }
    
    /* Stack form fields vertically on mobile */
    .row .col-md-6 {
        margin-bottom: 1rem;
    }
    
    /* Larger touch targets for selection cards */
    .form-check-card .card {
        min-height: 100px;
        padding: 0.5rem;
    }
    
    .vib-calendar-header {
        padding: 0.75rem;
    }
    
    .vib-calendar-title {
        font-size: 1.125rem;
    }
    
    .vib-calendar-day {
        min-height: 40px;
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    .vib-time-slots {
        padding: 1rem;
    }
    
    .vib-time-slot-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }
    
    .vib-time-slot {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    .vib-step .btn {
        padding: 0.75rem 1.5rem;
    }
    
    .form-check-card .card-body {
        padding: 1rem;
    }
    
    .vib-progress-container .step-label {
        font-size: 0.75rem;
    }
}

@media (max-width: 576px) {
    .vib-calendar-day-header,
    .vib-calendar-day {
        font-size: 0.75rem;
    }
    
    .vib-calendar-day {
        min-height: 35px;
    }
    
    .vib-time-slot-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .vib-step .row > .col-md-6,
    .vib-step .row > .col-md-4 {
        margin-bottom: 1rem;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.slide-out-left {
    animation: slideOutLeft 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from { 
        opacity: 0;
        transform: translateX(50px);
    }
    to { 
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutLeft {
    from { 
        opacity: 1;
        transform: translateX(0);
    }
    to { 
        opacity: 0;
        transform: translateX(-50px);
    }
}

/* VIN Input Special Styling */
#vehicle_vin {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
}

/* Google Places Autocomplete Styling */
.pac-container {
    z-index: 1060;
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.pac-item {
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem;
}

.pac-item:hover {
    background-color: #f8f9fa;
}

.pac-item-selected {
    background-color: var(--bs-primary);
    color: white;
}