:root {
    --main: #004a99;
    --main-hover: #0066cc;
    --bg: {BGCOLOR};
    --white: #ffffff;
    --text: #1a1a1a;
    --gray: #707070;
    --card-footer: #f9fafb; 
    --radius: 14px;
    --search-bg: #f1f3f5;
    --shadow-dropdown: 0 12px 30px rgba(0,0,0,0.15);
    --search-height: 50px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Tahoma, Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
.container { width: 100%; max-width: 1600px; margin: 0 auto; padding: 0 4vw; }

/* ÈÊÎÍÊÈ È ÂÀËÞÒÀ */
.chevron-icon { width: 14px; height: 14px; fill: currentColor; transition: transform 0.3s ease; opacity: 0.5; flex-shrink: 0; }
.active > .chevron-icon, 
.mark-toggle-link.active .chevron-icon, 
.group-toggle-link.active .chevron-icon,
.modal-group-label.active .chevron-icon,
.mark-toggle-btn.active .chevron-icon { transform: rotate(180deg); opacity: 1; color: var(--main); }

.currency-sign { font-weight: 600; color: var(--text); margin-left: 2px; font-size: 0.95em; }

/* HEADER & TOP BAR */
.header { background: var(--white); border-bottom: 1px solid #eef0f2; position: sticky; top: 0; z-index: 100; }
.top-bar { background: #f8f9fa; padding: 8px 0; border-bottom: 1px solid #eee; }
.location-picker { display: flex; align-items: center; cursor: pointer; width: fit-content; }
.loc-icon { width: 16px; height: 16px; fill: var(--gray); margin-right: 6px; }
.current-city { font-size: 13px; color: var(--text); border-bottom: 1px dashed var(--gray); }

.header-in { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; }
.logo { font-size: 22px; font-weight: 900; color: var(--main); text-decoration: none; letter-spacing: -1px; flex-shrink: 0; }
.header-nav { display: flex; align-items: center; gap: 15px; }
.auth-link { color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500; transition: 0.2s; }
.auth-link:hover { color: var(--main); }

.btn-add { 
    background-color: var(--main) !important; 
    color: #ffffff !important; 
    padding: 10px 18px; 
    border-radius: 10px; 
    text-decoration: none; 
    font-weight: 600; 
    font-size: 13px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border: none; 
    cursor: pointer; 
    transition: 0.3s; 
}
.btn-add:hover { background-color: var(--main-hover) !important; }

/* SEARCH AREA */
.search-box { background: var(--white); padding: 25px 0; border-bottom: 1px solid #f0f0f0; }
.search-flex-row { display: flex; align-items: flex-start; gap: 15px; }

.search-cat-external {
    background: var(--search-bg);
    border: 1px solid #dce1e6;
    border-radius: 18px;
    padding: 0 15px;
    min-width: 220px;
    height: var(--search-height);
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: 0.2s;
    display: flex;
    align-items: center;
}
.search-cat-external:hover { border-color: #c9d0d6; }
.search-cat-external.active { border-color: var(--main); background: var(--white); }

.cat-current { display: flex; justify-content: space-between; align-items: center; width: 100%; font-size: 15px; font-weight: 500; color: var(--text); }
.arrow-down-icon { width: 20px; height: 20px; fill: var(--gray); transition: 0.3s; }

.cat-dropdown-menu {
    position: absolute;
    top: calc(var(--search-height) + 8px);
    left: 0;
    width: 320px;
    max-height: 450px;
    overflow-y: auto;
    background: var(--white); 
    border: 1px solid #dce1e6;
    border-radius: 18px;
    padding: 12px 0;
    display: none;
    z-index: 999;
    box-shadow: var(--shadow-dropdown);
}
.search-cat-external.active .cat-dropdown-menu { display: block; }
.search-cat-external.active .arrow-down-icon { transform: rotate(180deg); }

.cat-item-wrap { padding: 10px 18px; border-bottom: 1px solid #f1f3f5; text-align: left; }
.cat-item-wrap:last-of-type { border-bottom: none; }
.cat-parent { display: block; color: var(--text); font-weight: 700; text-decoration: none; font-size: 14px; margin-bottom: 6px; }
.cat-child-list { display: flex; flex-direction: column; gap: 4px; padding-left: 12px; }
.cat-child-list a { color: var(--gray); text-decoration: none; font-size: 13px; transition: 0.15s; }

/* ÔÎÐÌÀ ÏÎÈÑÊÀ È ÐÀÑØÈÐÅÍÍÛÅ ÔÈËÜÒÐÛ */
.search-form-container { flex: 1; display: flex; flex-direction: column; }
.search-main-row { display: flex; align-items: stretch; background: var(--search-bg); border: 1px solid #dce1e6; border-radius: 18px; padding: 3px; height: var(--search-height); overflow: hidden; }
.search-input-wrapper { display: flex; align-items: center; flex: 1; padding-left: 15px; }
.search-input-wrapper input { width: 100%; border: none; background: transparent; padding: 10px 0; font-size: 16px; outline: none; }
.search-btn { background-color: var(--main) !important; color: #ffffff !important; border: none; padding: 0 30px; height: 100%; border-radius: 15px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.3s; white-space: nowrap; }
.search-btn:hover { background-color: var(--main-hover) !important; }

.search-extra-options { padding-top: 8px; padding-left: 5px; }
.advanced-search-link { color: var(--main); font-size: 13px; text-decoration: none; font-weight: 500; border-bottom: 1px dashed var(--main); transition: 0.2s; cursor: pointer; }
.advanced-search-link:hover, .advanced-search-link.active { border-bottom-style: solid; color: var(--main-hover); }

.advanced-filter-panel { 
    max-height: 0; overflow: hidden; transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
    background: #fdfdfd; border-radius: 14px; display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; opacity: 0; 
}
.advanced-filter-panel.active { max-height: 500px; padding: 25px 15px; opacity: 1; margin-top: 15px; border: 1px solid #eee; box-shadow: 0 4px 15px rgba(0,0,0,0.03); }

.filter-group { display: flex; flex-direction: column; gap: 8px; }
.filter-group label { font-size: 12px; font-weight: 800; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-group select, .filter-group input { padding: 10px 14px; border: 1px solid #dce1e6; border-radius: 10px; outline: none; font-size: 14px; background: #fff; transition: 0.2s; }
.filter-group select:focus, .filter-group input:focus { border-color: var(--main); }
.input-range { display: flex; gap: 8px; }
.input-range input { width: 50%; }

/* GRID & CARDS */
.grid-title { margin: 30px 0 20px; font-size: 24px; font-weight: 800; }
.ads-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; margin-bottom: 50px; }
.card { background: var(--white); border-radius: var(--radius); overflow: hidden; transition: 0.3s; border: 1px solid #eef0f2; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
.card-img { width: 100%; aspect-ratio: 4/3; background: #eee; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 15px; flex-grow: 1; }
.price { font-size: 20px; font-weight: 900; margin-bottom: 5px; }
.title { font-size: 15px; color: #444; height: 40px; overflow: hidden; margin-bottom: 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-footer { background: var(--card-footer); padding: 10px 15px; border-top: 1px solid #f0f1f3; font-size: 12px; color: var(--gray); display: flex; justify-content: space-between; }

/* FOOTER */
.footer { background: #fff; padding: 60px 0 30px; border-top: 1px solid #eef0f2; margin-top: 60px; }
.footer-links-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px; margin-bottom: 50px; }
.link-group h4 { font-size: 16px; font-weight: 800; margin-bottom: 20px; color: var(--text); text-transform: uppercase; }
.link-group a { display: block; color: var(--gray); text-decoration: none; font-size: 14px; margin-bottom: 12px; transition: 0.2s; }
.link-group a:hover { color: var(--main); padding-left: 5px; }

.cat-item { margin-bottom: 12px; }
.cat-toggle { font-weight: 700; color: var(--text) !important; text-decoration: none !important; display: flex; align-items: center; justify-content: space-between; }
.cat-toggle::after { content: '\25BE'; font-size: 12px; transition: 0.3s; opacity: 0.5; }
.sub-links { max-height: 0; overflow: hidden; transition: 0.4s ease-out; padding-left: 10px; border-left: 2px solid #f1f3f5; margin-top: 8px; }
.sub-links a { font-size: 13px !important; margin-bottom: 8px !important; }
.cat-item:hover .sub-links { max-height: 300px; } 

.btn-show-all { color: var(--main) !important; font-weight: 800; font-size: 13px !important; text-decoration: underline !important; }

.footer-middle { display: flex; justify-content: space-between; align-items: center; padding: 40px 0; border-top: 1px solid #f8f9fa; border-bottom: 1px solid #f8f9fa; }
.footer-logo { font-size: 26px; font-weight: 900; color: var(--main); text-decoration: none; }
.footer-slogan { font-size: 14px; color: var(--gray); max-width: 300px; }

/* ÒÅÕÍÎËÎÃÈ×ÍÛÉ Ñ×ÅÒ×ÈÊ */
.counter-box { 
    background: #1a1a1a; color: #00ff41; font-family: 'Courier New', monospace; 
    padding: 8px 15px; border-radius: 6px; font-size: 18px; letter-spacing: 4px; 
    box-shadow: inset 0 0 10px rgba(0,255,65,0.2); border: 1px solid #333;
}

.footer-bottom { padding-top: 30px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--gray); }
.bottom-docs a { color: var(--gray); text-decoration: none; margin-left: 30px; transition: 0.2s; }
.bottom-docs a:hover { color: var(--main); }

/* ÌÎÄÀËÜÍÎÅ ÎÊÍÎ */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); z-index: 2000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.modal-overlay.active { display: flex; }
.modal-container { background: var(--white); width: 95%; max-width: 1100px; max-height: 90vh; border-radius: 24px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); }
.modal-header { padding: 20px 30px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 22px; font-weight: 800; }
.close-modal-btn { background: none; border: none; font-size: 35px; color: var(--gray); cursor: pointer; }
.modal-body { padding: 30px; overflow-y: auto; }
.modal-cat-group { margin-bottom: 40px; }
.modal-cat-title { color: var(--main); font-size: 22px; font-weight: 800; margin-bottom: 20px; border-bottom: 2px solid #f1f3f5; padding-bottom: 8px; }
.modal-subs-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 30px; }
.modal-sub-block { margin-bottom: 12px; }
.modal-sub-link { display: block; font-weight: 800; font-size: 15px; color: var(--text); text-decoration: none; margin-bottom: 8px; }
.modal-type-title { font-size: 11px; color: #fff; background: #333; display: inline-block; padding: 3px 10px; border-radius: 6px; margin-top: 15px; margin-bottom: 8px; font-weight: 900; text-transform: uppercase; }
.modal-group-label { font-size: 13px; font-weight: 700; margin: 8px 0; color: #444; padding-left: 8px; border-left: 3px solid #eee; transition: 0.2s; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.modal-group-label:hover, .modal-group-label.active { border-left-color: var(--main); color: var(--main); }
.modal-deep-list { list-style: none; padding: 5px 0 10px 15px; border-left: 1px solid #f0f0f0; margin-left: 5px; }
.mark-toggle-btn { font-size: 14px; color: var(--gray); text-decoration: none; transition: 0.2s; font-weight: 600; display: flex; align-items: center; gap: 5px; margin-bottom: 6px; }
.mark-toggle-btn:hover, .mark-toggle-btn.active { color: var(--main); }
.modal-models-wrapper { padding: 12px; margin: 8px 0 15px 5px; background: #f8f9fa; border-radius: 12px; display: flex; flex-wrap: wrap; gap: 8px; border: 1px solid #f0f0f0; }
.modal-models-wrapper a { font-size: 12px; color: var(--text); text-decoration: none; background: #fff; padding: 4px 10px; border-radius: 6px; border: 1px solid #eee; transition: 0.2s; }
.modal-models-wrapper a:hover { border-color: var(--main); color: var(--main); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

/* ÊÍÎÏÊÈ "ÏÎÊÀÇÀÒÜ ÂÑÅ" */
.show-models-more { display: block; width: 100%; text-align: center; padding: 8px; margin-top: 10px; background: #f1f3f5; color: var(--main); border-radius: 10px; font-size: 12px; font-weight: 700; cursor: pointer; transition: 0.2s; border: 1px solid #e2e6ea; }
.show-models-more:hover { background: var(--main); color: #fff; border-color: var(--main); }
.btn-show-all-small { font-size: 11px; color: var(--main); font-weight: 700; text-decoration: none; margin-left: 10px; padding: 3px 8px; background: rgba(0, 74, 153, 0.05); border-radius: 4px; border: 1px solid transparent; transition: 0.2s; display: inline-block; }
.btn-show-all-small:hover { background: rgba(0, 74, 153, 0.1); border-color: var(--main); }
.show-more-deep { margin-top: 10px; border-top: 1px dashed #eee; padding-top: 8px; }

/* ÀÄÀÏÒÈÂÍÎÑÒÜ */
@media (max-width: 850px) {
    .search-flex-row { flex-direction: column; align-items: stretch; gap: 10px; }
    .search-cat-external { min-width: 100%; width: 100%; }
    .footer-middle { flex-direction: column; align-items: center; text-align: center; gap: 20px; }
}

@media (max-width: 480px) {
    .container { padding: 0 15px; }
    .logo { font-size: 18px; }
    .btn-add span { display: none; }
    .btn-add::before { content: '+'; font-size: 28px; line-height: 0; margin-bottom: 4px; display: block; }
    .btn-add { width: 44px; height: 44px; min-width: 44px; border-radius: 50%; padding: 0; }
    .search-btn-text { display: none; }
    .search-btn-icon { display: block; width: 24px; height: 24px; fill: #ffffff; }
    .search-btn { padding: 0; width: 44px; height: 44px; border-radius: 12px; margin: auto 3px; flex-shrink: 0; }
    
    /* Ìîáèëüíûé ôóòåð: âñ¸ â ñòîëáèê è ïî öåíòðó */
    .footer-links-row { grid-template-columns: 1fr; text-align: center; gap: 30px; }
    .sub-links { border-left: none; padding-left: 0; }
    .footer-bottom { flex-direction: column; gap: 15px; align-items: center; text-align: center; }
    .bottom-docs { display: flex; flex-direction: column; gap: 10px; }
    .bottom-docs a { margin: 0; }
    
    /* Ìîáèëüíûå ôèëüòðû */
    .advanced-filter-panel.active { grid-template-columns: 1fr; }
}
