/* Стили для модального окна с услугами */
.purchase-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.purchase-modal-content {
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.purchase-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}

.purchase-modal-header h2 {
    font-size: 24px;
    margin: 0;
    color: #2d3748;
    font-weight: 600;
}

.close-button {
    font-size: 28px;
    border: none;
    background: none;
    cursor: pointer;
    color: #6c757d;
    padding: 8px;
    line-height: 1;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.close-button:hover {
    background: #f8f9fa;
    color: #495057;
}

/* Стили для выбора услуг */
.services-selection {
    margin-bottom: 20px;
}

.services-selection-title {
    margin: 0 0 16px;
    font-weight: 600;
    color: #2d3748;
    font-size: 18px;
}

#servicesContainer {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    background: #f8f9fa;
    max-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.service-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 8px;
    border-bottom: 1px solid #e8e8e8;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-radius: 6px;
}

.service-item:last-child {
    border-bottom: none;
}

.service-item:hover {
    background-color: rgba(66, 153, 225, 0.06);
}

.service-checkbox {
    margin-right: 12px;
    margin-top: 2px;
    transform: scale(1.1);
    cursor: pointer;
    accent-color: #4299e1;
}

.service-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    cursor: pointer;
}

.service-details {
    flex: 1;
}

.service-name {
    font-weight: 500;
    color: #2d3748;
    font-size: 15px;
    margin-bottom: 4px;
}

.service-description {
    font-size: 13px;
    color: #718096;
    line-height: 1.4;
}

.service-price {
    font-weight: 600;
    color: #4299e1;
    margin-left: 12px;
    font-size: 14px;
    white-space: nowrap;
}

.service-free {
    color: #38a169;
}

/* Поля формы */
.form-section {
    margin-bottom: 16px;
}

.form-section-title {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
    font-size: 16px;
}

.modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
    transition: border-color 0.15s ease;
    background: #ffffff;
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.1);
}

.modal-input.error {
    border-color: #e53e3e;
    background: #fed7d7;
}

.error-text {
    display: none;
    color: #e53e3e;
    font-size: 12px;
    margin-top: -8px;
    margin-bottom: 12px;
}

.form-hint {
    font-size: 12px;
    color: #718096;
    margin-top: -8px;
    margin-bottom: 12px;
    line-height: 1.4;
}

/* Промо-код */
.promo-section {
    margin-bottom: 16px;
}

.promo-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.promo-input-group input {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
    height: 44px;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.15s ease;
    background: #ffffff;
    box-sizing: border-box;
}

.promo-input-group input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.1);
}

.promo-input-group button {
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    width: 44px;
    flex-shrink: 0;
    border: 1px solid #4299e1;
    background: transparent;
    border-radius: 6px;
    color: #4299e1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.promo-input-group button:hover {
    background-color: #4299e1;
    color: white;
}

.promo-input-group button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.promo-input-group button.btn-success {
    border-color: #38a169;
    background-color: #38a169;
    color: white;
}

.promo-input-group button.btn-success:hover {
    background-color: #2f855a;
    border-color: #276749;
}

.promo-status {
    display: block;
    font-size: 12px;
    margin-top: 8px;
    line-height: 1.3;
}

.promo-status.success {
    color: #38a169;
}

.promo-status.error {
    color: #e53e3e;
}

.promo-input-group input:disabled {
    background-color: #f7fafc;
    cursor: not-allowed;
}

/* Итоговая стоимость */
.total-price-section {
    background: #f0f8ff;
    border: 1px solid #90cdf4;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.total-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.total-price-label {
    font-weight: 600;
    color: #2d3748;
    font-size: 16px;
}

#totalPrice {
    font-size: 20px;
    font-weight: 700;
    color: #1a365d;
    transition: color 0.2s ease;
}

#priceBreakdown {
    font-size: 12px;
    color: #4a5568;
    line-height: 1.4;
    margin-top: 4px;
}

/* Кнопки */
.button-container {
    text-align: right;
    padding-top: 8px;
}

.cancel-button {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-right: 12px;
    transition: all 0.15s ease;
}

.cancel-button:hover {
    background: #edf2f7;
    color: #2d3748;
}

.pay-button {
    background: #1976d2;
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 4px rgba(25, 118, 210, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
}

.pay-button:hover {
    background: #1565c0;
    transform: translateY(-1px);
}

.pay-button:active {
    transform: translateY(0);
    background: #0d47a1;
}

.pay-button:disabled {
    background: #90a4ae;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pay-button.loading {
    background: #90a4ae;
    cursor: default;
    transform: none;
}

.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 0.15em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .purchase-modal-content {
        width: 95%;
        max-height: 95vh;
        padding: 16px;
    }

    .purchase-modal-header h2 {
        font-size: 20px;
    }

    .services-selection-title {
        font-size: 16px;
    }

    #servicesContainer {
        max-height: 200px;
    }

    .service-name {
        font-size: 14px;
    }

    .service-description {
        font-size: 12px;
    }

    .button-container {
        text-align: center;
    }

    .cancel-button, .pay-button {
        width: 100%;
        margin: 4px 0;
    }
}