/* style-mainpage.css - УЛУЧШЕННАЯ ВЕРСИЯ */
/* NEODROP 2030 - Main Page Styles */

:root {
    --primary-color: #0066ff;
    --primary-light: #e6f0ff;
    --primary-dark: #0052cc;
    --bg-color: #f8faff;
    --text-color: #1a1a2e;
    --text-light: #5e6e82;
    --gray-light: #f0f4f9;
    --gray-medium: #d9e2ec;
    --gray-dark: #9fb3c8;
    --error-color: #ff2200;
    --success-color: #00c853;
    --warning-color: #ffab00;
    --radius-large: 24px;
    --radius-medium: 16px;
    --radius-small: 8px;
    --shadow-sm: 0 4px 12px rgba(0, 102, 255, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 102, 255, 0.15);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.products_list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Улучшенный адаптивный грид */
@media (max-width: 1200px) {
    .products_list {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.25rem;
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .products_list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .products_list {
        grid-template-columns: repeat(2, 1fr); /* Фиксировано 2 колонки на мобильных */
        gap: 0.75rem;
        padding: 0.75rem;
    }
}

@media (max-width: 400px) {
    .products_list {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0.5rem;
    }
}

.product_card {
    background: white;
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product_card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.product_image_container {
    position: relative;
    width: 100%;
    flex-shrink: 0;
}

.product_photo_block {
    width: 100%;
    height: 330px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: var(--transition);
}

.product_card:hover .product_photo_block {
    transform: scale(1.05);
}

.prod_name {
    padding: 1rem 1rem 0.5rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3em;
    flex: 1;
}

.card_description {
    padding: 0 1rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.prod_prize {
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 700;
    flex: 1;
}

.to__basket {
    margin-left: auto;
}

.BasketBtn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-medium);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    white-space: nowrap;
    width: 100%;
    min-width: 120px;
}

.BasketBtn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.to__basket a {
    display: inline-block;
    background: var(--success-color);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-medium);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    white-space: nowrap;
    width: 100%;
    text-align: center;
}

.to__basket a:hover {
    background: #00b347;
    transform: translateY(-2px);
}

/* Стили избранного - ИСХОДНАЯ ЛОГИКА */
.favourite_btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 26px;
    height: 18px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.favourite_btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 31px;
    height: 31px;
    background-size: contain;
    background-repeat: no-repeat;
    transition: var(--transition);
    background-image: url("{% static 'images/icons8-heart-96(3).png' %}");
    z-index: 1;
}

.favourite_btn.active::before {
    background-image: url("{% static 'images/icons8-heart-96(5).png' %}");
}

.favourite_btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background-size: contain;
    background-repeat: no-repeat;
    transition: var(--transition);
    background-image: url("{% static 'images/icons8-heart-96(2).png' %}");
    z-index: 2;
}

.favourite_btn:hover::after {
    background-image: url("{% static 'images/icons8-сердце-96.png' %}");
}

.favourite_btn:hover {
    transform: scale(1.1);
}

/* Улучшенное всплывающее окно */
.alert_window {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    z-index: 1000;
    max-width: 400px;
    width: 90%;
    animation: fadeIn 0.3s ease;
    border: 1px solid var(--gray-medium);
}

.alert_window h2 {
    color: var(--text-color);
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
}

.sizes_labels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.select_size_block {
    display: flex;
    justify-content: center;
}

.select_size_block input[type="checkbox"] {
    display: none;
}

.select_size_block input[type="checkbox"] + label {
    display: inline-block;
    width: 60px;
    height: 40px;
    border: 2px solid var(--gray-medium);
    border-radius: var(--radius-small);
    text-align: center;
    line-height: 36px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    color: var(--text-light);
    background: white;
}

.select_size_block input[type="checkbox"]:checked + label {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
    color: var(--primary-color);
    transform: scale(1.05);
}

.select_size_block input[type="checkbox"] + label:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.alert_buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.alert_button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--radius-medium);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    min-width: 120px;
    flex: 1;
}

.alert_button:first-child {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.alert_button:first-child:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.alert_button:first-child:disabled {
    background: var(--gray-medium);
    color: var(--text-light);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.alert_button:last-child {
    background: var(--gray-light);
    color: var(--text-color);
}

.alert_button:last-child:hover {
    background: var(--gray-medium);
    transform: translateY(-2px);
}

/* Overlay для alert */
.alert_window_overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(5px);
}

.alert_window.active {
    display: block;
}

.alert_window_overlay.active {
    display: block;
}

/* Анимации */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translate(-50%, -40%) scale(0.9); 
    }
    to { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1); 
    }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .product_photo_block {
        height: 260px;
    }
    
    .prod_name {
        font-size: 1rem;
        padding: 0.8rem 0.8rem 0.4rem;
        min-height: 2.8em;
    }
    
    .card_description {
        padding: 0 0.8rem 0.8rem;
        gap: 0.4rem;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .prod_prize {
        font-size: 1.1rem;
        order: 1;
    }
    
    .to__basket {
        margin-left: 0;
        width: 100%;
        order: 2;
    }
    
    .BasketBtn,
    .to__basket a {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        width: 100%;
    }
    
    .favourite_btn {
        width: 23px;
        height: 15px;
        top: 10px;
        right: 10px;
    }
    
    .favourite_btn::before
    {
        width: 27px;
        height: 27px;
    }
    .favourite_btn::after {
        width: 28px;
        height: 28px;
    }
    
    /* Адаптивность всплывающего окна */
    .alert_window {
        padding: 1.5rem;
        max-width: 350px;
    }
    
    .sizes_labels {
        grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
        gap: 0.6rem;
    }
    
    .select_size_block input[type="checkbox"] + label {
        width: 50px;
        height: 35px;
        line-height: 31px;
        font-size: 0.9rem;
    }
    
    .alert_buttons {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .alert_button {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .products_list {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .product_photo_block {
        height: 215px;
    }
    
    .prod_name {
        font-size: 0.95rem;
        padding: 0.6rem 0.6rem 0.3rem;
        min-height: 2.6em;
    }
    
    .alert_window {
        padding: 1.25rem;
        max-width: 300px;
    }
    
    .alert_window h2 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .sizes_labels {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }
    
    .select_size_block input[type="checkbox"] + label {
        width: 45px;
        height: 32px;
        line-height: 28px;
        font-size: 0.85rem;
    }
}

@media (max-width: 400px) {
    .products_list {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .product_photo_block {
        height: 210px;
    }
    
    .alert_window {
        padding: 1rem;
        max-width: 280px;
    }
    
    .sizes_labels {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Grid автоподстройка для разных экранов */
@supports (grid-template-columns: repeat(auto-fit, minmax(min-content, 1fr))) {
    .products_list {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Улучшенные hover-эффекты */
@media (hover: hover) {
    .product_card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-md);
    }
    
    .BasketBtn:hover,
    .to__basket a:hover {
        transform: translateY(-2px);
    }
}

/* Улучшения для touch-устройств */
@media (pointer: coarse) {
    .BasketBtn,
    .to__basket a,
    .alert_button {
        min-height: 35px; /* Минимальный размер для touch */
    }
    
    .favourite_btn {
        min-width: 20px;
        min-height: 15px;
    }
}