/* ============================================================
   БАРАХОЛКА72 — Светлый современный дизайн
   ============================================================ */

:root {
    --bg: #f8f7f4;
    --bg-2: #ffffff;
    --bg-3: #f0efe9;
    --border: #e5e0d8;
    --text: #2c2416;
    --text-muted: #8b8068;
    --accent: #ef6c00;
    --accent-2: #ff9800;
    --accent-light: #fff3e0;
    --green: #2e7d32;
    --red: #c62828;
    --blue: #1565c0;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.10);
    --bottom-bar-h: 60px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(180deg, #faf9f6 0%, #f5f2eb 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex; flex-direction: column;
    padding-bottom: calc(var(--bottom-bar-h) + var(--safe-bottom));
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; font-weight: 500; transition: color .2s; }
a:hover { color: var(--accent-2); }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 12px; }

/* ============================================================
   HEADER (светлый, чистый)
   ============================================================ */
.header {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; }
.logo {
    font-weight: 800; font-size: 1.15rem; color: var(--text);
    display: flex; align-items: center; gap: 6px; white-space: nowrap; flex-shrink: 0;
    letter-spacing: -0.3px;
}
.logo-icon { font-size: 1.35rem; }
.logo .badge {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; padding: 2px 8px; border-radius: 6px; font-size: 0.72rem; font-weight: 700;
}

/* Десктопная навигация */
.desktop-nav { display: none; }
.desktop-nav a {
    color: var(--text-muted); padding: 8px 14px; border-radius: 8px;
    font-size: 0.9rem; font-weight: 500; transition: all .2s; white-space: nowrap;
}
.desktop-nav a:hover, .desktop-nav a.active { color: var(--accent); background: var(--accent-light); }
.desktop-nav .link-button {
    color: var(--text-muted); padding: 8px 14px; border: 0; border-radius: 8px;
    background: transparent; font: inherit; font-size: 0.9rem; cursor: pointer;
}
.desktop-nav .link-button:hover { color: var(--accent); background: var(--accent-light); }
.desktop-nav .btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff !important; font-weight: 600; box-shadow: 0 2px 8px rgba(239,108,0,0.25);
}
.desktop-nav .badge-count {
    background: var(--red); color: #fff; font-size: 0.65rem;
    border-radius: 50%; padding: 1px 5px; margin-left: 2px;
}

/* Гамбургер */
.hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg-2); color: var(--text); cursor: pointer;
    font-size: 1.2rem; transition: all .2s; flex-shrink: 0;
}
.hamburger:active { background: var(--bg-3); }

/* Поиск в хедере (мобильные) */
.header-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.header-search input {
    width: 100%; padding: 8px 12px; background: var(--bg-3); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text); font-size: 0.9rem; outline: none;
}
.header-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(239,108,0,0.08); }
.header-search button {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; border: none; border-radius: 10px; padding: 8px 12px;
    font-size: 1rem; cursor: pointer; flex-shrink: 0;
}

/* ============================================================
   MOBILE MENU
   ============================================================ */
.mobile-menu-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.35);
    z-index: 200; opacity: 0; pointer-events: none; transition: opacity .25s;
}
.mobile-menu-overlay.open { opacity: 1; pointer-events: auto; }
.mobile-menu {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; max-width: 85vw; background: var(--bg-2); z-index: 201;
    transform: translateX(-100%); transition: transform .25s ease;
    display: flex; flex-direction: column; border-right: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
}
.mobile-menu.open { transform: translateX(0); }
.mobile-menu-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px; border-bottom: 1px solid var(--border);
}
.mobile-menu-close {
    width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
    background: none; color: var(--text); font-size: 1.1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.mobile-menu-body { flex: 1; overflow-y: auto; padding: 8px 0; }
.mobile-menu-body a {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; color: var(--text); font-size: 0.95rem; font-weight: 500;
    transition: background .15s;
}
.mobile-menu-body a:active { background: var(--accent-light); }
.mobile-menu-body .mobile-menu-link {
    width: 100%; border: 0; background: transparent; color: var(--text-muted);
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    font: inherit; text-align: left; cursor: pointer;
}
.mobile-menu-body .mobile-menu-link:active { background: var(--accent-light); }
.mobile-menu-body a .icon { font-size: 1.2rem; width: 24px; text-align: center; }
.mobile-menu-body a .badge-count {
    background: var(--red); color: #fff; font-size: 0.7rem;
    border-radius: 50%; padding: 2px 6px; margin-left: auto;
}
.mobile-menu-body .divider { height: 1px; background: var(--border); margin: 8px 16px; }
.mobile-menu-footer {
    padding: 12px 16px; border-top: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.8rem;
}

/* ============================================================
   BOTTOM NAV
   ============================================================ */
.bottom-bar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: rgba(255,255,255,0.92); backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    height: var(--bottom-bar-h); padding-bottom: var(--safe-bottom);
}
.bottom-bar a {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 1px; color: var(--text-muted);
    font-size: 0.65rem; font-weight: 500; transition: color .15s;
}
.bottom-bar a.active { color: var(--accent); }
.bottom-bar a .icon { font-size: 1.35rem; line-height: 1; }
.bottom-bar a .create-btn {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.6rem; font-weight: 300; margin-top: -12px;
    box-shadow: 0 6px 20px rgba(239,108,0,0.35);
    transition: transform .15s, box-shadow .15s;
}
.bottom-bar a .create-btn:active { transform: scale(0.92); box-shadow: 0 3px 10px rgba(239,108,0,0.25); }

/* ============================================================
   HERO (главная страница)
   ============================================================ */
.hero {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3e0 40%, #fce4ec 100%);
    border-radius: var(--radius); padding: 24px 16px; margin-bottom: 20px;
    text-align: center; position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; top: -60px; right: -40px;
    width: 180px; height: 180px; border-radius: 50%;
    background: rgba(239,108,0,0.08);
}
.hero::after {
    content: ''; position: absolute; bottom: -30px; left: -20px;
    width: 120px; height: 120px; border-radius: 50%;
    background: rgba(21,101,192,0.06);
}
.hero h1 {
    font-size: 1.5rem; font-weight: 800; color: var(--text); position: relative;
    letter-spacing: -0.5px;
}
.hero h1 span { color: var(--accent); }
.hero p { color: var(--text-muted); font-size: 0.9rem; margin-top: 6px; position: relative; }
.hero-stats {
    display: flex; justify-content: center; gap: 20px; margin-top: 14px; position: relative;
}
.hero-stat {
    text-align: center;
}
.hero-stat .num { font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.hero-stat .lbl { font-size: 0.7rem; color: var(--text-muted); }

/* ============================================================
   КАРТОЧКИ
   ============================================================ */
.card {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.card-glow { transition: transform .25s, box-shadow .25s; }
.card-glow:active { transform: scale(0.985); }

.grid-listings { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.listing-card {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    display: flex; flex-direction: column; min-width: 0;
    box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
}
.listing-card .thumb {
    aspect-ratio: 4/3; background: var(--bg-3); overflow: hidden; position: relative;
}
.listing-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.listing-card .thumb .no-photo {
    width: 100%; height: 100%; display: flex; align-items: center;
    justify-content: center; font-size: 2.5rem; opacity: 0.15;
}
.listing-card .badge-cond {
    position: absolute; top: 8px; left: 8px;
    padding: 3px 8px; border-radius: 6px;
    font-size: 0.62rem; font-weight: 700; color: #fff; letter-spacing: 0.3px;
}
.cond-new { background: var(--green); }
.cond-used { background: #6b7280; }
.listing-card .badge-boost {
    position: absolute; top: 8px; right: 8px;
    padding: 3px 8px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
    font-size: 0.6rem; font-weight: 700; color: #fff;
}
.listing-card .price-tag {
    position: absolute; bottom: 8px; right: 8px;
    font-weight: 800; font-size: 0.95rem; color: #fff;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(4px);
    padding: 3px 10px; border-radius: 6px;
}
.listing-card .body { padding: 10px 12px; flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.listing-card .title {
    color: var(--text); font-weight: 600; font-size: 0.85rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.listing-card .meta { color: var(--text-muted); font-size: 0.7rem; display: flex; justify-content: space-between; margin-top: 4px; }

/* ============================================================
   КНОПКИ
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg-2); color: var(--text); cursor: pointer;
    font-size: 0.9rem; font-weight: 600; transition: all .2s;
    min-height: 44px; text-align: center;
}
.btn:active { transform: scale(0.97); }
.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; border: none; box-shadow: 0 2px 8px rgba(239,108,0,0.25);
}
.btn-accent:active { opacity: 0.85; }
.btn-danger { background: var(--red); color: #fff; border: none; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; min-height: 34px; }
.btn-outline { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; border: none; color: var(--text-muted); }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 50%; }

/* ============================================================
   ФОРМЫ
   ============================================================ */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text); font-size: 16px;
    font-family: inherit; -webkit-appearance: none; transition: border .2s, box-shadow .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(239,108,0,0.08);
}

/* ============================================================
   FLASH
   ============================================================ */
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 0.85rem; font-weight: 500; }
.flash.success { background: #e8f5e9; border: 1px solid #a5d6a7; color: #1b5e20; }
.flash.error { background: #ffebee; border: 1px solid #ef9a9a; color: #b71c1c; }
.flash.info { background: #e3f2fd; border: 1px solid #90caf9; color: #0d47a1; }

/* ============================================================
   ПРОЧЕЕ
   ============================================================ */
.breadcrumb { color: var(--text-muted); font-size: 0.78rem; margin-bottom: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb a { color: var(--text-muted); font-weight: 400; }

.page { padding: 16px 0; flex: 1; }
.page-title { font-size: 1.35rem; font-weight: 800; margin-bottom: 14px; letter-spacing: -0.3px; }

.pagination { display: flex; gap: 4px; margin-top: 20px; flex-wrap: wrap; justify-content: center; }
.pagination a, .pagination span {
    padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg-2); color: var(--text); font-size: 0.85rem; font-weight: 500;
    min-width: 38px; text-align: center;
}
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; min-width: 600px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.table th { color: var(--text-muted); font-weight: 600; white-space: nowrap; background: var(--bg-3); }

/* ГАЛЕРЕЯ */
.gallery-main img { width: 100%; max-height: 360px; object-fit: contain; background: var(--bg-3); border-radius: var(--radius); }
.gallery-thumbs { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; flex-shrink: 0; }
.gallery-thumbs img.active { border-color: var(--accent); }

/* ЧАТ */
.chat-box { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; padding: 4px 0; }
.chat-msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 0.85rem; word-break: break-word; }
.chat-msg.mine { align-self: flex-end; background: var(--accent-light); color: var(--text); border-bottom-right-radius: 4px; }
.chat-msg.other { align-self: flex-start; background: var(--bg-3); border-bottom-left-radius: 4px; }
.chat-msg .time { font-size: 0.65rem; color: var(--text-muted); margin-top: 4px; }

/* СТРАНИЦА ОБЪЯВЛЕНИЯ */
.listing-layout { display: flex; flex-direction: column; gap: 16px; }

/* ФУТЕР */
.footer {
    background: var(--bg-3); border-top: 1px solid var(--border);
    padding: 16px 0; text-align: center; color: var(--text-muted); font-size: 0.8rem;
    margin-bottom: calc(var(--bottom-bar-h) + var(--safe-bottom));
}

/* УТИЛИТЫ */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 6px; }
.gap-3 { gap: 10px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.font-bold { font-weight: 700; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; object-fit: cover; flex-shrink: 0;
}
.w-full { width: 100%; }
.flex-wrap { flex-wrap: wrap; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.text-center { text-align: center; }

/* ============================================================
   DESKTOP (768px+)
   ============================================================ */
@media (min-width: 768px) {
    .container { padding: 0 16px; }
    .header-inner { height: 64px; }
    .logo { font-size: 1.3rem; }
    .logo .badge { font-size: 0.78rem; }
    .desktop-nav { display: flex; align-items: center; gap: 2px; }
    .hamburger { display: none; }
    .header-search { display: none; }
    .bottom-bar { display: none; }
    .card-glow:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
    .card-glow:active { transform: none; }
    .btn:hover { border-color: var(--accent); }
    .btn:active { transform: none; }
    .btn-accent:hover { opacity: 0.92; color: #fff; }
    .btn-accent:active { opacity: 1; }
    .grid-listings { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
    .listing-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
    .page { padding: 24px 0; }
    .page-title { font-size: 1.7rem; margin-bottom: 20px; }
    .card { padding: 20px; }
    .gallery-main img { max-height: 480px; }
    .gallery-thumbs img { width: 70px; height: 70px; }
    body { padding-bottom: 0; }
    .footer { margin-bottom: 0; }
    .chat-box { max-height: 460px; }
    .chat-msg { max-width: 75%; }
    .hero { padding: 36px 24px; }
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
}

/* ============================================================
   LARGE (1024px+)
   ============================================================ */
@media (min-width: 1024px) {
    .grid-listings { grid-template-columns: repeat(4, 1fr); gap: 16px; }
    .desktop-nav a { padding: 8px 14px; }
    .page-title { font-size: 1.9rem; }
    .hero { padding: 48px 32px; }
    .hero h1 { font-size: 2.3rem; }
}

/* Анимации */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-up { animation: fadeUp 0.4s ease-out; }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,108,0,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239,108,0,0); }
}
.animate-pulse-ring { animation: pulse 2s infinite; }

/* ============================================================
   PWA: WebSocket-чат и индикаторы
   ============================================================ */

/* Индикатор WebSocket-статуса */
#ws-status {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%;
    margin: 0 4px; vertical-align: middle; flex-shrink: 0;
}

/* Бейдж сообщений */
.badge-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px;
    background: var(--red); color: #fff; border-radius: 10px;
    font-size: 0.7rem; font-weight: 700; line-height: 1;
    margin-left: 2px; vertical-align: middle;
}

/* Точка присутствия (онлайн/оффлайн) */
.presence-dot {
    width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0;
    transition: background 0.3s;
}
.presence-dot.online { background: var(--green); box-shadow: 0 0 6px rgba(46,125,50,0.4); }
.presence-dot.offline { background: #ccc; }

/* Чат: блок сообщений */
.chat-box {
    display: flex; flex-direction: column; gap: 8px;
    padding: 12px; background: var(--bg); border-radius: var(--radius-sm);
    min-height: 200px;
}
.chat-msg {
    max-width: 85%; padding: 10px 14px; border-radius: 14px;
    font-size: 0.95rem; line-height: 1.45; word-break: break-word;
    position: relative;
}
.chat-msg.mine {
    align-self: flex-end; background: var(--accent); color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg.mine .time { color: rgba(255,255,255,0.7); }
.chat-msg.other {
    align-self: flex-start; background: var(--bg-2); color: var(--text);
    border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.chat-msg.sending { opacity: 0.7; }
.chat-msg .time { font-size: 0.7rem; margin-top: 3px; }

/* Индикатор «печатает» */
#typing-indicator {
    animation: blink 1.4s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Toast сообщений */
.message-toast {
    animation: slideInRight 0.3s ease;
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* PWA: баннер установки */
#pwa-install-banner {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; font-weight: 600; font-size: 0.95rem;
    position: sticky; top: 0; z-index: 100;
}

/* PWA: баннер обновления */
.update-banner { animation: slideUp 0.3s ease; }
.update-banner-content {
    display: flex; align-items: center; justify-content: space-between;
    max-width: 1200px; margin: 0 auto; padding: 0 16px;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Камера */
.camera-modal .camera-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.8);
}
.camera-modal .camera-container {
    position: relative; z-index: 1; max-width: 100%; padding: 16px;
}
.camera-controls {
    display: flex; justify-content: center; align-items: center;
    gap: 20px; margin-top: 16px;
}

/* Вложение в чате */
.msg-attachment {
    max-width: 200px; border-radius: 8px; margin-top: 6px; cursor: pointer;
}
.msg-location {
    padding: 6px 10px; background: rgba(21,101,192,0.1);
    border-radius: 8px; font-size: 0.85rem; margin-top: 4px;
}

/* Share-кнопка */
.share-btn {
    background: none; border: none; font-size: 1.2rem; cursor: pointer;
    padding: 4px 8px; border-radius: 8px; transition: background 0.2s;
}
.share-btn:hover { background: var(--bg-3); }

/* Оффлайн-страница */
.offline-page {
    text-align: center; padding: 80px 20px;
}

/* ============================================================
   Lazy-loading изображений
   ============================================================ */

/* Плейсхолдер на время загрузки */
img[loading="lazy"] {
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0;
    background: var(--bg-3);
}
img[loading="lazy"].loaded {
    opacity: 1;
}

/* Placeholder-анимация (пульсирующий серый) */
img[loading="lazy"]:not(.loaded) {
    animation: shimmer 1.5s infinite;
    background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg) 50%, var(--bg-3) 75%);
    background-size: 200% 100%;
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Главное изображение (above-the-fold) — без lazy, грузим сразу */
.gallery-main img:not([loading]) {
    opacity: 1;
}

/* Прелоадер для карточек */
.listing-card .thumb {
    background: var(--bg-3);
    position: relative;
    overflow: hidden;
}
.listing-card .thumb img.loaded {
    opacity: 1;
}
/* ============================================================
   ПРОФИЛЬ ПОЛЬЗОВАТЕЛЯ
   ============================================================ */

/* Обложка */
.profile-cover {
    height: 140px; border-radius: var(--radius) var(--radius) 0 0;
    background: linear-gradient(135deg, #fff3e0, #fce4ec);
    position: relative; overflow: hidden;
    background-size: cover; background-position: center;
}
.profile-cover-edit {
    position: absolute; top: 10px; right: 10px;
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(0,0,0,0.4); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; text-decoration: none;
    backdrop-filter: blur(4px);
}

/* Карточка профиля */
.profile-card {
    background: var(--bg-2); border: 1px solid var(--border);
    border-top: none; border-radius: 0 0 var(--radius) var(--radius);
    padding: 0 16px 16px; position: relative;
    box-shadow: var(--shadow);
}
.profile-avatar-wrap {
    position: relative; margin-top: -40px; display: inline-block;
}
.profile-avatar {
    width: 80px; height: 80px; border-radius: 50%; object-fit: cover;
    border: 3px solid var(--bg-2); box-shadow: var(--shadow-md);
}
.profile-avatar-placeholder {
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; font-size: 2rem; font-weight: 800;
}
.profile-online-dot {
    position: absolute; bottom: 4px; right: 4px;
    width: 14px; height: 14px; border-radius: 50%;
    background: #ccc; border: 2px solid var(--bg-2);
}
.profile-online-dot.online { background: var(--green); box-shadow: 0 0 6px rgba(46,125,50,0.4); }

.profile-info { margin-top: 8px; }
.profile-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-name { font-size: 1.3rem; font-weight: 800; margin: 0; }
.profile-badge {
    padding: 2px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: 700;
}
.profile-badge.admin { background: #ffebee; color: var(--red); }
.profile-badge.moderator { background: #e3f2fd; color: var(--blue); }

.profile-city { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }

/* Рейтинг */
.profile-rating { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.stars { display: flex; gap: 1px; }
.star { font-size: 1.1rem; color: #ddd; }
.star.filled { color: #f59e0b; }
.rating-value { font-weight: 700; font-size: 1rem; }
.rating-count { color: var(--text-muted); font-size: 0.8rem; }

.profile-bio { margin-top: 8px; font-size: 0.9rem; color: var(--text); line-height: 1.5; }

.profile-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Статистика */
.profile-stats {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
    background: var(--border); border-radius: var(--radius); overflow: hidden;
    margin-top: 16px;
}
.stat-item {
    background: var(--bg-2); padding: 14px 8px; text-align: center;
}
.stat-num { font-size: 1.2rem; font-weight: 800; color: var(--accent); }
.stat-lbl { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* Секции */
.profile-section { margin-top: 24px; }
.section-title { font-size: 1.15rem; font-weight: 800; margin-bottom: 12px; }

/* Отзывы */
.reviews-list { display: flex; flex-direction: column; gap: 10px; }
.review-card { padding: 14px 16px; }
.review-header {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.review-author {
    display: flex; align-items: center; gap: 8px;
    color: var(--text); text-decoration: none; font-weight: 600;
}
.avatar-sm {
    width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
}
.review-stars { font-size: 0.85rem; }
.review-date { margin-left: auto; font-size: 0.75rem; color: var(--text-muted); }
.review-comment { margin-top: 8px; font-size: 0.9rem; color: var(--text); line-height: 1.5; }

/* Звёздный рейтинг (инпут) */
.star-rating-input { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.star-rating-input input { display: none; }
.star-rating-input label {
    font-size: 1.8rem; color: #ddd; cursor: pointer; transition: color 0.15s;
}
.star-rating-input input:checked ~ label,
.star-rating-input label:hover,
.star-rating-input label:hover ~ label { color: #f59e0b; }

/* Превью обложки в настройках */
.cover-preview {
    background-size: cover; background-position: center;
    height: 100px; border-radius: var(--radius-sm); margin-bottom: 8px;
}

@media (min-width: 768px) {
    .profile-cover { height: 200px; }
    .profile-avatar { width: 100px; height: 100px; }
    .profile-avatar-wrap { margin-top: -50px; }
    .profile-stats { grid-template-columns: repeat(6, 1fr); }
    .profile-name { font-size: 1.5rem; }
}
