/* === Reset === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100vw;
    height: 100%;
    overflow-x: hidden;
    font-family: 'Roboto', sans-serif;
    background-color: #f4f4f4;
    color: #333;
    text-align: center;
    -webkit-font-smoothing: antialiased;
}

/* === Контейнер === */
#app {
    max-width: 100vw;
    padding: 0 5px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Заголовок === */
h1 {
    font-size: 1.6rem;
    margin: 50px 0 20px 0;
}

.page-title {
    font-size: 1.6rem;
    margin: 0;
    padding-top: 10px;
}

/* === Каталог === */
#catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    width: 100%;
    margin: 0 auto;
    justify-content: start;
}

.product {
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    opacity: 0;
    transform: translateY(20px);
}

.product:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

.product img {
    width: 100%;
    border-radius: 10px;
    object-fit: cover;
}

.buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.btn {
    flex: 1;
    text-decoration: none;
    padding: 10px 0;
    margin: 0 2px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.ozon {
    background: linear-gradient(135deg, #00AEEF, #0079B8);
}

.wb {
    background: linear-gradient(135deg, #8A2BE2, #5C00B3);
}

/* === АДМИНКА === */
#admin-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
}

.admin-btn {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 1rem;
    text-decoration: none;
    font-weight: bold;
    width: 240px;
    text-align: center;
    transition: all 0.2s ease;
}

.admin-btn:hover {
    transform: scale(1.03);
}

.admin-form,
.delete-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 90%;
    max-width: 380px;
    margin: 25px auto;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.admin-form input {
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 1rem;
}

/* === Стилизация select === */
.admin-form select {
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 1rem;
    background-color: #fff;
    appearance: none;
    cursor: pointer;
}

/* === Стилизация checkbox === */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 500;
    margin-top: 10px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 1px solid #ccc;
    border-radius: 4px;
    accent-color: #00AEEF;
    cursor: pointer;
}

/* === Список продуктов для удаления === */
.delete-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 90%;
    max-width: 600px;
    margin: 25px auto;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.delete-product-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    background-color: #f9f9f9;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.delete-product-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.delete-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.delete-name {
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    text-align: left;
}

.delete-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 0.9rem;
}

/* === Ссылки === */
.back-link {
    display: inline-block;
    margin: 20px;
    color: #555;
    text-decoration: none;
    font-size: 0.95rem;
}

/* === Блок фильтров === */
#filter-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 15px auto 25px;
}

.filter-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
    color: #222;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(4px);
}

.filter-btn:hover {
    transform: translateY(-2px);
    background: rgba(0, 174, 239, 0.1);
}

.filter-btn.active {
    background: linear-gradient(135deg, #00AEEF, #0079B8);
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 174, 239, 0.3);
}

/* Метка "Новинка" */
.product[data-is-new="1"]::before {
    content: "✨ NEW";
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #ff9a00, #ff4e50);
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: bold;
}

.product {
    position: relative;
}

/* === Исправления для Telegram WebApp fullscreen === */
@supports (-webkit-touch-callout: none) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .admin-form, .delete-form {
        margin-top: 60px;
        margin-bottom: 40px;
        max-width: 420px;
    }

    .admin-btn {
        width: 260px;
    }
}

/* === Адаптив === */
@media screen and (max-width: 500px) {
    h1 {
        font-size: 1.4rem;
    }

    .btn {
        font-size: 0.95rem;
        padding: 10px 0;
    }

    .admin-btn {
        width: 90%;
        padding: 12px;
        font-size: 1rem;
    }

    .admin-form {
        padding: 16px;
    }
}
