/**
 * Стили для корзины и модального окна заказа
 * @package PharmaDental
 */

/* ==========================================================================
   Модальное окно заказа
   ========================================================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal[aria-hidden="false"] {
    display: flex;
}

.modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.modal__content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
}

.modal__title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
}

.modal__close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.modal__close:hover {
    background-color: #f3f4f6;
}

.modal__close img {
    width: 20px;
    height: 20px;
}

.modal__body {
    padding: 32px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.modal__actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ==========================================================================
   Информация о заказе
   ========================================================================== */

.order-summary {
    background: #f9fafb;
    border-radius: 8px;
    padding: 24px;
}

.order-summary__title {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.order-summary__items {
    margin-bottom: 20px;
}

.order-summary__item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.order-summary__item:last-child {
    border-bottom: none;
}

.order-summary__item-info {
    flex: 1;
}

.order-summary__item-title {
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 4px;
    line-height: 1.4;
}

.order-summary__item-details {
    font-size: 14px;
    color: #6b7280;
}

.order-summary__item-total {
    font-weight: 600;
    color: #1f2937;
    margin-left: 16px;
}

.order-summary__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 2px solid #e5e7eb;
    font-size: 18px;
    font-weight: 600;
}

.order-summary__total-label {
    color: #1f2937;
}

.order-summary__total-price {
    color: #059669;
}

/* ==========================================================================
   Форма заказа
   ========================================================================== */

.order-form {
    display: flex;
    flex-direction: column;
}

.form-field {
    margin-bottom: 20px;
}

.form-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
}

.required {
    color: #dc2626;
}

.form-field input,
.form-field textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-field input:focus,
.form-field textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-field input.is-invalid,
.form-field textarea.is-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.field-error {
    margin-top: 4px;
    font-size: 14px;
    color: #dc2626;
}

.form-footer {
    margin-bottom: 24px;
}

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
    margin-top: 2px;
}

.checkbox span {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

.checkbox a {
    color: #3b82f6;
    text-decoration: none;
}

.checkbox a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Кнопки
   ========================================================================== */

.primary-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-btn:hover {
    background: #2563eb;
    color: white;
}

.primary-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.secondary-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.secondary-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

/* ==========================================================================
   Сообщения
   ========================================================================== */

.form-result {
    margin-top: 16px;
}

.success-message {
    padding: 12px 16px;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    color: #065f46;
    font-weight: 500;
}

.error-message {
    padding: 12px 16px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #991b1b;
    font-weight: 500;
}

/* ==========================================================================
   Уведомления корзины
   ========================================================================== */

.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    padding: 16px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.3s ease-out;
}

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

.alert-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.alert-error,
.alert-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.alert-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* ==========================================================================
   Адаптивность
   ========================================================================== */

@media (max-width: 768px) {
    .modal__content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal__header {
        padding: 20px 24px;
    }
    
    .modal__title {
        font-size: 20px;
    }
    
    .modal__body {
        padding: 24px;
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .order-summary {
        order: 2;
    }
    
    .order-form {
        order: 1;
    }
    
    .modal__actions {
        flex-direction: column-reverse;
    }
    
    .modal__actions .primary-btn,
    .modal__actions .secondary-btn {
        width: 100%;
    }
    
    .cart-notification {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .modal__header {
        padding: 16px 20px;
    }
    
    .modal__body {
        padding: 20px;
    }
    
    .order-summary {
        padding: 20px;
    }
    
    .form-field input,
    .form-field textarea {
        padding: 10px 12px;
    }
}

/* ==========================================================================
   Дополнительные стили для корзины
   ========================================================================== */

.add-to-cart-btn {
    transition: all 0.2s ease;
}

.add-to-cart-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.add-to-cart-btn:active {
    transform: translateY(0);
}

/* Стили для состояния загрузки */
.add-to-cart-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.add-to-cart-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}