:root {
    --bg-color: #ffffff;
    --text-main: #111111; 
    --text-muted: #6b7280; 
    --theme-dark: #1b3d28; 
    --border-color: #e5e7eb; 
    --border-radius-xs: 4px;
    --border-radius-sm: 6px; 
    --border-radius-md: 10px;
    --font-stack: 'Inter', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--font-stack); -webkit-font-smoothing: antialiased; }

html, body { 
    background-color: var(--bg-color); 
    color: var(--text-main); 
    min-height: 100vh; 
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden; 
    position: relative;
}

a { text-decoration: none; color: var(--text-main); }
.text-muted { color: var(--text-muted); }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 30px; }

/* ШАПКА */
.header { background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); border-bottom: 1px solid rgba(0, 0, 0, 0.06); position: sticky; top: 0; z-index: 100; height: 74px; display: flex; align-items: center; }
.header-content { display: flex; justify-content: space-between; align-items: center; gap: 30px; width: 100%; }
.logo { font-size: 20px; font-weight: 900; letter-spacing: 1.5px; color: var(--text-main); flex: 1; }

.header-right-group { display: flex; align-items: center; justify-content: flex-end; gap: 24px; flex: 1; }
.header-actions { display: flex; align-items: center; gap: 24px; }

.search-bar { flex: 2; max-width: 500px; display: flex; align-items: center; background-color: rgba(0, 0, 0, 0.03); border: 1px solid transparent; border-radius: 6px; padding: 0 16px; height: 40px; transition: all 0.2s ease; margin: 0 auto; }
.search-bar:focus-within { background-color: rgba(255, 255, 255, 0.4); border-color: rgba(0, 0, 0, 0.15); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04); }
.search-icon { color: #9ca3af; display: flex; align-items: center; margin-right: 10px; }
.search-bar input { width: 100%; padding: 10px 0; border: none; background: transparent; font-size: 14px; font-weight: 400; outline: none; color: var(--text-main); }
.header-link { background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--text-main); font-size: 14px; font-weight: 500; padding: 4px 0; cursor: pointer; transition: opacity 0.2s; }
.header-link:hover { opacity: 0.6; }
.header-link.active-nav { border-bottom-color: var(--text-main); }
.header-btn { background: var(--text-main); color: #ffffff; border: none; border-radius: 4px; padding: 0 20px; height: 40px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color 0.2s; }
.header-btn:hover { background: #333333; }
.header-profile-block { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 6px 12px; border-radius: 8px; transition: background-color 0.2s; }
.header-profile-block:hover { background-color: rgba(0,0,0,0.04); }
.header-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-color); }
.header-user-info { display: flex; align-items: center; gap: 10px; }
.header-username { font-size: 14px; font-weight: 600; }
.header-rating { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; }

/* КНОПКИ */
.btn { padding: 10px 20px; font-size: 13px; font-weight: 500; cursor: pointer; border-radius: 4px; transition: all 0.2s ease; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { border-color: var(--text-main); }
.btn-solid { background: var(--text-main); border: none; color: #fff; }
.btn-solid:hover { opacity: 0.9; }
.full-width { width: 100%; }

/* ЛЕЙАУТ И САЙДБАР */
.main-layout, .profile-layout { display: flex; gap: 40px; margin-top: 26px; }
.sidebar, .profile-sidebar { width: 250px; flex-shrink: 0; position: sticky; top: 100px; height: calc(100vh - 120px); overflow-y: auto; padding-right: 10px; }
.sidebar::-webkit-scrollbar, .profile-sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track, .profile-sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb, .profile-sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: var(--border-radius-sm); }
.sidebar-top-box { background-color: #f9fafb; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 16px; margin-bottom: 24px; text-align: center; }
.sidebar-top-box p { font-size: 13px; line-height: 1.5; color: var(--text-muted); margin-bottom: 12px; }
.sidebar-section { border-top: 1px solid var(--border-color); padding: 16px 0; }
.sidebar-title { font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; cursor: pointer; }
.sidebar-options { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.custom-checkbox { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.custom-checkbox input[type="checkbox"] { display: none; }
.checkbox-box { width: 16px; height: 16px; border: 1px solid #d1d5db; border-radius: var(--border-radius-xs); display: flex; align-items: center; justify-content: center; }
.custom-checkbox input:checked + .checkbox-box { background-color: var(--text-main); border-color: var(--text-main); }
.custom-checkbox .count { color: var(--text-muted); font-size: 12px; margin-left: 4px; }

/* ЛЕНТА И КАРТОЧКИ */
.feed, .profile-content { flex-grow: 1; padding-bottom: 80px; }
.feed-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.listings-count { font-size: 14px; font-weight: 600; }
.sort-box { font-size: 13px; cursor: pointer; border: 1px solid var(--border-color); border-radius: var(--border-radius-xs); padding: 6px 12px; }

/* СЕТКА ТОВАРОВ */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 30px 16px; align-items: start; }

/* min-width: 0; - КРИТИЧЕСКИ ВАЖНО, чтобы текст не распирал карточку */
.product-card { cursor: pointer; display: flex; flex-direction: column; height: 100%; min-width: 0; }
.product-card:hover .product-title { color: var(--text-muted); }

/* ИДЕАЛЬНЫЕ ПРОПОРЦИИ КАРТОЧКИ */
.product-image { 
    width: 100%; 
    aspect-ratio: 3 / 4; 
    background-color: #f3f4f6; 
    border-radius: var(--border-radius-xs); 
    margin-bottom: 10px; 
    background-size: cover; 
    background-position: center; 
    background-repeat: no-repeat; 
    object-fit: cover;
}

.product-info { padding: 0 4px; font-size: 12px; line-height: 1.4; display: flex; flex-direction: column; flex-grow: 1;}
.time-posted { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.status-active-text { color: var(--theme-dark); font-weight: 600; }
.product-title { font-weight: 600; font-size: 13px; color: var(--text-main); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.2s; }
.brand-size-row { display: flex; justify-content: space-between; font-weight: 500; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.brand-name { text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70%;}
.product-size { color: var(--text-muted); flex-shrink: 0;}
.price-like-row { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 14px; margin-top: auto;}

/* ИКОНКИ ЛАЙКА И РЕДАКТИРОВАНИЯ (В КАРТОЧКАХ) */
.like-icon, .edit-icon { color: var(--text-muted); transition: transform 0.15s ease, color 0.15s ease; display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; width: 16px; height: 16px; }
.like-icon:active, .edit-icon:active { transform: scale(0.85); }
.product-card:hover .like-icon:not(.active), .product-card:hover .edit-icon { color: var(--text-main); }
.like-icon.active { color: #ff3b30; }
.like-icon svg, .edit-icon svg { transition: fill 0.2s ease; }

/* ПРОФИЛЬ */
.profile-card { border: none; padding: 0 10px; text-align: center; }
.avatar-wrapper { position: relative; width: 100px; height: 100px; border-radius: 50%; overflow: hidden; margin: 0 auto 20px; border: 1px solid var(--border-color); background-color: #f9fafb; cursor: default; }
.profile-card.is-editing .avatar-wrapper { cursor: pointer; }
.avatar-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.avatar-edit-overlay { position: absolute; bottom: 0; left: 0; width: 100%; height: 35%; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; color: white; font-size: 11px; font-weight: 600; }
.profile-card.is-editing .avatar-wrapper:hover .avatar-edit-overlay { display: flex; }
#profile-name-display { font-size: 20px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.5px; }
#profile-username-display { font-size: 14px; font-weight: 500; }
.profile-bio-display { font-size: 14px; color: var(--text-main); margin-top: 20px; margin-bottom: 8px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.logout-text-btn { background: transparent; border: none; color: #ff3b30; font-size: 13px; font-weight: 600; cursor: pointer; padding: 10px 0; transition: opacity 0.2s; text-align: center; }
.logout-text-btn:hover { opacity: 0.7; }
.profile-form { margin-top: 24px; text-align: left; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.input-field { width: 100%; padding: 10px 12px; background-color: #fff; border: 1px solid var(--border-color); border-radius: var(--border-radius-xs); font-size: 14px; outline: none; transition: border-color 0.2s; }
.input-field:focus { border-color: var(--text-main); }
.profile-id-text { margin-top: 24px; text-align: center; font-size: 11px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.5px; }
.premium-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border-color); margin-bottom: 24px; }
.tab-item { padding-bottom: 12px; font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; position: relative; }
.tab-item:hover { color: var(--text-main); }
.tab-item.active { color: var(--text-main); font-weight: 600; }
.tab-item.active::after { content: ''; position: absolute; bottom: -1px; left: 0; width: 100%; height: 2px; background-color: var(--text-main); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* СТРАНИЦА ТОВАРА */
.product-page { display: flex; gap: 60px; margin-top: 40px; align-items: flex-start;}
.product-gallery-wrapper { flex: 1; max-width: 460px; width: 100%; }
.product-gallery { width: 100%; aspect-ratio: 3/4; background-color: #f9fafb; border-radius: var(--border-radius-sm); background-size: cover; background-position: center; position: relative; overflow: hidden; border: 1px solid var(--border-color); }
.product-thumbnails { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 6px; }
.product-thumbnails::-webkit-scrollbar { height: 4px; }
.product-thumbnails::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: var(--border-radius-sm); }
.thumbnail-box { width: 72px; aspect-ratio: 3/4; border-radius: var(--border-radius-xs); background-size: cover; background-position: center; cursor: pointer; opacity: 0.6; transition: 0.2s; border: 1px solid transparent; flex-shrink: 0; }
.thumbnail-box:hover { opacity: 0.9; }
.thumbnail-box.active { opacity: 1; border-color: var(--text-main); }
.product-details { flex: 1.2; padding-top: 0px; position: relative; display: flex; flex-direction: column;} 
.product-title-large { font-size: 26px; font-weight: 700; margin-bottom: 8px; line-height: 1.3; padding-right: 50px; color: var(--text-main); letter-spacing: -0.5px;}
.product-brand-large { font-size: 15px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 24px; letter-spacing: 0.5px;}
.product-price-large { font-size: 32px; font-weight: 700; margin-bottom: 24px;}
.product-specs-new { display: flex; gap: 12px; margin-bottom: 24px; }
.spec-block { flex: 1; background-color: #f9fafb; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.spec-label { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px;}
.spec-val { font-size: 14px; font-weight: 600; color: var(--text-main);}
.product-desc-large { font-size: 15px; line-height: 1.6; color: var(--text-main); white-space: pre-wrap; margin-bottom: 32px;}
.product-seller-box { display: flex; align-items: center; justify-content: space-between; padding: 16px; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); margin-bottom: 24px; cursor: pointer; transition: border-color 0.2s;}
.product-seller-box:hover { border-color: var(--text-main); }
.seller-box-left { display: flex; align-items: center; gap: 14px; }
.seller-box-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background-color: var(--text-main); }
.seller-box-info { display: flex; flex-direction: column; gap: 4px; }
.seller-box-name { font-size: 14px; font-weight: 600; color: var(--text-main); }
.seller-box-rating { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.seller-box-arrow { color: var(--text-muted); font-size: 18px; }
.trust-badges { display: flex; flex-direction: column; gap: 12px; margin-bottom: 32px; padding: 16px; background-color: rgba(0, 0, 0, 0.02); border-radius: var(--border-radius-sm);}
.trust-badge-item { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; color: var(--text-main); }
.trust-badge-item svg { color: var(--theme-dark); }
.product-page-like-btn { position: absolute; top: 0px; right: 0; width: 40px; height: 40px; border-radius: 50%; background-color: #ffffff; border: 1px solid var(--border-color); display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; transition: all 0.2s ease; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.product-page-like-btn:hover { border-color: var(--text-main); color: var(--text-main); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.product-page-like-btn:active { transform: translateY(0) scale(0.95); }
.product-page-like-btn.active { color: #ff3b30; border-color: rgba(255, 59, 48, 0.2); background-color: rgba(255, 59, 48, 0.04); }
.product-page-like-btn svg { transition: fill 0.2s ease; }

/* ИДЕАЛЬНЫЙ СКРОЛЛ РЕКОМЕНДАЦИЙ */
.similar-section { margin-top: 80px; padding-top: 40px; border-top: 1px solid var(--border-color); padding-bottom: 60px; }
.similar-section h3 { font-size: 20px; font-weight: 700; margin-bottom: 24px; color: var(--text-main); }
.similar-slider-area { position: relative; width: 100%; }
.slider-wrapper { width: 100%; overflow: hidden; mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent); -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent); }
.similar-slider { display: flex; gap: 20px; overflow-x: auto; padding: 10px 30px 20px 30px; scroll-behavior: smooth; -ms-overflow-style: none; scrollbar-width: none; }
.similar-slider::-webkit-scrollbar { display: none; }
.similar-slider .product-card { width: 160px; flex: 0 0 160px; }
.slider-btn { position: absolute; top: 35%; transform: translateY(-50%); width: 44px; height: 44px; background: #ffffff; border: 1px solid var(--border-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; color: var(--text-muted); box-shadow: 0 4px 12px rgba(0,0,0,0.08); transition: all 0.2s ease; }
.slider-btn:hover { border-color: var(--text-main); color: var(--text-main); transform: translateY(-50%) scale(1.05); }
.slider-btn:active { transform: translateY(-50%) scale(0.95); }
.slider-btn.prev { left: -15px; }
.slider-btn.next { right: -15px; }

/* --- СВАЙП-СТРАНИЦА (ПОДБОРКА) --- */
.swipe-page-wrapper { 
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; 
    height: calc(100vh - 74px); 
    padding: 30px 20px; 
    background-color: #f9fafb;
    background-image: radial-gradient(#d1d5db 1px, transparent 1px); background-size: 24px 24px;
    overflow: hidden; 
    width: 100%;
}
.swipe-header-text { text-align: center; margin-bottom: 30px; }
.swipe-header-text h1 { font-size: 28px; font-weight: 700; color: var(--text-main); margin-bottom: 8px; letter-spacing: -0.5px;}
.swipe-header-text p { font-size: 14px; color: var(--text-muted); }

.swipe-container { position: relative; width: 100%; max-width: 380px; aspect-ratio: 3/4; perspective: 1000px; z-index: 10;}

.swipe-card { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    border-radius: 16px; overflow: hidden; box-shadow: 0 15px 35px rgba(0,0,0,0.1); 
    background-color: #fff; background-size: cover; background-position: center; 
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.6s ease; 
    transform-origin: 50% 100%; cursor: grab; user-select: none; border: 1px solid rgba(0,0,0,0.05); 
}

.swipe-card.current-card { z-index: 3; filter: brightness(1); }
.swipe-card.next-card { transform: scale(0.95) translateY(20px); z-index: 2; filter: brightness(0.85); box-shadow: 0 -5px 20px rgba(0,0,0,0.05); }
.swipe-card.third-card { transform: scale(0.90) translateY(40px); z-index: 1; filter: brightness(0.7); box-shadow: 0 -5px 20px rgba(0,0,0,0.05); }
.swipe-card.hidden-card { transform: scale(0.85) translateY(60px); z-index: 0; filter: brightness(0.5); opacity: 0; transition: transform 0.6s, opacity 0.6s; }
.swipe-card.dragging { transition: none; cursor: grabbing; z-index: 99 !important; }
.swipe-card.flying-out { transition: transform 0.6s ease, opacity 0.4s ease !important; opacity: 0; pointer-events: none; z-index: 99 !important; }

@keyframes slideUpFadeInfo {
    0% { opacity: 0; transform: translateY(40px); }
    100% { opacity: 1; transform: translateY(0); }
}

.swipe-info { 
    position: absolute; bottom: 0; width: 100%; padding: 60px 24px 24px; 
    background: linear-gradient(to top, rgba(0,0,0,0.95), transparent); color: white; pointer-events: none; 
    transform: translateY(30px); opacity: 0; transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s ease;
}
.swipe-card.current-card .swipe-info { animation: slideUpFadeInfo 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

.swipe-brand { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.8); margin-bottom: 6px; }
.swipe-title { font-size: 22px; font-weight: 700; margin-bottom: 12px; line-height: 1.2; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.swipe-price-row { display: flex; justify-content: space-between; align-items: flex-end; }
.swipe-price { font-size: 20px; font-weight: 600; }
.swipe-size { font-size: 13px; font-weight: 600; background: rgba(255,255,255,0.25); padding: 4px 10px; border-radius: 4px; backdrop-filter: blur(4px); }

.swipe-controls { display: flex; gap: 24px; margin-top: 40px; z-index: 10; justify-content: center;}
.swipe-btn { 
    width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--border-color); 
    display: flex; align-items: center; justify-content: center; 
    cursor: pointer; transition: all 0.3s ease; box-shadow: 0 2px 8px rgba(0,0,0,0.04); 
    background-color: white; color: var(--text-muted);
}
.swipe-btn svg { width: 22px; height: 22px; transition: color 0.3s ease; }
.swipe-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); color: var(--text-main); border-color: rgba(0, 0, 0, 0.2);}
.swipe-btn:active { transform: translateY(2px) scale(0.9); box-shadow: 0 1px 4px rgba(0,0,0,0.04); transition: all 0.05s ease;}
.swipe-btn.like.clicked { color: #ff3b30; border-color: rgba(255, 59, 48, 0.4); }
.swipe-btn.dislike.clicked { color: var(--text-main); border-color: rgba(0, 0, 0, 0.4); }

.swipe-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); text-align: center; background: #fff; border-radius: 16px; border: 1px dashed var(--border-color); }
.swipe-empty h3 { font-size: 20px; color: var(--text-main); margin-bottom: 8px;}

/* МОДАЛЬНЫЕ ОКНА И ФОРМЫ */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.4); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content { background-color: #ffffff; padding: 32px; width: 100%; max-width: 380px; text-align: center; position: relative; border-radius: var(--border-radius-sm); box-shadow: 0 20px 40px rgba(0,0,0,0.1); transform: translateY(15px); transition: transform 0.3s ease; max-height: 90vh; overflow-y: auto;}
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-close { position: absolute; top: 16px; right: 16px; background: transparent; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }
.modal-header h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.modal-header p { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.fake-tg-btn { background-color: var(--text-main); color: white; border: none; padding: 12px 20px; border-radius: 4px; font-size: 14px; font-weight: 600; width: 100%; cursor: pointer; }

.image-upload-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.uploaded-img-box, .upload-btn-box { width: calc(25% - 6px); aspect-ratio: 3 / 4; border-radius: var(--border-radius-xs); position: relative; overflow: hidden; }
.uploaded-img-box img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.delete-img-btn { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: white; border: none; font-size: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; line-height: 1; transition: background 0.2s; z-index: 10;}
.delete-img-btn:hover { background: rgba(255, 59, 48, 0.8); }
.upload-btn-box { background-color: #f9fafb; border: 1px dashed var(--border-color); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: border-color 0.2s; color: var(--text-muted); }
.upload-btn-box span.plus { font-size: 20px; margin-bottom: 2px;}
.upload-btn-box span.text { font-size: 10px; font-weight: 500;}
.upload-btn-box:hover { border-color: var(--text-main); color: var(--text-main); }
.autocomplete-dropdown { position: absolute; top: 100%; left: 0; width: 100%; max-height: 180px; overflow-y: auto; background-color: #ffffff; border: 1px solid var(--border-color); border-radius: var(--border-radius-xs); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); z-index: 1000; margin-top: 4px; display: none; text-align: left; }
.autocomplete-dropdown.active { display: block; }
.autocomplete-item { padding: 10px 12px; font-size: 13px; cursor: pointer; text-transform: uppercase; font-weight: 500; }
.autocomplete-item:hover { background-color: #f9fafb; }
.autocomplete-item:not(:last-child) { border-bottom: 1px solid #f3f4f6; }
.size-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.size-box { cursor: pointer; position: relative; }
.size-box input { display: none; }
.size-box span { display: flex; align-items: center; justify-content: center; height: 36px; border: 1px solid var(--border-color); border-radius: var(--border-radius-xs); font-size: 13px; font-weight: 500; transition: all 0.2s ease; }
.size-box input:checked + span { background-color: var(--text-main); border-color: var(--text-main); color: #ffffff; }

/* ========================================= */
/* ИДЕАЛЬНАЯ МОБИЛЬНАЯ АДАПТАЦИЯ (TELEGRAM)  */
/* ========================================= */
.category-btn-mobile { display: none; }
.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.3); backdrop-filter: blur(1px); -webkit-backdrop-filter: blur(1px); z-index: 999; display: none; opacity: 0; transition: opacity 0.25s ease; }
.sidebar-overlay.active { display: block; opacity: 1; }

@media (max-width: 768px) {
    .container { padding: 0 16px; }
    
    /* --- ХЭДЕР ПО СТРОГИМ ПРАВИЛАМ МОБИЛЬНОГО УСТРОЙСТВА --- */
    .header { height: auto; padding: 12px 0 16px 0; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; background: #ffffff; z-index: 100; }
    
    .header-content { 
        display: grid; 
        grid-template-columns: auto auto; 
        grid-template-rows: auto auto auto; 
        gap: 16px 0; 
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    /* Магическое свойство, чтобы дочерние элементы header-right-group стали частью сетки header-content */
    .header-right-group { display: contents; }
    
    /* СТРОКА 1: Логотип (слева) + Профиль (справа) */
    .logo { grid-column: 1; grid-row: 1; font-size: 18px; margin: 0; }
    
    #auth-container { 
        grid-column: 2; grid-row: 1; 
        display: flex; justify-content: flex-end; align-items: center;
    }
    
    /* Профиль пользователя: Юзернейм СЛЕВА от иконки, виден полностью */
    .header-profile-block { 
        background: transparent !important; 
        padding: 0; margin: 0; gap: 10px; 
        flex-direction: row-reverse; /* Меняем местами картинку и текст */
    }
    .header-user-info { display: flex; align-items: center; } 
    .header-username { 
        font-size: 13px; font-weight: 600; 
        max-width: none; /* Юзернейм виден полностью */
        white-space: nowrap; overflow: visible; 
    }
    .header-rating { display: none; } /* Прячем рейтинг на мобилке для чистоты */
    .header-avatar { width: 32px; height: 32px; }
    .header-btn { padding: 0 12px; font-size: 12px; height: 32px; border-radius: 4px; } 

    /* СТРОКА 2: Пункты меню по центру */
    .header-actions {
        grid-column: 1 / -1; grid-row: 2;
        display: flex; justify-content: center; align-items: center; gap: 24px;
        position: static; height: auto; background: transparent; border: none; box-shadow: none; padding: 0;
        width: 100%;
    }
    .header-link { font-size: 14px; font-weight: 600; padding: 0; flex: none; color: var(--text-main); text-transform: none; border: none; }
    .header-link.active-nav { border-bottom: 2px solid var(--text-main); padding-bottom: 2px; }
    .post-ad-btn { background: transparent; padding: 0; }
    
    /* СТРОКА 3: Поиск снизу */
    .search-bar { 
        grid-column: 1 / -1; grid-row: 3;
        width: 100%; max-width: 100%; margin: 0; height: 40px; 
        background-color: #f3f4f6;
    }
    
    /* --- ЛЕЙАУТ И КНОПКА КАТЕГОРИИ --- */
    .main-layout, .profile-layout { flex-direction: column; gap: 16px; margin-top: 10px; }
    
    .category-btn-mobile {
        display: flex; align-items: center; justify-content: center;
        width: 38px; height: 38px;
        cursor: pointer; border: 1px solid var(--border-color); border-radius: var(--border-radius-xs);
        background-color: #ffffff; color: var(--text-main); transition: background-color 0.15s;
    }
    .category-btn-mobile:active { background-color: #f3f4f6; }
    .category-btn-mobile svg { color: var(--text-main); }
    
    .sidebar { 
        display: block; position: fixed; top: 0; left: -100%; width: 82%; max-width: 300px;
        height: 100vh; background-color: #ffffff; z-index: 1000; padding: 20px 16px;
        box-shadow: 15px 0 35px rgba(0,0,0,0.15); transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1); overflow-y: auto;
    }
    .sidebar.active { left: 0; }
    .profile-sidebar { width: 100%; height: auto; position: static; padding-right: 0; }
    
    .feed, .profile-content { padding-bottom: 40px; } 
    
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
    .product-title { font-size: 12px; }
    .product-price { font-size: 14px; }
    .brand-size-row { font-size: 11px; }

    /* --- СТРАНИЦА ТОВАРА --- */
    .product-page { flex-direction: column; gap: 20px; margin-top: 16px; align-items: stretch; }
    .product-gallery-wrapper { max-width: 100%; }
    .product-gallery { 
        border-radius: var(--border-radius-md); 
        border: none; 
        aspect-ratio: 3 / 4; 
        background-size: cover; 
        background-position: center; 
        background-repeat: no-repeat; 
        background-color: #f9fafb; 
    }
    
    .product-details { padding-top: 0; }
    .product-title-large { font-size: 20px; padding-right: 0; line-height: 1.25; }
    .product-brand-large { font-size: 13px; margin-bottom: 14px; }
    .product-price-large { font-size: 26px; margin-bottom: 16px; }
    
    .product-specs-new { flex-direction: row; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
    .spec-block { flex: 1 1 calc(33.333% - 8px); padding: 8px 10px; }
    .spec-label { font-size: 10px; }
    .spec-val { font-size: 13px; }
    
    .product-seller-box { padding: 12px; margin-bottom: 16px; }
    .product-desc-large { font-size: 14px; margin-bottom: 20px; }
    
    .similar-section { margin-top: 35px; padding-top: 16px; padding-bottom: 30px; }
    .similar-section h3 { font-size: 17px; margin-bottom: 14px; }
    
    /* Убираем кнопки вправо/влево для ленты похожих товаров на мобилках */
    .slider-btn { display: none !important; }
    .similar-slider { padding: 10px 16px 20px 16px; gap: 12px; }

    /* --- ИСПРАВЛЕНИЯ ДЛЯ СВАЙПОВ --- */
    .swipe-page-wrapper { padding-top: 16px; padding-bottom: 40px; height: calc(100dvh - 120px); justify-content: center; }
    .swipe-header-text { margin-bottom: 16px; }
    .swipe-header-text h1 { font-size: 18px; margin-bottom: 2px; } 
    .swipe-header-text p { font-size: 11px; }
    .swipe-container { height: 50vh; min-height: 340px; max-height: 460px; }
    
    .modal-content { padding: 20px 14px; width: 95%; }
    input[type="text"], 
    input[type="number"], 
    input[type="tel"], 
    textarea, 
    .input-field {
        font-size: 16px !important;
    }
}