:root {
    --bg: #f5f7fb;
    --card-bg: #ffffff;
    --border-subtle: #e5e7eb;
    --text-main: #111827;
    --text-muted: #6b7280;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.08);
    --danger: #dc2626;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.08);
    --shadow-light: 0 2px 8px rgba(15, 23, 42, 0.04);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text-main);
}

.app {
    max-width: 960px;
    margin: 0 auto;
    padding: 10px 10px 24px;
}

/* Header */

.app-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.app-header-title {
    flex: 1;
    min-width: 0;
}

.app-header-title h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.app-header-title p {
    margin: 3px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.lang-switch {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.lang-btn {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    cursor: pointer;
}

.lang-btn.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.lang-btn:active {
    transform: translateY(1px);
}

.app-detail .detail-title h1 {
    font-size: 18px;
}

.app-detail .detail-title p {
    font-size: 13px;
}

/* Back link */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    font-size: 13px;
    color: var(--text-main);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-light);
}

.back-link:active {
    transform: translateY(1px);
    box-shadow: none;
}

.back-icon {
    font-size: 14px;
}

/* Cards */

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

/* Filters */

.filters {
    padding: 12px 12px 14px;
    margin-bottom: 16px;
}

.filters-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filters-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1 1 0;
}

.field-grow {
    flex: 2 1 0;
}

.field label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.filters select,
.filters input[type="text"],
.filters input[type="number"] {
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    padding: 7px 11px;
    font-size: 13px;
    outline: none;
    background: #f9fafb;
}

.filters select:focus,
.filters input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft);
    background: #ffffff;
}

.filters-actions {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

/* Buttons */

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 7px 14px;
    font-size: 13px;
    border-radius: 999px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

.btn-primary:active {
    opacity: 0.9;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: rgba(148, 163, 184, 0.6);
}

.btn-ghost:active {
    background: rgba(148, 163, 184, 0.12);
}

/* Listings grid */

.listings {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

/* Listing card */

.listing-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.listing-card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.1);
}

.listing-image-wrap {
    position: relative;
    padding-top: 62%;
    background: #e5e7eb;
    overflow: hidden;
}

.listing-image-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.listing-image-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text-muted);
    background: linear-gradient(135deg, #e5e7eb, #f3f4f6);
}

.listing-info {
    padding: 10px 11px 9px;
}

.listing-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}

.listing-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.listing-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

.listing-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.listing-meta .dot {
    opacity: 0.7;
}

.listing-desc {
    font-size: 12px;
    color: #4b5563;
    line-height: 1.4;
}

/* Detail page */

.detail-gallery {
    padding: 8px;
    margin-bottom: 12px;
}

.detail-gallery-main {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #e5e7eb;
}

.detail-gallery-main img {
    width: 100%;
    height: auto;
    display: block;
}

.detail-gallery-thumbs {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    overflow-x: auto;
}

.detail-gallery-thumbs button {
    border: 1px solid transparent;
    background: transparent;
    padding: 0;
    border-radius: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

.detail-gallery-thumbs button.is-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.detail-gallery-thumbs img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.detail-placeholder {
    padding: 32px 0;
    font-size: 14px;
}

.detail-main {
    padding: 12px 12px 14px;
}

.detail-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.detail-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.detail-badge {
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--accent-soft);
    color: var(--accent);
}

.detail-short {
    margin: 4px 0 8px;
    font-size: 13px;
    color: #4b5563;
}

.detail-description {
    font-size: 13px;
    line-height: 1.5;
    color: #374151;
    white-space: pre-line;
}

.detail-contact {
    margin-top: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-contact-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.detail-contact-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.detail-contact-value {
    font-size: 14px;
    font-weight: 600;
}

/* Empty state */

.empty-state {
    padding: 14px 12px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Pagination */

.pagination {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
}

.page-link {
    color: var(--accent);
    text-decoration: none;
}

.page-link:active {
    text-decoration: underline;
}

.page-current {
    color: var(--text-muted);
}

/* Policy page */

.policy {
    max-width: 900px;
}

.policy-nav {
    display: flex;
    gap: 8px;
    margin: 6px 0 14px;
    flex-wrap: wrap;
}

.policy-tab {
    border: 0;
    cursor: pointer;
    text-decoration: none;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.9);
}

.policy-tab.is-active {
    color: #ffffff;
    background: var(--accent);
    border-color: var(--accent);
}

.policy-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 16px 16px 18px;
    margin-bottom: 12px;
    display: none;
}

.policy-section.is-active {
    display: block;
}

.policy-section h2 {
    margin-top: 0;
    font-size: 18px;
}

.policy-section h3 {
    margin-top: 16px;
    margin-bottom: 6px;
    font-size: 14px;
}

.policy-section p,
.policy-section li {
    font-size: 13px;
    line-height: 1.5;
    color: #374151;
}

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

.policy-table {
    overflow-x: auto;
}

.policy-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.policy-table th,
.policy-table td {
    border: 1px solid var(--border-subtle);
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
}

.policy-table th {
    background: #f3f4f6;
    color: #111827;
    font-weight: 600;
}

/* Cookie banner */

.cookie-banner {
    position: fixed;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 720px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    padding: 12px 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    z-index: 20;
}

.cookie-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.cookie-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
    align-items: center;
}

.cookie-accept {
    flex-shrink: 0;
}

/* Cookie modal */

.cookie-modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
}

.cookie-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
}

.cookie-modal-card {
    position: relative;
    width: min(520px, calc(100% - 24px));
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 16px;
    z-index: 1;
}

.cookie-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.cookie-modal-header h2 {
    margin: 0;
    font-size: 16px;
}

.cookie-modal-close {
    border: 0;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
}

.cookie-modal-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin: 8px 0 12px;
}

.cookie-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border-subtle);
}

.cookie-option p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.cookie-option.is-locked {
    opacity: 0.8;
}

.cookie-option-status {
    font-size: 11px;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 4px 8px;
    border-radius: 999px;
}

.cookie-toggle {
    position: relative;
    width: 44px;
    height: 24px;
}

.cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-toggle-ui {
    position: absolute;
    inset: 0;
    background: #e5e7eb;
    border-radius: 999px;
    transition: background 0.2s ease;
}

.cookie-toggle-ui::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s ease;
}

.cookie-toggle input:checked + .cookie-toggle-ui {
    background: var(--accent);
}

.cookie-toggle input:checked + .cookie-toggle-ui::after {
    transform: translateX(20px);
}

.cookie-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.cookie-modal-open {
    overflow: hidden;
}

/* Mobile adjustments */

@media (max-width: 600px) {
    .app {
        padding-inline: 8px;
    }

    .filters {
        padding-inline: 10px;
    }

    .listing-info {
        padding-inline: 9px;
    }

    .cookie-banner {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .cookie-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .cookie-modal-card {
        padding: 14px;
    }
}
