/* =====================================================
   Mary Stylizacja - System Rezerwacji (style)
   ===================================================== */

/* Overlay */
.booking-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: hidden;
}

.booking-overlay.active {
    display: flex;
}

.booking-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 25, 23, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Modal */
.booking-modal {
    position: relative;
    background: #FFFFFF;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.booking-modal::-webkit-scrollbar {
    width: 4px;
}

.booking-modal::-webkit-scrollbar-thumb {
    background: #D6D3D1;
    border-radius: 10px;
}

/* Header */
.booking-header {
    flex-shrink: 0;
    z-index: 10;
    background: #FFFFFF;
    padding: 24px 32px 16px;
    border-bottom: 1px solid #F5F5F4;
}

.booking-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #F5F5F4;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #78716C;
}

.booking-close:hover {
    background: #E7E5E4;
    color: #1C1917;
}

.booking-title {
    font-size: 20px;
    font-weight: 600;
    color: #1C1917;
    margin: 0;
}

.booking-subtitle {
    font-size: 13px;
    color: #A8A29E;
    margin: 4px 0 0;
}

/* Steps indicator */
.booking-steps {
    display: flex;
    gap: 6px;
    padding: 0 32px 16px;
    background: #FFFFFF;
    flex-shrink: 0;
}

.booking-step-dot {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: #E7E5E4;
    transition: background 0.3s;
}

.booking-step-dot.active {
    background: #C5A059;
}

.booking-step-dot.done {
    background: #1C1917;
}

/* Body */
.booking-body {
    padding: 24px 32px 32px;
    flex: 1 1 0%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

/* Step content */
.booking-step {
    display: none;
}

.booking-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Service cards */
.service-option {
    padding: 16px 20px;
    border: 1.5px solid #E7E5E4;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.service-option:hover {
    border-color: #C5A059;
    background: #FFFBEB;
}

.service-option.selected {
    border-color: #C5A059;
    background: #FFFBEB;
    box-shadow: 0 0 0 1px #C5A059;
}

.service-option .service-info h4 {
    font-size: 15px;
    font-weight: 600;
    color: #1C1917;
    margin: 0 0 4px;
}

.service-option .service-info p {
    font-size: 12px;
    color: #A8A29E;
    margin: 0;
}

.service-option .service-price {
    text-align: right;
    white-space: nowrap;
}

.service-option .service-price .price {
    font-size: 15px;
    font-weight: 600;
    color: #1C1917;
}

.service-option .service-price .duration {
    font-size: 11px;
    color: #A8A29E;
    display: block;
    margin-top: 2px;
}

/* Calendar */
.calendar-wrapper {
    user-select: none;
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calendar-nav h4 {
    font-size: 15px;
    font-weight: 600;
    color: #1C1917;
    margin: 0;
}

.calendar-nav button {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #E7E5E4;
    background: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #78716C;
    transition: all 0.2s;
}

.calendar-nav button:hover {
    background: #F5F5F4;
    color: #1C1917;
}

.calendar-nav button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

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

.calendar-day-header {
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: #A8A29E;
    padding: 8px 0;
    text-transform: uppercase;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #78716C;
    cursor: default;
    transition: all 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* iOS Safari fallback for aspect-ratio */
@supports not (aspect-ratio: 1) {
    .calendar-day {
        position: relative;
        height: 0;
        padding-bottom: 100%;
    }
    .calendar-day > * {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
}

.calendar-day.available {
    color: #1C1917;
    cursor: pointer;
    background: #FAFAF9;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.calendar-day.available:hover {
    background: #FFFBEB;
    color: #C5A059;
}

.calendar-day.available:active {
    background: #C5A059 !important;
    color: #FFFFFF !important;
}

.calendar-day.selected {
    background: #C5A059 !important;
    color: #FFFFFF !important;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
}

.calendar-day.today {
    box-shadow: inset 0 0 0 1.5px #C5A059;
}

.calendar-day.disabled {
    color: #D6D3D1;
}

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

/* Time slots */
.slots-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

@media (max-width: 480px) {
    .slots-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.slot-btn {
    padding: 10px 8px;
    border: 1.5px solid #E7E5E4;
    border-radius: 10px;
    background: #FFFFFF;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #1C1917;
    text-align: center;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.slot-btn:hover {
    border-color: #C5A059;
    background: #FFFBEB;
}

.slot-btn:active {
    border-color: #C5A059 !important;
    background: #C5A059 !important;
    color: #FFFFFF !important;
}

.slot-btn.selected {
    border-color: #C5A059 !important;
    background: #C5A059 !important;
    color: #FFFFFF !important;
    -webkit-tap-highlight-color: transparent;
}

.slots-empty {
    text-align: center;
    padding: 40px 20px;
    color: #A8A29E;
    font-size: 14px;
}

/* Form inputs */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #57534E;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #E7E5E4;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: #1C1917;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background: #FFFFFF;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #C5A059;
    box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #D6D3D1;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group .error-msg {
    font-size: 12px;
    color: #DC2626;
    margin-top: 4px;
    display: none;
}

.form-group.has-error input,
.form-group.has-error textarea {
    border-color: #DC2626;
}

.form-group.has-error .error-msg {
    display: block;
}

/* Payment options */
.payment-option {
    padding: 16px 20px;
    border: 1.5px solid #E7E5E4;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.payment-option:hover {
    border-color: #C5A059;
}

.payment-option.selected {
    border-color: #C5A059;
    background: #FFFBEB;
    box-shadow: 0 0 0 1px #C5A059;
}

.payment-radio {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #D6D3D1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.payment-option.selected .payment-radio {
    border-color: #C5A059;
}

.payment-option.selected .payment-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #C5A059;
}

.payment-option .payment-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1C1917;
    margin: 0 0 2px;
}

.payment-option .payment-info p {
    font-size: 12px;
    color: #A8A29E;
    margin: 0;
}

/* Summary */
.summary-card {
    background: #FAFAF9;
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.summary-row:not(:last-child) {
    border-bottom: 1px solid #E7E5E4;
}

.summary-row .label {
    font-size: 13px;
    color: #78716C;
}

.summary-row .value {
    font-size: 14px;
    font-weight: 600;
    color: #1C1917;
}

.summary-total {
    background: #1C1917;
    border-radius: 10px;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-total .label {
    color: #A8A29E;
    font-size: 13px;
}

.summary-total .value {
    color: #C5A059;
    font-size: 18px;
    font-weight: 600;
}

/* Buttons */
.booking-footer {
    flex-shrink: 0;
    z-index: 10;
    padding: 16px 32px 24px;
    display: flex;
    gap: 10px;
    border-top: 1px solid #F5F5F4;
    background: #FFFFFF;
}

.btn-back {
    padding: 12px 20px;
    border: 1.5px solid #E7E5E4;
    border-radius: 10px;
    background: #FFFFFF;
    color: #78716C;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.btn-back:hover {
    background: #F5F5F4;
    color: #1C1917;
}

.btn-next {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    background: #1C1917;
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-next:hover {
    background: #C5A059;
}

.btn-next:disabled {
    background: #D6D3D1;
    cursor: not-allowed;
}

.btn-next.btn-gold {
    background: #C5A059;
}

.btn-next.btn-gold:hover {
    background: #B8933D;
}

/* Loading spinner */
.booking-loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.booking-loading.active {
    display: block;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #E7E5E4;
    border-top-color: #C5A059;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Success */
.booking-success {
    text-align: center;
    padding: 40px 32px;
}

.booking-success .success-icon {
    width: 64px;
    height: 64px;
    background: #D1FAE5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
    color: #059669;
}

.booking-success h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1C1917;
    margin: 0 0 8px;
}

.booking-success p {
    font-size: 14px;
    color: #78716C;
    margin: 0 0 24px;
    line-height: 1.5;
}

.booking-success .btn-close-success {
    padding: 12px 32px;
    border: none;
    border-radius: 10px;
    background: #1C1917;
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

.booking-success .btn-close-success:hover {
    background: #C5A059;
}

.booking-success .btn-manage-visit {
    background: #C5A059;
    color: #FFFFFF;
}

.booking-success .btn-manage-visit:hover {
    background: #B8933E;
}

/* Responsive */
@media (max-width: 640px) {
    .booking-modal {
        height: 92vh;
        height: 92dvh;
        max-height: 92vh;
        max-height: 92dvh;
        border-radius: 20px 20px 0 0;
        margin-top: auto;
    }

    .booking-header {
        padding: 20px 24px 12px;
    }

    .booking-steps {
        padding: 0 24px 12px;
    }

    .booking-body {
        padding: 16px 20px 16px;
    }

    .booking-footer {
        padding: 12px 20px 24px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 12px));
    }

    .booking-overlay {
        align-items: flex-end;
        padding: 0;
    }
}
