:root {
    --bg: #0f172a;
    --bg-soft: #0b1220;
    --card-bg: #020617;
    --card-border: rgba(148, 163, 184, 0.2);
    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.1);
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --danger: #ef4444;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.7);
    --transition-fast: 150ms ease-out;
    --tag-bg: rgba(148, 163, 184, 0.12);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    background: radial-gradient(circle at top, #1e293b 0, #020617 45%, #000 100%);
    color: var(--text-main);
    min-height: 100vh;
}

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

a:hover {
    text-decoration: none;
}

/* Layout */

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(18px);
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.8));
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
}

.header-actions {
    display: flex;
    align-items: center;
}

.header-favorites-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(56, 189, 248, 0.08);
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 12px 25px rgba(15, 23, 42, 0.8);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast),
        background var(--transition-fast);
}

.header-favorites-link:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.14);
    text-decoration: none;
    box-shadow: 0 18px 35px rgba(56, 189, 248, 0.15);
}

.header-favorites-link.is-active {
    background: linear-gradient(120deg, rgba(56, 189, 248, 0.16), rgba(250, 204, 21, 0.2));
    border-color: var(--accent);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.25), transparent 55%);
    border: 1px solid rgba(148, 163, 184, 0.3);
    box-shadow: 0 12px 25px rgba(15, 23, 42, 0.7);
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.site-main {
    padding: 24px 0 40px;
}

.feedback-section {
    padding: 40px 0 56px;
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.06), transparent 24%);
}

.feedback-card {
    margin-top: 24px;
    padding: 24px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: radial-gradient(circle at top left, #0b1220, #030712);
    box-shadow: var(--shadow-soft);
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 20px;
    align-items: center;
}

.feedback-copy h2 {
    margin: 0 0 10px;
    font-size: clamp(22px, 3vw, 28px);
}

.feedback-copy p {
    margin: 0;
    color: var(--text-muted);
    max-width: 520px;
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.feedback-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.feedback-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.feedback-field input,
.feedback-field textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-main);
    font-size: 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.feedback-field input:focus,
.feedback-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
    background: rgba(255, 255, 255, 0.04);
}

.feedback-field textarea {
    resize: vertical;
    min-height: 120px;
}

.feedback-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.feedback-submit {
    padding: 12px 18px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(120deg, #38bdf8, #22d3ee);
    color: #0b1220;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(34, 211, 238, 0.2);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

.feedback-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 35px rgba(34, 211, 238, 0.25);
}

.feedback-submit:active {
    transform: translateY(0);
    filter: brightness(0.95);
}

.feedback-note {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}

.feedback-note.is-success {
    color: #4ade80;
}

.site-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.3);
    padding: 16px 0 20px;
    background: radial-gradient(circle at top, #020617, #000);
    color: var(--text-muted);
    font-size: 13px;
}

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

/* Page header */

.page-header h1 {
    font-size: clamp(26px, 4vw, 32px);
    margin: 0 0 8px;
}

.page-header p {
    margin: 0 0 20px;
    color: var(--text-muted);
}

.favorites-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.favorites-back-link {
    align-self: center;
}

.favorites-subtitle {
    color: var(--text-muted);
    margin: 6px 0 0;
}

.eyebrow {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 4px;
}

/* Filters */

.filters-card {
    background: radial-gradient(circle at top left, #020617, #000000);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 18px 18px 14px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 24px;
}

.filters-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.filter-group label,
.filter-label {
    color: var(--text-muted);
}

.filter-group input,
.filter-group select {
    background: #020617;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    padding: 8px 12px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
}

.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-main);
    font-size: 13px;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.tag-chip input {
    display: none;
}

.tag-chip--active {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
}

.tag-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 18px rgba(15, 23, 42, 0.9);
}

.tag-icon {
    font-size: 14px;
}

.filters-actions {
    display: flex;
    gap: 10px;
}

/* Buttons */

.btn-primary,
.btn-ghost {
    border-radius: 999px;
    border: none;
    padding: 9px 16px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: radial-gradient(circle at top left, #38bdf8, #0ea5e9);
    color: #0b1120;
    font-weight: 600;
    box-shadow: 0 16px 35px rgba(8, 47, 73, 0.8);
    border: 1px solid rgba(56, 189, 248, 0.7);
}

.btn-primary:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.btn-ghost {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-main);
    border: 1px solid rgba(148, 163, 184, 0.5);
}

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

.btn-telegram {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #e2f3ff;
    background: linear-gradient(135deg, #2aabee, #229ed9);
    border: 1px solid rgba(34, 158, 217, 0.65);
    border-radius: 14px;
    box-shadow: 0 14px 32px rgba(34, 158, 217, 0.4);
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.btn-telegram:hover {
    filter: brightness(1.05);
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 18px 38px rgba(34, 158, 217, 0.45);
}

.btn-telegram:active {
    transform: translateY(0);
    box-shadow: 0 10px 24px rgba(34, 158, 217, 0.35);
}

.btn-telegram .telegram-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-telegram svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* Cards grid */

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

.favorites-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.listing-card {
    background: radial-gradient(circle at top, #020617, #000);
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-soft);
    transition: transform 150ms ease-out, box-shadow 150ms ease-out, border-color 150ms ease-out;
    position: relative;
}

.listing-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
    border-color: rgba(56, 189, 248, 0.6);
}

.empty-state {
    border: 1px dashed rgba(148, 163, 184, 0.5);
    border-radius: var(--radius-xl);
    padding: 28px;
    text-align: center;
    background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.04), rgba(15, 23, 42, 0.8));
}

.empty-state h2 {
    margin: 6px 0 6px;
}

.empty-state p {
    color: var(--text-muted);
    margin: 0 0 14px;
}

.empty-state[hidden] {
    display: none;
}

.listing-thumb {
    display: block;
}

.listing-thumb-inner {
    position: relative;
    width: 100%;
    /* фиксированное соотношение сторон, чтобы карточки не «прыгали» */
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: radial-gradient(circle at center, #1f2937, #020617);
}

.listing-thumb-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 200ms ease-out;
}

.listing-card:hover .listing-thumb-inner img {
    transform: scale(1.03);
}

.listing-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
}

.carousel--card .carousel-viewport {
    display: block;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--card-border);
    overflow: hidden;
    background: radial-gradient(circle at center, #1f2937, #020617);
}

.carousel--card .carousel-btn {
    width: 30px;
    height: 30px;
    font-size: 18px;
    background: rgba(15, 23, 42, 0.85);
}

.carousel--card .carousel-dots {
    bottom: 8px;
}

.carousel-slide.listing-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
}

.listing-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.listing-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.listing-title {
    font-size: 16px;
    margin: 0;
}

.listing-title a {
    text-decoration: none;
}

.listing-title a:hover {
    text-decoration: none;
}

.listing-price {
    margin: 0;
    font-weight: 600;
    color: #a5f3fc;
}

.listing-address {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* Tags pills */

.listing-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    background: var(--tag-bg);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--text-main);
}

.tag-pill-icon {
    font-size: 13px;
}

.tag-pill {
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.8);
}

/* Favorites */

.favorite-btn {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-muted);
    padding: 4px 9px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.favorite-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.8);
}

.favorite-icon {
    font-size: 16px;
}

.favorite-btn.is-favorite {
    background: radial-gradient(circle at top left, #facc15, #eab308);
    color: #1e293b;
    border-color: #facc15;
}

.favorite-btn.is-favorite .favorite-icon {
    content: "★";
}

/* Detail page */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-muted);
}

.back-link:hover {
    color: var(--accent);
}

.detail-layout {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.detail-main {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.detail-gallery,
.detail-info {
    background: radial-gradient(circle at top, #020617, #000);
    border-radius: var(--radius-xl);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft);
}

.detail-gallery {
    padding: 18px 18px 14px;
}

.detail-info {
    padding: 16px 18px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.detail-header h1 {
    font-size: 22px;
    margin: 0;
}

.detail-price {
    margin-top: 10px;
    margin-bottom: 4px;
    font-size: 20px;
    font-weight: 600;
    color: #a5f3fc;
}

.detail-address {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.detail-description {
    margin-top: 12px;
    font-size: 14px;
}

.detail-description h2 {
    margin: 0 0 6px;
    font-size: 16px;
}

/* Carousel */

.carousel {
    position: relative;
}

.carousel-viewport {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: radial-gradient(circle at 30% 35%, rgba(56, 189, 248, 0.08), transparent 45%),
        radial-gradient(circle at center, #020617, #000);
    /* фиксированная высота по соотношению сторон */
    aspect-ratio: 16 / 9;
    max-height: 620px;
}

.carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 250ms ease-out;
}

.carousel-slide {
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    object-fit: cover;
}

.carousel-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 999px;
    border: none;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-main);
    font-size: 20px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.9);
    transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.carousel-btn:hover {
    background: rgba(15, 23, 42, 1);
    transform: translateY(-50%) translateY(-1px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 1);
}

.carousel-btn-prev {
    left: 10px;
}

.carousel-btn-next {
    right: 10px;
}

.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.carousel-dots button {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    border: none;
    background: rgba(148, 163, 184, 0.6);
    cursor: pointer;
    padding: 0;
}

.carousel-dots button.is-active {
    width: 18px;
    background: #38bdf8;
}

.carousel-thumbnails {
    display: flex;
    gap: 12px;
    margin-top: 14px;
    padding: 6px 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    justify-content: flex-start;
}

.carousel-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.carousel-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 999px;
}

.carousel-thumb {
    min-width: 110px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 14px;
    padding: 3px;
    background: rgba(2, 6, 23, 0.92);
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.carousel-thumb img {
    width: 104px;
    height: 72px;
    display: block;
    border-radius: 11px;
    object-fit: cover;
}

.carousel-thumb.is-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.6);
    transform: translateY(-1px);
}

.carousel-thumb:hover {
    border-color: rgba(56, 189, 248, 0.7);
}

.carousel-fullscreen-btn {
    position: absolute;
    right: 12px;
    bottom: 12px;
    border: none;
    border-radius: 12px;
    padding: 8px 10px;
    background: rgba(15, 23, 42, 0.85);
    color: var(--text-main);
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.9);
    transition: background var(--transition-fast), transform var(--transition-fast);
}

@media (max-width: 768px) {
    .carousel-fullscreen-btn {
        display: none;
    }
}

.carousel-fullscreen-btn:hover {
    background: rgba(15, 23, 42, 1);
    transform: translateY(-1px);
}

.carousel-lightbox[hidden] {
    display: none;
}

.carousel-lightbox {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
}

.carousel-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.carousel-lightbox-content {
    position: relative;
    max-width: min(1280px, 98vw);
    max-height: min(880px, 95vh);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
}

.carousel-lightbox img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.carousel-lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    border-radius: 999px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.9);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

.carousel-lightbox-close:hover {
    background: rgba(15, 23, 42, 1);
}

body.no-scroll {
    overflow: hidden;
}

/* Responsive */

@media (max-width: 900px) {
    .filters-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .feedback-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .site-header .logo {
        display: none;
    }

    .header-inner {
        justify-content: flex-end;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .header-favorites-link {
        padding: 11px 16px;
        margin-right: 12px;
    }

    .filters-row {
        grid-template-columns: minmax(0, 1fr);
    }
    .cards-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .favorites-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .feedback-card {
        padding: 18px;
    }

    .feedback-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
