/* templates/css/main.css - стили главной и каталога */

:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --container: min(100% - 32px, 1200px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg); color: var(--text); line-height: 1.6;
    min-height: 100vh;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

.container { width: var(--container); margin: 0 auto; }

/* ===== HEADER ===== */
.header {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: sticky; top: 0; z-index: 50;
}
.header__inner {
    width: var(--container); margin: 0 auto;
    display: flex; align-items: center; gap: 24px;
}
.header__logo {
    font-size: 1.4rem; font-weight: 800; color: var(--accent);
    letter-spacing: -0.5px;
}
.header__nav { display: flex; gap: 20px; }
.header__nav-link {
    font-size: 0.95rem; font-weight: 500; color: var(--text-secondary);
    transition: color var(--transition);
}
.header__nav-link:hover { color: var(--accent); }
.header__search {
    position: relative; margin-left: auto;
}
.header__search input {
    width: 280px; padding: 10px 16px;
    border: 1.5px solid var(--border); border-radius: 99px;
    font-size: 0.9rem; outline: none; transition: all var(--transition);
    background: var(--surface);
}
.header__search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.search-results {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: var(--surface); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg); border: 1px solid var(--border);
    max-height: 400px; overflow-y: auto;
    display: none; z-index: 100;
}
.search-results--open { display: block; }
.search-result-item {
    display: flex; gap: 12px; padding: 12px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f8fafc; }
.search-result-item img {
    width: 50px; height: 66px; object-fit: cover;
    border-radius: 6px; flex-shrink: 0;
}
.search-result-item__info { flex: 1; min-width: 0; }
.search-result-item__title {
    font-size: 0.9rem; font-weight: 600; color: var(--text);
    margin-bottom: 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-result-item__price {
    font-size: 0.85rem; color: var(--accent); font-weight: 700;
}
.search-result-item__category {
    font-size: 0.75rem; color: var(--text-muted);
}
.search-no-results {
    padding: 20px; text-align: center; color: var(--text-muted);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .header__nav { display: none; }
    .header__search { flex: 1; }
    .header__search input { width: 100%; }
}

/* ===== HERO ===== */
.hero {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: #fff;
    padding: clamp(40px, 8vw, 80px) 0;
    text-align: center;
}
.hero__content { width: var(--container); margin: 0 auto; }
.hero__title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 800; margin-bottom: 16px;
    letter-spacing: -0.5px;
}
.hero__subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    opacity: 0.9; margin-bottom: 28px;
    max-width: 600px; margin-left: auto; margin-right: auto;
}
.hero__btn {
    display: inline-block;
    padding: 14px 32px;
    background: #fff; color: var(--accent);
    border-radius: 99px; font-weight: 700;
    font-size: 1rem;
    transition: all var(--transition);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.hero__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* ===== SECTIONS ===== */
.section {
    padding: clamp(32px, 5vw, 60px) 0;
}
.section__title {
    font-size: clamp(1.4rem, 2.5vw, 1.8rem);
    font-weight: 800; margin-bottom: 24px;
    letter-spacing: -0.3px;
}

/* ===== CATEGORIES ===== */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.category-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    transition: all var(--transition);
    cursor: pointer;
}
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}
.category-card__name {
    font-size: 1.1rem; font-weight: 700;
    margin-bottom: 6px;
}
.category-card__count {
    font-size: 0.85rem; color: var(--text-muted);
}

/* ===== PRODUCTS GRID ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.product-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all var(--transition);
    display: flex; flex-direction: column;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.product-card__image {
    position: relative;
    aspect-ratio: 3 / 4;
    background: #f1f5f9;
    overflow: hidden;
}
.product-card__image img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.3s ease;
}
.product-card:hover .product-card__image img {
    transform: scale(1.05);
}
.product-card__no-image {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 0.9rem;
}
.product-card__badge {
    position: absolute; top: 10px; left: 10px;
    background: #ea580c; color: #fff;
    font-size: 0.7rem; font-weight: 700;
    padding: 4px 10px; border-radius: 99px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.product-card__info {
    padding: 14px;
    display: flex; flex-direction: column; gap: 6px;
    flex: 1;
}
.product-card__category {
    font-size: 0.75rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.product-card__title {
    font-size: 0.95rem; font-weight: 600;
    line-height: 1.3; color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-card__price {
    font-size: 1.1rem; font-weight: 800;
    color: var(--accent); margin-top: auto;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 32px 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== CATALOG PAGE ===== */
.catalog-header {
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    margin-bottom: 24px;
}
.catalog-header__title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
}
.catalog-header__subtitle {
    color: var(--text-muted);
    margin-top: 4px;
    font-size: 0.9rem;
}
.catalog-filters {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-bottom: 24px;
}
.catalog-filter {
    padding: 8px 16px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    cursor: pointer;
    text-decoration: none;
}
.catalog-filter:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.catalog-filter--active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

@media (max-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .product-card__info { padding: 10px; }
    .product-card__title { font-size: 0.85rem; }
    .product-card__price { font-size: 0.95rem; }
}