* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --red: #d0021b;
  --dark: #1a1a2e;
  --mid: #2d2d44;
  --gray: #f4f5f7;
  --border: #e0e0e0;
  --text: #333;
  --muted: #777;
}
body { font-family: 'Segoe UI', Arial, sans-serif; color: var(--text); background: #fff; }

/* TOP BAR */
.topbar { background: var(--dark); color: #aaa; font-size: 12px; padding: 6px 0; }
.topbar .inner { max-width: 1200px; margin: auto; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; }
.topbar a { color: #aaa; text-decoration: none; margin-left: 16px; }
.topbar a:hover { color: #fff; }

/* HEADER */
header { background: var(--mid); padding: 14px 0; }
header .inner { max-width: 1200px; margin: auto; padding: 0 20px; display: flex; align-items: center; gap: 30px; }
.logo { font-size: 26px; font-weight: 800; color: #fff; text-decoration: none; letter-spacing: -1px; }
.logo span { color: var(--red); }
.header-phone { color: #ccc; font-size: 14px; margin-left: auto; }
.header-phone strong { color: #fff; font-size: 18px; display: block; }
.cart-btn { background: var(--red); color: #fff; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.cart-btn:hover { background: #b00118; }
.cart-btn.green { background: #28a745; }
.cart-btn.green:hover { background: #1e7e34; }

/* NAV */
nav { background: var(--red); }
nav .inner { max-width: 1200px; margin: auto; padding: 0 20px; display: flex; }
nav a { color: #fff; text-decoration: none; padding: 12px 16px; font-size: 14px; font-weight: 500; display: block; border-right: 1px solid rgba(255,255,255,0.15); }
nav a:hover, nav a.active { background: rgba(0,0,0,0.2); }

/* SEARCH HERO */
.search-hero { background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%); padding: 40px 20px; }
.search-hero .inner { max-width: 1200px; margin: auto; }
.search-hero h1 { color: #fff; font-size: 28px; margin-bottom: 6px; }
.search-hero p { color: #aaa; margin-bottom: 24px; font-size: 15px; }
.search-tabs { display: flex; }
.search-tab { background: rgba(255,255,255,0.1); color: #ccc; border: none; padding: 10px 20px; cursor: pointer; font-size: 14px; font-weight: 600; border-radius: 6px 6px 0 0; transition: all .2s; }
.search-tab.active { background: #fff; color: var(--dark); }
.search-tab:hover:not(.active) { background: rgba(255,255,255,0.2); }
.search-box { background: #fff; border-radius: 0 6px 6px 6px; padding: 24px; }
.oem-hint { font-size: 12px; color: #888; margin-top: 8px; }

/* OEM SEARCH */
.oem-search { display: flex; gap: 10px; }
.oem-search input { flex: 1; padding: 12px 16px; border: 2px solid var(--border); border-radius: 4px; font-size: 15px; outline: none; }
.oem-search input:focus { border-color: var(--red); }
.oem-search button { background: var(--red); color: #fff; border: none; padding: 12px 28px; border-radius: 4px; cursor: pointer; font-size: 15px; font-weight: 700; }
.oem-search button:hover { background: #b00118; }

/* CASCADE SEARCH */
.cascade-search { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr auto; gap: 10px; align-items: end; }
.cascade-search .field { display: flex; flex-direction: column; gap: 6px; }
.cascade-search label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.cascade-search select, .cascade-search input { padding: 12px 14px; border: 2px solid var(--border); border-radius: 4px; font-size: 14px; background: #fff; outline: none; }
.cascade-search select:focus, .cascade-search input:focus { border-color: var(--red); }
.cascade-search select:disabled { background: #f8f8f8; color: #bbb; cursor: not-allowed; }
.cascade-search button { background: var(--red); color: #fff; border: none; padding: 12px 28px; border-radius: 4px; cursor: pointer; font-size: 15px; font-weight: 700; white-space: nowrap; height: 46px; }
.cascade-search button:hover { background: #b00118; }

/* MAIN LAYOUT */
.main { max-width: 1200px; margin: 30px auto; padding: 0 20px; display: grid; grid-template-columns: 240px 1fr; gap: 24px; }

/* SIDEBAR */
.sidebar-block { border: 1px solid var(--border); border-radius: 6px; margin-bottom: 16px; overflow: hidden; }
.sidebar-block h3 { background: var(--dark); color: #fff; padding: 12px 16px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.sidebar-block ul { list-style: none; }
.sidebar-block ul li a { display: flex; justify-content: space-between; padding: 10px 16px; font-size: 13px; color: var(--text); text-decoration: none; border-bottom: 1px solid #f0f0f0; }
.sidebar-block ul li a:hover { background: var(--gray); color: var(--red); }
.sidebar-block ul li a span.count { color: var(--muted); font-size: 12px; }
.price-filter { padding: 14px 16px; }
.price-filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; font-size: 13px; }
.price-filter-row input { width: 68px; padding: 6px; border: 1px solid #ddd; border-radius: 4px; min-width: 0; }
.price-filter-row button { background: var(--red); color: #fff; border: none; padding: 7px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 700; white-space: nowrap; }

/* PRODUCTS TOOLBAR */
.products-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.products-toolbar h2 { font-size: 20px; }
.products-toolbar select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.results-info { background: #fff3cd; border: 1px solid #ffc107; border-radius: 4px; padding: 10px 16px; margin-bottom: 16px; font-size: 14px; display: none; }
.results-info.show { display: block; }

/* PRODUCTS GRID */
.products-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.product-card { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; transition: box-shadow .2s; background: #fff; }
.product-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.product-card .img { background: var(--gray); height: 160px; display: flex; align-items: center; justify-content: center; font-size: 48px; position: relative; }
.product-card .badge { position: absolute; top: 8px; left: 8px; background: var(--red); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 3px; font-weight: 700; }
.product-card .badge.new { background: #28a745; }
.product-card .info { padding: 12px; }
.product-card .oem-code { font-size: 11px; color: var(--muted); font-family: monospace; margin-bottom: 4px; }
.product-card .name { font-size: 14px; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.product-card .compat { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.product-card .price-row { display: flex; align-items: center; justify-content: space-between; }
.product-card .price { font-size: 20px; font-weight: 800; color: var(--red); }
.product-card .old-price { font-size: 13px; color: var(--muted); text-decoration: line-through; }
.product-card .add-btn { background: var(--red); color: #fff; border: none; padding: 8px 14px; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 600; }
.product-card .add-btn:hover { background: #b00118; }
.stock-status { font-size: 11px; margin-top: 6px; }
.stock-ok { color: #28a745; }
.stock-low { color: #e67e22; }
.stock-out { color: #dc3545; }
.no-results { grid-column: 1 / -1; text-align: center; padding: 60px; color: #888; }
.no-results .icon { font-size: 48px; }
.no-results p { margin-top: 12px; font-size: 16px; }

/* FOOTER */
footer { background: var(--dark); color: #aaa; margin-top: 60px; padding: 40px 0 20px; }
footer .inner { max-width: 1200px; margin: auto; padding: 0 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; }
footer h4 { color: #fff; margin-bottom: 14px; font-size: 14px; text-transform: uppercase; }
footer ul { list-style: none; }
footer ul li { margin-bottom: 8px; }
footer ul li a { color: #aaa; text-decoration: none; font-size: 13px; }
footer ul li a:hover { color: #fff; }
footer p { font-size: 13px; line-height: 1.7; }
.footer-bottom { max-width: 1200px; margin: 30px auto 0; padding: 16px 20px 0; border-top: 1px solid rgba(255,255,255,0.1); font-size: 12px; display: flex; justify-content: space-between; }

/* MODAL */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 8px; padding: 30px; max-width: 500px; width: 90%; position: relative; }
.modal h2 { margin-bottom: 20px; }
.modal .close { position: absolute; top: 14px; right: 18px; font-size: 24px; cursor: pointer; background: none; border: none; color: #666; }
.modal .field { margin-bottom: 14px; }
.modal label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.modal input, .modal select, .modal textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px; }
.modal .field-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.modal .btn-row { display: flex; gap: 10px; margin-top: 20px; }
.modal .btn-primary { background: var(--red); color: #fff; border: none; padding: 12px 24px; border-radius: 4px; cursor: pointer; font-weight: 700; flex: 1; font-size: 15px; }
.modal .btn-secondary { background: var(--gray); color: var(--text); border: 1px solid var(--border); padding: 12px 24px; border-radius: 4px; cursor: pointer; font-weight: 600; }

/* CART SIDEBAR */
.cart-sidebar { position: fixed; right: -380px; top: 0; bottom: 0; width: 380px; background: #fff; box-shadow: -4px 0 20px rgba(0,0,0,0.15); z-index: 999; transition: right .3s; display: flex; flex-direction: column; }
.cart-sidebar.open { right: 0; }
.cart-header { background: var(--dark); color: #fff; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; }
.cart-header button { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; }
.cart-items { flex: 1; overflow-y: auto; padding: 16px; }
.cart-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-item-icon { font-size: 28px; width: 48px; text-align: center; }
.cart-item-info { flex: 1; }
.cart-item-info strong { font-size: 14px; display: block; }
.cart-item-info span { font-size: 12px; color: var(--muted); }
.cart-item-price { font-weight: 700; color: var(--red); }
.qty-btn { background: #eee; border: none; cursor: pointer; padding: 0 6px; border-radius: 3px; }
.cart-footer { padding: 16px; border-top: 2px solid var(--border); }
.cart-total { font-size: 18px; font-weight: 700; display: flex; justify-content: space-between; margin-bottom: 12px; }
.cart-checkout { width: 100%; background: var(--red); color: #fff; border: none; padding: 14px; border-radius: 4px; font-size: 16px; font-weight: 700; cursor: pointer; }
.cart-checkout:hover { background: #b00118; }
.cart-empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.overlay-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 998; }
.overlay-bg.show { display: block; }

/* RESPONSIVE */
@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; }
  .cascade-search { grid-template-columns: 1fr 1fr; }
  .products-grid { grid-template-columns: repeat(2, 1fr); }
  footer .inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .cascade-search { grid-template-columns: 1fr; }
  .products-grid { grid-template-columns: 1fr; }
  nav .inner { flex-wrap: wrap; }
}