/* Оверлей (затемнение фона) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Контейнер модального окна */
.modal-container {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

/* Кнопка закрытия */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #495057;
    z-index: 10;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #e9ecef;
    color: #dc3545;
    transform: rotate(90deg);
}

/* Контент модального окна */
.modal-content {
    padding: 30px;
}

/* Спиннер загрузки */
.modal-loading {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 0.8s linear infinite;
}

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

/* Ошибка загрузки */
.modal-error {
    text-align: center;
    padding: 60px 20px;
    color: #dc3545;
}

.modal-error i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

/* Стили для карточки в модальном окне */
.modal-product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.modal-product-image {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.modal-product-image img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.modal-product-info {
    display: flex;
    flex-direction: column;
}

.modal-product-name {
    font-size: 28px;
    font-weight: 700;
    color: #212529;
    margin: 0 0 15px 0;
}

.modal-product-description {
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 20px;
}

.modal-product-specs {
    margin-bottom: 20px;
    flex-grow: 1;
}

.modal-spec-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f5;
}

.modal-spec-label {
    font-weight: 600;
    color: #495057;
}

.modal-spec-value {
    color: #212529;
}

.modal-product-price {
    font-size: 32px;
    font-weight: 700;
    color: #28a745;
    margin-bottom: 20px;
}

.modal-add-to-cart {
    width: 100%;
    padding: 15px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-add-to-cart:hover {
    background: #0056b3;
}

/* Адаптивность */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 95vh;
        margin: 10px;
    }
    
    .modal-product-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .modal-product-image {
        min-height: 250px;
    }
    
    .modal-content {
        padding: 20px;
    }
}

/* Стили для карточки товара при наведении */
.product-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}