* { box-sizing: border-box; margin: 0; padding: 0; }
:root { --accent: #4f7cff; --dark: #14151a; --bg: #f7f7f8; --card: #fff; --text: #1a1a1a; --muted: #888; --border: #eaeaea; }
html, body { overflow-x: hidden; max-width: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); line-height: 1.5; }
.site-header { display: flex; align-items: center; gap: 24px; padding: 14px 32px; background: var(--dark); color: #fff; position: sticky; top: 0; z-index: 100; }
.site-header .logo { color: #fff; text-decoration: none; font-weight: 700; font-size: 20px; letter-spacing: 0.5px; white-space: nowrap; }
.search-form { flex: 1; display: flex; max-width: 480px; }
.search-form input { flex: 1; padding: 9px 14px; border: none; border-radius: 8px 0 0 8px; font-size: 14px; outline: none; }
.search-form button { padding: 9px 18px; border: none; background: var(--accent); color: #fff; border-radius: 0 8px 8px 0; cursor: pointer; font-size: 14px; }
.account-link, .cart-link { color: #fff; text-decoration: none; font-size: 14px; white-space: nowrap; opacity: 0.9; }
.account-link:hover, .cart-link:hover { opacity: 1; }
.account-link { margin-left: auto; }
main { max-width: 1280px; margin: 0 auto; padding: 28px 32px; }
.layout { display: flex; gap: 32px; align-items: flex-start; }
.sidebar { width: 260px; flex-shrink: 0; background: var(--card); border-radius: 12px; padding: 16px; position: sticky; top: 80px; }
.sidebar h3 { font-size: 15px; margin-bottom: 12px; }
.cat-tree { list-style: none; }
.cat-tree > li { margin-bottom: 2px; }
.cat-all { display: block; padding: 8px 10px; color: var(--text); text-decoration: none; border-radius: 8px; font-size: 14px; }
.cat-all.active, .cat-all:hover { background: #eef1ff; color: var(--accent); }
.cat-header { display: flex; align-items: center; }
.cat-title { flex: 1; display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; color: var(--text); text-decoration: none; border-radius: 8px; font-size: 14px; }
.cat-title.active, .cat-title:hover { background: #eef1ff; color: var(--accent); }
.cat-toggle { background: none; border: none; cursor: pointer; font-size: 12px; color: var(--muted); padding: 6px 10px; transition: transform 0.2s; }
.cat-node.open .cat-toggle { transform: rotate(180deg); }
.cat-brands { list-style: none; max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.cat-node.open .cat-brands { max-height: 3000px; }
.cat-brands a { display: flex; justify-content: space-between; padding: 6px 10px 6px 22px; color: #666; text-decoration: none; border-radius: 8px; font-size: 13px; }
.cat-brands a.active, .cat-brands a:hover { background: #f0f0f5; color: var(--accent); }
.count { color: #b0b0b0; font-size: 12px; font-weight: 400; }
.product-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.product-card { background: var(--card); border-radius: 12px; padding: 14px; transition: box-shadow 0.2s, transform 0.2s; display: flex; flex-direction: column; }
.product-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); transform: translateY(-2px); }
.product-card a { text-decoration: none; color: inherit; }
.product-card img { width: 100%; height: 170px; object-fit: contain; }
.product-card .no-image { width: 100%; height: 170px; display: flex; align-items: center; justify-content: center; background: #f5f5f7; color: #bbb; border-radius: 8px; font-size: 13px; }
.product-card h4 { font-size: 14px; margin: 10px 0 6px; line-height: 1.35; font-weight: 500; min-height: 38px; word-wrap: break-word; overflow-wrap: break-word; }
.price { font-weight: 700; color: var(--accent); font-size: 17px; margin: 6px 0 10px; }
.add-to-cart { margin-top: auto; width: 100%; padding: 10px; background: var(--dark); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; transition: background 0.15s; }
.add-to-cart:hover { background: var(--accent); }
.pagination { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 28px; justify-content: center; max-width: 100%; }
.pagination a { padding: 7px 13px; border-radius: 8px; background: var(--card); text-decoration: none; color: var(--text); font-size: 14px; }
.pagination a.active { background: var(--accent); color: #fff; }
.pagination a:hover { background: #eef1ff; color: var(--accent); }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.product-detail { display: grid; grid-template-columns: 360px 1fr; gap: 40px; background: var(--card); padding: 32px; border-radius: 16px; }
.product-image-box { width: 360px; height: 360px; background: #f5f5f7; border-radius: 14px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-image-box img { width: 100%; height: 100%; object-fit: contain; padding: 20px; }
.product-image-box .no-image { color: #bbb; font-size: 14px; }
.product-info h1 { font-size: 26px; line-height: 1.25; margin-bottom: 14px; }
.product-info .price { font-size: 26px; margin: 0 0 20px; }
.product-info .add-to-cart { max-width: 320px; padding: 13px; font-size: 15px; }
.favorite-btn { margin-top: 10px; max-width: 320px; width: 100%; padding: 11px; background: #fff; border: 1px solid #ddd; border-radius: 8px; cursor: pointer; font-size: 14px; transition: all 0.15s; }
.favorite-btn:hover { border-color: var(--accent); color: var(--accent); }
.specs-table { width: 100%; max-width: 480px; margin-top: 24px; border-collapse: collapse; }
.specs-table td { padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.specs-table td:first-child { color: var(--muted); width: 180px; }
.description { margin-top: 20px; font-size: 15px; color: #444; line-height: 1.65; max-width: 560px; }
.back-link { display: inline-block; margin-top: 24px; color: var(--accent); text-decoration: none; font-size: 14px; }
h1 { font-size: 26px; margin-bottom: 20px; }
h2 { font-size: 20px; margin: 28px 0 14px; }
#login-form, #register-form, #order-form { display: flex; flex-direction: column; gap: 12px; max-width: 400px; background: var(--card); padding: 24px; border-radius: 12px; }
#login-form input, #register-form input, #order-form input, #order-form textarea { padding: 11px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; outline: none; }
#login-form input:focus, #register-form input:focus, #order-form input:focus { border-color: var(--accent); }
#login-form button, #register-form button, #order-form button { padding: 12px; background: var(--accent); color: #fff; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 15px; }
#result { margin-top: 12px; color: #c0392b; font-size: 14px; }
.cart-row { display: flex; align-items: center; gap: 16px; padding: 14px; background: var(--card); border-radius: 10px; margin-bottom: 10px; }
.cart-row .qty-input { width: 64px; padding: 6px; border: 1px solid #ddd; border-radius: 6px; }
.remove-btn { padding: 6px 12px; background: #fff; border: 1px solid #ddd; border-radius: 6px; cursor: pointer; color: #c0392b; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
.admin-table th, .admin-table td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; }
.admin-table th { background: #fafafa; font-weight: 600; }
.order-success { background: var(--card); padding: 32px; border-radius: 16px; max-width: 500px; }
.site-footer { text-align: center; padding: 32px 20px; color: #aaa; font-size: 12px; }
#toast-notification { position: fixed; bottom: 24px; right: 24px; background: var(--dark); color: #fff; padding: 14px 20px; border-radius: 10px; font-size: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.25); opacity: 0; transform: translateY(20px); transition: opacity 0.25s, transform 0.25s; pointer-events: none; z-index: 1000; }
#toast-notification.show { opacity: 1; transform: translateY(0); }
@media (max-width: 900px) {
    .site-header { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
    .site-header .logo { font-size: 18px; }
    .search-form { order: 3; max-width: 100%; width: 100%; }
    .account-link { margin-left: auto; }
    .layout { flex-direction: column; }
    .sidebar { width: 100%; position: static; }
    .product-detail { grid-template-columns: 1fr; }
    .product-image-box { width: 100%; }
    main { padding: 16px 12px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-card { padding: 10px; }
    .product-card img, .product-card .no-image { height: 130px; }
    .product-card h4 { font-size: 13px; min-height: 34px; }
    .quick-view { font-size: 12px; padding: 6px; }
}
.quick-view { width: 100%; padding: 8px; margin-bottom: 6px; background: #fff; border: 1px solid #ddd; border-radius: 8px; cursor: pointer; font-size: 13px; color: #555; transition: all 0.15s; }
.quick-view:hover { border-color: var(--accent); color: var(--accent); }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 2000; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: 16px; max-width: 700px; width: 100%; padding: 28px; position: relative; }
.modal-close { position: absolute; top: 14px; right: 18px; background: none; border: none; font-size: 28px; cursor: pointer; color: #999; line-height: 1; }
.modal-body { display: grid; grid-template-columns: 260px 1fr; gap: 28px; }
.modal-img { width: 260px; height: 260px; background: #f5f5f7; border-radius: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.modal-img img { width: 100%; height: 100%; object-fit: contain; padding: 16px; }
.modal-info h2 { font-size: 22px; margin-bottom: 14px; }
.modal-price { font-size: 24px; font-weight: 700; color: var(--accent); margin-bottom: 20px; }
.modal-add { width: 100%; max-width: 280px; padding: 12px; background: var(--dark); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 15px; }
.modal-add:hover { background: var(--accent); }
.modal-full { display: inline-block; margin-top: 14px; color: var(--accent); text-decoration: none; }
@media (max-width: 600px) { .modal-body { grid-template-columns: 1fr; } .modal-img { width: 100%; } }
.wa-float { position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px; background: #25D366; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(0,0,0,0.2); z-index: 900; transition: transform 0.2s; }
.wa-float:hover { transform: scale(1.08); }
@media (max-width: 900px) { .wa-float { width: 50px; height: 50px; bottom: 16px; right: 16px; } }
.hero-banner { background: linear-gradient(135deg, #4f7cff 0%, #6a3fff 100%); border-radius: 16px; padding: 48px 40px; margin-bottom: 32px; color: #fff; }
.hero-text h1 { font-size: 32px; margin-bottom: 12px; color: #fff; line-height: 1.2; }
.hero-text p { font-size: 16px; opacity: 0.92; margin-bottom: 24px; max-width: 560px; }
.hero-btn { display: inline-block; background: #fff; color: #4f7cff; padding: 12px 28px; border-radius: 10px; text-decoration: none; font-weight: 600; transition: transform 0.15s; }
.hero-btn:hover { transform: translateY(-2px); }
.home-block { margin-bottom: 36px; }
.home-block h2 { font-size: 22px; margin-bottom: 16px; }
.home-scroll { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.home-scroll::-webkit-scrollbar { height: 6px; }
.home-scroll::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
.mini-card { flex: 0 0 180px; background: var(--card); border-radius: 12px; padding: 12px; scroll-snap-align: start; transition: box-shadow 0.2s; }
.mini-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); }
.mini-card a { text-decoration: none; color: inherit; }
.mini-card img { width: 100%; height: 130px; object-fit: contain; }
.mini-card .no-image { width: 100%; height: 130px; display: flex; align-items: center; justify-content: center; background: #f5f5f7; color: #bbb; border-radius: 8px; font-size: 12px; }
.mini-card h4 { font-size: 13px; margin: 8px 0 4px; line-height: 1.3; font-weight: 500; min-height: 34px; overflow-wrap: break-word; }
@media (max-width: 900px) { .hero-banner { padding: 32px 24px; } .hero-text h1 { font-size: 24px; } .mini-card { flex: 0 0 150px; } }

/* Мобильная кнопка МЕНЮ и выезжающая панель */
#mobile-menu-btn { display: none; }
#sidebar-overlay { display: none; }
@media (max-width: 900px) {
    #mobile-menu-btn {
        display: block;
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 950;
        background: var(--accent);
        color: #fff;
        border: none;
        border-radius: 0 10px 10px 0;
        padding: 16px 8px;
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 1px;
        cursor: pointer;
        box-shadow: 2px 2px 10px rgba(0,0,0,0.2);
        writing-mode: vertical-rl;
        text-orientation: upright;
    }
    #sidebar-overlay.active {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 960;
    }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        max-width: 85%;
        z-index: 970;
        border-radius: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
}
.modal-full { display: inline-block; margin-top: 16px; background: #f0f0f5; color: var(--accent); padding: 10px 20px; border-radius: 8px; text-decoration: none; font-weight: 500; font-size: 14px; transition: background 0.15s; }
.modal-full:hover { background: #e4e4ee; }
