/* ============================================
   style.css — Основные стили Marketplace
   Все стили привязаны к реальной HTML-разметке
   из header.php, index.php, basemant.php
   ============================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color var(--transition-slow), color var(--transition-slow);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

ul, ol {
    list-style: none;
}

::selection {
    background: var(--primary);
    color: white;
}

/* Focus-visible для доступности */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* --- Layout --- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.main {
    flex: 1;
}

/* ============================================
   Glass morphism — эффект матового стекла
   ============================================ */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
}

/* ============================================
   Ambient Glow — декоративный фон
   ============================================ */
.glow-sphere {
    position: fixed;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
    animation: glowFloat 12s ease-in-out infinite;
}

@keyframes glowFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-40px, 30px) scale(1.05); }
    66% { transform: translate(20px, -20px) scale(0.95); }
}

/* ============================================
   HEADER
   ============================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-base), border-color var(--transition-base);
}

.header__container {
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: space-around;
}

/* Logo */
.header__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
    transition: opacity var(--transition-fast);
}

.header__logo:hover {
    opacity: 0.8;
}

.header__logo-img {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.header__logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

/* Search */
.header__search {
    flex: 1;
    max-width: 560px;
    min-width: 0;
}

.search-form__wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0 6px 0 18px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.search-form__wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-surface);
}

.search-form__input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 10px 0;
    font-size: 14px;
    outline: none;
    font-family: var(--font-sans);
}

.search-form__input::placeholder {
    color: var(--text-muted);
}

.search-form__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: white;
    flex-shrink: 0;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.search-form__btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.search-form__btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* User Nav */
.header__nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.user-nav__link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.user-nav__link:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.user-nav__link--admin {
    color: var(--primary);
}

.user-nav__link--admin:hover {
    background: var(--primary-glow);
}

.user-nav__link svg {
    flex-shrink: 0;
}

.user-nav__text {
    display: inline;
}

/* Кнопка «Регистрация» */
.user-nav__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 20px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.user-nav__btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

/* Theme Toggle */
.header__theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: background var(--transition-fast), color var(--transition-fast);
    margin-left: 4px;
}

.header__theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

/* Показать/скрыть иконки по теме */
[data-theme="light"] .theme-icon--dark { display: block; }
[data-theme="light"] .theme-icon--light { display: none; }
[data-theme="dark"] .theme-icon--dark { display: none; }
[data-theme="dark"] .theme-icon--light { display: block; }

/* Mobile Burger */
.header__mobile-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    gap: 5px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.header__mobile-toggle:hover {
    background: var(--bg-hover);
}

.burger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.header__mobile-toggle[aria-expanded="true"] .burger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.header__mobile-toggle[aria-expanded="true"] .burger-line:nth-child(2) {
    opacity: 0;
}

.header__mobile-toggle[aria-expanded="true"] .burger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   HERO — Главная секция
   ============================================ */
.hero {
    position: relative;
    padding: 100px 0 80px;
    text-align: center;
    overflow: hidden;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.15;
    color: var(--text-main);
    margin-bottom: 16px;
}

.hero h1 .highlight {
    color: var(--primary);
}

.hero .hero__subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto 36px;
    line-height: 1.7;
}

.hero__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.btn--primary {
    background: var(--primary);
    color: white;
}

.btn--primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn--outline {
    background: transparent;
    color: var(--text-main);
    border: 1.5px solid var(--border-color);
}

.btn--outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

.btn--danger {
    background: var(--accent-danger);
    color: white;
    border: 1.5px solid var(--accent-danger);
}

.btn--danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.btn--sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: var(--radius-md);
}

.btn--full {
    width: 100%;
}

/* ============================================
   CATEGORIES — Блок категорий
   ============================================ */
.categories {
    padding: 60px 0;
}

.categories__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.categories__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.categories__link {
    color: var(--primary);
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity var(--transition-fast);
}

.categories__link:hover {
    opacity: 0.7;
}

.categories__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.category-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.category-card__icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--primary-glow);
    color: var(--primary);
    font-size: 22px;
}

.category-card__name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    text-align: center;
}

.category-card__count {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   PRODUCT LISTINGS — Карточки товаров
   ============================================ */
.listings {
    padding: 40px 0 80px;
}

.listings__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.listings__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.listings__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.product-card__image-wrapper {
    position: relative;
    overflow: hidden;
}

.product-card__image {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--bg-elevated);
    object-fit: cover;
    transition: transform var(--transition-base);
}

.product-card:hover .product-card__image {
    transform: scale(1.03);
}

.product-card__body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-card__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.product-card__price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.product-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.product-card__location {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    transition: background var(--transition-base), border-color var(--transition-base);
}

.footer__container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 64px var(--container-padding) 48px;
    display: flex;
    gap: 64px;
}

.footer__info {
    flex: 1.5;
    min-width: 0;
}

.footer__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    margin-bottom: 16px;
}

.footer__logo-img {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.footer__logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
}

.footer__description {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 20px;
    max-width: 320px;
}

.footer__copyright {
    color: var(--text-muted);
    font-size: 13px;
}

.footer__nav {
    display: flex;
    gap: 64px;
    flex-shrink: 0;
}

.footer__nav-group {
    display: flex;
    flex-direction: column;
}

.footer__nav-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-main);
    margin-bottom: 20px;
}

.footer__link {
    display: block;
    color: var(--text-muted);
    font-size: 14px;
    padding: 5px 0;
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.footer__link:hover {
    color: var(--primary);
    transform: translateX(4px);
}

.footer__bottom {
    border-top: 1px solid var(--border-color);
    transition: border-color var(--transition-base);
}

.footer__bottom-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 24px var(--container-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.footer__tech-info {
    color: var(--text-muted);
    font-size: 13px;
}

.footer__socials {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer__social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.footer__social-link:hover {
    color: var(--primary);
    background: var(--primary-glow);
    transform: translateY(-2px);
}

/* ============================================
   Responsive — Адаптивность
   ============================================ */

@media (max-width: 1024px) {
    .footer__container {
        flex-direction: column;
        gap: 40px;
    }

    .footer__nav {
        gap: 40px;
        flex-wrap: wrap;
    }

    .user-nav__text {
        display: none;
    }

    .header__search {
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    :root {
        --container-padding: 16px;
        --header-height: 60px;
    }

    .header__mobile-toggle {
        display: flex;
    }

    .header__nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border-color);
        padding: 16px;
        gap: 4px;
        box-shadow: var(--shadow-lg);
    }

    .header__nav.user-nav--open {
        display: flex;
    }

    .header__nav .user-nav__link,
    .header__nav .user-nav__btn {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }

    .header__theme-toggle {
        display: none;
    }

    .header__search {
        order: -1;
        max-width: none;
        flex-basis: 100%;
        margin: 0;
    }

    .header__container {
        flex-wrap: wrap;
        height: auto;
        padding-top: 12px;
        padding-bottom: 12px;
        gap: 10px;
    }

    .hero {
        padding: 60px 0 48px;
    }

    .categories__grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .listings__grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .footer__container {
        padding: 40px var(--container-padding) 32px;
        gap: 32px;
    }

    .footer__nav {
        flex-direction: column;
        gap: 28px;
    }

    .footer__bottom-container {
        flex-direction: column;
        text-align: center;
    }

    .glow-sphere {
        display: none;
    }

    /* Product detail responsive */
    .product-detail__layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* Categories page responsive */
    .categories-page__container {
        grid-template-columns: 1fr;
    }

    .filter-sidebar {
        position: static;
    }

    /* Profile responsive */
    .profile__layout {
        grid-template-columns: 1fr;
    }

    /* Chat responsive */
    .chat-page__layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .hero h1 {
        font-size: 1.75rem;
        letter-spacing: -0.8px;
    }

    .hero__actions {
        flex-direction: column;
        width: 100%;
    }

    .hero__actions .btn {
        width: 100%;
        text-align: center;
    }

    .categories__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .listings__grid {
        grid-template-columns: 1fr;
    }

    .form__row {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Утилиты
   ============================================ */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

/* ============================================
   AUTH — Страницы авторизации (login/register)
   ============================================ */
.auth {
    padding: 80px 0 60px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: calc(100vh - var(--header-height));
}

.auth__card {
    max-width: 480px;
    margin: 0 auto;
    padding: 40px;
    border-radius: var(--radius-xl);
    width: 100%;
}

.auth__header {
    text-align: center;
    margin-bottom: 32px;
}

.auth__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.auth__subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.auth__footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 14px;
}

.auth__link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.auth__link:hover {
    opacity: 0.7;
}

/* ============================================
   FORMS — Формы и элементы ввода
   ============================================ */
.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form__group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form__label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.form__required {
    color: var(--accent-danger);
}

.form__optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 13px;
}

.form__input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    outline: none;
}

.form__input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-surface);
}

.form__input::placeholder {
    color: var(--text-muted);
}

.form__input--error {
    border-color: var(--accent-danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.form__input--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-hover);
}

.form__input--sm {
    padding: 8px 12px;
    font-size: 13px;
}

.form__input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form__input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.form__input-wrapper .form__input {
    padding-left: 44px;
}

.form__textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 14px;
    resize: vertical;
    min-height: 120px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.form__textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-surface);
}

.form__textarea::placeholder {
    color: var(--text-muted);
}

.form__select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 14px;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form__select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form__error {
    font-size: 13px;
    color: var(--accent-danger);
    margin-top: 4px;
    animation: shakeError 0.3s ease;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.form__hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.form__submit {
    width: 100%;
    padding: 14px;
    margin-top: 8px;
}

/* File upload */
.form__file-upload {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.form__file-upload:hover,
.form__file-upload:focus-within {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.03);
}

.form__file-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.form__file-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

.form__file-upload-placeholder svg {
    color: var(--text-muted);
    opacity: 0.5;
}

.form__file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.form__file-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.form__file-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.form__file-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    background: var(--accent-danger);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    transition: transform var(--transition-fast);
}

.form__file-preview-remove:hover {
    transform: scale(1.1);
}

/* ============================================
   NOTIFICATIONS — Уведомления
   ============================================ */
.notification {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    margin-bottom: 16px;
}

.notification p {
    margin: 0;
}

.notification--visible {
    opacity: 1;
    transform: translateY(0);
}

.notification--success {
    background: var(--accent-success-bg);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.notification--error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.notification--info {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.notification--warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.notification--fixed {
    position: fixed;
    top: calc(var(--header-height) + 16px);
    right: 16px;
    z-index: 2000;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

/* ============================================
   BREADCRUMBS — Хлебные крошки
   ============================================ */
.breadcrumbs {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.breadcrumbs__list {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    flex-wrap: wrap;
}

.breadcrumbs__item::after {
    content: '/';
    color: var(--text-muted);
    margin-left: 8px;
}

.breadcrumbs__item:last-child::after {
    content: '';
}

.breadcrumbs__link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumbs__link:hover {
    color: var(--primary);
}

.breadcrumbs__item--current {
    color: var(--text-main);
    font-weight: 500;
}

/* ============================================
   FILTER SIDEBAR — Боковая панель фильтров
   ============================================ */
.categories-page {
    padding: 32px 0 80px;
}

.categories-page__container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: start;
}

.filter-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 24px);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.filter-sidebar__title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-sidebar__title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 2px;
}

.filter-sidebar__group {
    margin-bottom: 20px;
}

.filter-sidebar__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-sidebar__price-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-sidebar__price-sep {
    color: var(--text-muted);
    flex-shrink: 0;
}

.filter-sidebar__submit {
    width: 100%;
    margin-top: 8px;
}

.filter-sidebar__reset {
    display: block;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    margin-top: 12px;
    padding: 8px;
    transition: color var(--transition-fast);
}

.filter-sidebar__reset:hover {
    color: var(--accent-danger);
}

.listings-content__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.listings-content__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.listings-content__count {
    font-size: 14px;
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: var(--radius-full);
}

/* ============================================
   PRODUCT CARD EXTENSIONS
   ============================================ */
.product-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-card__link--info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-card__favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    z-index: 2;
}

[data-theme="dark"] .product-card__favorite {
    background: rgba(15, 23, 42, 0.9);
}

.product-card__favorite:hover {
    transform: scale(1.1);
    color: var(--accent-danger);
}

.product-card__favorite--active {
    color: var(--accent-danger);
}

.product-card__favorite--active svg {
    fill: currentColor;
}

.product-card__category {
    display: inline-block;
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.product-card__city {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.product-card__date {
    margin-left: auto;
}

.product-card--with-remove {
    position: relative;
}

.product-card__remove-form {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
}

.product-card__remove-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: rgba(239, 68, 68, 0.9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    backdrop-filter: blur(4px);
}

.product-card__remove-btn:hover {
    transform: scale(1.1);
    background: var(--accent-danger);
}

/* ============================================
   PRODUCT DETAIL — Детальная страница товара
   ============================================ */
.product-detail {
    padding: 32px 0 80px;
}

.product-detail__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 14px;
    text-decoration: none;
    margin-bottom: 24px;
    transition: color var(--transition-fast);
}

.product-detail__back:hover {
    color: var(--primary);
}

.product-detail__layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.product-gallery__main {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
}

.product-gallery__image {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
}

.product-gallery__image--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.product-gallery__thumbs {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.product-gallery__thumb {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-color);
    cursor: pointer;
    padding: 0;
    transition: border-color var(--transition-fast), opacity var(--transition-fast);
    opacity: 0.7;
}

.product-gallery__thumb:hover {
    opacity: 1;
}

.product-gallery__thumb--active {
    border-color: var(--primary);
    opacity: 1;
}

.product-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info__header {
    margin-bottom: 20px;
}

.product-info__title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
    line-height: 1.3;
}

.product-info__price {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.product-info__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.product-info__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.product-info__section {
    margin-bottom: 24px;
}

.product-info__section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.product-info__description {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 14px;
}

.product-info__actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
}

.product-info__fav-btn {
    width: 100%;
}

/* Seller card */
.seller-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.seller-card__avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.seller-card__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 120px;
}

.seller-card__name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
}

.seller-card__city {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.seller-card__phone {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.seller-card__btn {
    flex-shrink: 0;
}

/* Related products */
.related-products {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

.related-products__title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.3px;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    margin-top: 32px;
    display: flex;
    justify-content: center;
}

.pagination__list {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination__item {
    display: inline-flex;
}

.pagination__item--dots {
    padding: 0 8px;
    color: var(--text-muted);
    font-size: 14px;
}

.pagination__link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.pagination__link:hover {
    background: var(--bg-hover);
    color: var(--text-main);
    border-color: var(--border-color);
}

.pagination__link--active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination__link--active:hover {
    background: var(--primary-hover);
    color: white;
}

/* ============================================
   EMPTY / LOADING / ERROR STATES
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state--compact {
    padding: 40px 20px;
}

.empty-state__icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state__title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.empty-state__text {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.6;
}

.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.error-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--accent-danger);
    font-size: 14px;
}

/* ============================================
   PROFILE — Страница профиля
   ============================================ */
.profile {
    padding: 32px 0 80px;
}

.profile__layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 32px;
    align-items: start;
}

.profile__sidebar {
    position: sticky;
    top: calc(var(--header-height) + 24px);
}

.profile-card {
    padding: 28px;
    border-radius: var(--radius-lg);
    text-align: center;
}

.profile-card__avatar {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 28px;
    margin: 0 auto 16px;
}

.profile-card__name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-card__email {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.profile-card__stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.profile-card__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.profile-card__stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.profile-card__stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-card__nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-card__nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.profile-card__nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.profile-section {
    padding: 28px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.profile-section__title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.my-products {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.my-products__item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

.my-products__item:hover {
    border-color: var(--primary);
}

.my-products__image-link {
    flex-shrink: 0;
}

.my-products__image {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.my-products__info {
    flex: 1;
    min-width: 0;
}

.my-products__title-link {
    text-decoration: none;
    color: inherit;
}

.my-products__title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.my-products__price {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.my-products__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.my-products__status {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.my-products__status--active {
    background: var(--accent-success-bg);
    color: #16a34a;
}

.my-products__status--sold {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
}

.my-products__status--archived {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.my-products__city, .my-products__views, .my-products__date {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.my-products__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.my-products__delete-form {
    margin: 0;
}

/* ============================================
   FAVORITES PAGE
   ============================================ */
.favorites-page {
    padding: 32px 0 80px;
}

.favorites-page__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.favorites-page__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.favorites-page__count {
    font-size: 14px;
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: var(--radius-full);
}

/* ============================================
   CREATE AD
   ============================================ */
.create-ad {
    padding: 32px 0 80px;
}

.create-ad__card {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px;
    border-radius: var(--radius-xl);
}

.create-ad__header {
    margin-bottom: 32px;
}

.create-ad__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.create-ad__subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.create-ad__actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

/* ============================================
   CHAT — Чат по товарам (вкладки слева)
   Каждая переписка привязана к товару, не к продавцу
   ============================================ */
.chat-page {
    padding: 32px 0 80px;
    height: calc(100vh - var(--header-height));
}

.chat-page__layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    height: calc(100vh - var(--header-height) - 100px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* ===== Chat sidebar (список чатов по товарам) ===== */
.chat-sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-sidebar--hidden {
    display: none;
}

.chat-sidebar__header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.chat-sidebar__title {
    font-size: 1.1rem;
    font-weight: 700;
}

.chat-sidebar__empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.chat-sidebar__empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.chat-sidebar__empty p {
    margin-bottom: 8px;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

/* Элемент списка чатов — мини-карточка товара */
.chat-list__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    text-decoration: none;
    color: inherit;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
}

.chat-list__item:hover {
    background: var(--bg-hover);
}

.chat-list__item--active {
    background: var(--primary-glow);
    border-left: 3px solid var(--primary);
}

/* Миниатюра товара в списке */
.chat-list__product-image {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
}

.chat-list__product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Информация о товаре и чате */
.chat-list__info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.chat-list__product-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.chat-list__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.chat-list__price {
    font-weight: 700;
    color: var(--primary);
}

.chat-list__seller {
    color: var(--text-muted);
}

.chat-list__message {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.chat-list__time {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    flex-shrink: 0;
}

.chat-list__badge {
    background: var(--accent-danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
    line-height: 1.3;
}

/* Chat window */
.chat-window {
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
}

.chat-window--hidden {
    display: none;
}

.chat-window__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}

.chat-window__back {
    display: none;
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast);
}

.chat-window__back:hover {
    color: var(--primary);
}

@media (max-width: 768px) {
    .chat-window__back {
        display: flex;
    }
}

.chat-window__user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-window__avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.chat-window__details {
    display: flex;
    flex-direction: column;
}

.chat-window__name {
    font-size: 14px;
    font-weight: 600;
}

.chat-window__city {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Chat product context */
.chat-window__product {
    padding: 10px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
}

.chat-product {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    transition: background var(--transition-fast);
}

.chat-product:hover {
    background: var(--border-color);
}

.chat-product__image {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-elevated);
}

.chat-product__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-product__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.chat-product__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-product__price {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}

/* Messages area */
.chat-window__messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-window__empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 8px;
}

.chat-window__empty-icon {
    font-size: 48px;
    margin-bottom: 4px;
}

.chat-window__empty h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.chat-window__empty p {
    font-size: 14px;
}

/* Плейсхолдер когда чат не выбран */
.chat-window__placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 8px;
}

.chat-window__placeholder-icon {
    font-size: 56px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.chat-window__placeholder h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.chat-window__placeholder p {
    font-size: 14px;
    max-width: 300px;
    text-align: center;
    line-height: 1.5;
}

.chat-date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
}

.chat-date-divider span {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-body);
    padding: 4px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-light);
}

.chat-message {
    display: flex;
    max-width: 70%;
}

.chat-message--own {
    align-self: flex-end;
}

.chat-message__bubble {
    padding: 10px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
}

.chat-message:not(.chat-message--own) .chat-message__bubble {
    background: var(--bg-surface);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-light);
}

.chat-message--own .chat-message__bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message__text {
    word-break: break-word;
}

.chat-message__time {
    display: block;
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

/* Chat input */
.chat-window__form {
    padding: 16px 20px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
}

.chat-input {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px 8px 8px 16px;
    transition: border-color var(--transition-fast);
}

.chat-input:focus-within {
    border-color: var(--primary);
}

.chat-input__textarea {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 120px;
    padding: 4px 0;
    line-height: 1.5;
}

.chat-input__textarea::placeholder {
    color: var(--text-muted);
}

.chat-input__send {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.chat-input__send:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

/* ============================================
   ADMIN — Админ-панель
   ============================================ */
.admin-page {
    padding: 32px 0 80px;
}

.admin-header {
    margin-bottom: 32px;
}

.admin-header__title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.admin-header__subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* Admin stats */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.admin-stat-card {
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    transition: all var(--transition-fast);
}

.admin-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.admin-stat-card__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

.admin-stat-card__icon--purple {
    background: var(--primary-glow);
}

.admin-stat-card__icon--green {
    background: var(--accent-success-bg);
}

.admin-stat-card__icon--orange {
    background: rgba(245, 158, 11, 0.1);
}

.admin-stat-card__icon--blue {
    background: rgba(59, 130, 246, 0.1);
}

.admin-stat-card__value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 4px;
}

.admin-stat-card__label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Admin tabs */
.admin-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
    overflow-x: auto;
}

.admin-tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all var(--transition-fast);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
}

.admin-tab:hover {
    color: var(--text-main);
}

.admin-tab--active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Admin table */
.admin-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: var(--bg-hover);
}

.admin-table__actions {
    display: flex;
    gap: 6px;
}

.admin-table__status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.admin-table__status--active {
    background: var(--accent-success-bg);
    color: #16a34a;
}

.admin-table__status--sold {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
}

.admin-table__status--archived {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.admin-table__status--admin {
    background: var(--primary-glow);
    color: var(--primary);
}

.admin-table__status--user {
    background: var(--accent-success-bg);
    color: #16a34a;
}

.admin-search {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.admin-search__input {
    max-width: 300px;
}

.admin-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.admin-empty__icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.admin-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.admin-confirm-box {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.admin-confirm-box h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.admin-confirm-box p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.admin-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ============================================
   CITY FILTER (index page)
   ============================================ */
.city-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.city-filter__label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.city-filter__select {
    padding: 8px 36px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color var(--transition-fast);
}

.city-filter__select:focus {
    border-color: var(--primary);
}

/* ============================================
   EXISTING IMAGES — Управление фото при редактировании
   ============================================ */
.existing-images__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.existing-images__item {
    position: relative;
    width: 120px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-elevated);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.existing-images__item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.existing-images__item img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}

.existing-images__delete {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    transition: color var(--transition-fast), background var(--transition-fast);
    user-select: none;
}

.existing-images__delete:hover {
    color: var(--accent-danger);
    background: rgba(239, 68, 68, 0.05);
}

.existing-images__delete input[type="checkbox"] {
    accent-color: var(--accent-danger);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.existing-images__delete span {
    font-weight: 500;
}
