/* Основные стили для мини-магазина */
.telegram-shop-container {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    padding: 5px;
    background: #ffffff;
    min-height: 100vh;
    box-sizing: border-box;
    
    /* Цветовые переменные */
    --primary-color: #3498db;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --text-color: #222;
    --bg-color: #fff;
}

/* Сетка товаров */
#catalog {
    display: grid;
    gap: 10px;
}

#catalog.cols-1 {
    grid-template-columns: 1fr;
}

#catalog.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

#catalog.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1024px) {
    #catalog.cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    #catalog.cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* На мобильных устройствах 2 колонки */
@media (max-width: 480px) {
    #catalog.cols-2,
    #catalog.cols-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .telegram-shop-container {
        padding: 5px;
    }
    
    .product {
        padding: 8px;
    }
    
    .gallery img {
        height: 180px;
    }
}

/* Для совсем маленьких экранов 1 колонка */
@media (max-width: 400px) {
    #catalog.cols-2,
    #catalog.cols-3 {
        grid-template-columns: 1fr;
    }
}

.product {
    display: flex;
    flex-direction: column;
    background: #fff;
    padding: 8px;
    transition: all 0.3s;
    /* Убраны: border-radius и box-shadow */
}

.product:hover {
    transform: translateY(-3px);
    /* Убрана box-shadow */
}

.product img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    margin-bottom: 15px;
    /* Убран border-radius */
}

.info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.info h3 {
    margin: 0 0 10px;
    font-size: 16px;
    line-height: 1.3;
    color: var(--text-color);
    flex-grow: 1;
}

.product-price {
    font-size: 18px;
    color: var(--danger-color);
    font-weight: bold;
    margin: 0 0 15px;
    text-align: center;
}

.stock-status {
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
    font-weight: bold;
}

.button-container {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.details-btn, .buy-btn {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-size: 14px;
    cursor: pointer;
    background: #f5f5f5;
    transition: all 0.3s;
    border: none;
    /* Убран border-radius */
}

.details-btn {
    background: var(--primary-color);
    color: white;
}

.buy-btn {
    background: var(--success-color);
    color: white;
}

.details-btn:hover {
    background: #2980b9;
}

.buy-btn:hover {
    background: #27ae60;
}

.buy-btn.disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* Темная тема для Telegram */
body.telegram-dark-mode .telegram-shop-container {
    background: #1a1a1a;
    color: #f0f0f0;
    
    /* Переменные для темной темы */
    --text-color: #f0f0f0;
    --bg-color: #1a1a1a;
}

body.telegram-dark-mode #catalog,
body.telegram-dark-mode #detail {
    background: #2a2a2a;
    color: #f0f0f0;
}

body.telegram-dark-mode .product {
    background: #2a2a2a;
}

body.telegram-dark-mode .telegram-shop-search {
    background: #333;
    color: #fff;
    border-color: #444;
}

.telegram-close-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #f44336;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Убран border-radius */
}

.telegram-shop-search {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 1px solid #ddd;
    margin-bottom: 20px;
    box-sizing: border-box;
    /* Убран border-radius */
}

#detail {
    display: none;
    background: #fff;
    padding: 20px;
    /* Убран border-radius */
}

body.telegram-dark-mode #detail {
    background: #2a2a2a;
}

.telegram-shop-back-btn {
    display: block;
    margin-bottom: 20px;
    background: #f1f1f1;
    border: none;
    color: #333;
    font-size: 16px;
    cursor: pointer;
    padding: 10px 18px;
    transition: all 0.3s;
    /* Убран border-radius */
}

body.telegram-dark-mode .telegram-shop-back-btn {
    background: #333;
    color: #f0f0f0;
}

.telegram-shop-back-btn:hover {
    background: #e0e0e0;
}

body.telegram-dark-mode .telegram-shop-back-btn:hover {
    background: #444;
}

.gallery {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    scrollbar-width: thin;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.gallery::-webkit-scrollbar {
    height: 6px;
}

.gallery::-webkit-scrollbar-thumb {
    background: #ccc;
    /* Убран border-radius */
}

.gallery img {
    height: 250px;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
    /* Убран border-radius */
}

.gallery img:hover {
    transform: scale(1.03);
}

.product-main-image {
    width: 100%;
    margin-bottom: 25px;
    /* Убран border-radius */
}

#detail-content h2 {
    margin-top: 0;
    color: var(--text-color);
    font-size: 24px;
    margin-bottom: 10px;
}

/* Стили статуса наличия в деталях */
#detail-content .in-stock {
    color: var(--success-color);
    font-weight: bold;
    margin-bottom: 15px;
}

#detail-content .out-of-stock {
    color: var(--danger-color);
    font-weight: bold;
    margin-bottom: 15px;
}

.product-description {
    font-size: 16px;
    line-height: 1.6;
    color: #444;
    margin-bottom: 25px;
}

body.telegram-dark-mode .product-description {
    color: #ccc;
}

.detail-button-container {
    margin-top: 20px;
}

#buy-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 25px;
    font-size: 18px;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s;
    font-weight: bold;
    display: block;
    width: 100%;
    /* Убран border-radius */
}

#buy-btn:hover {
    background: #2980b9;
}

/* Стили для неактивной кнопки */
#buy-btn.disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

#buy-btn.disabled:hover {
    background: #95a5a6;
}

.no-results {
    text-align: center;
    color: #888;
    padding: 30px;
    font-size: 18px;
    grid-column: 1 / -1;
}

/* Адаптивность */
@media (max-width: 600px) {
    .button-container {
        flex-direction: column;
    }
    
    .gallery img {
        height: 180px;
    }
    
    .telegram-shop-container {
        padding: 5px;
    }
    
    #catalog, #detail {
        padding: 10px;
    }
}