/* ==========================================
   SWINGLY – FINN.no-style App Stylesheet
   Norwegian Golf Equipment Marketplace
   ========================================== */

/* ---------- Pull-to-Refresh ---------- */
.pull-to-refresh {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 0;
    overflow: hidden;
    z-index: 1100;
    background: var(--clr-bg, #f5f5f5);
    transition: none;
}
.pull-to-refresh.releasing {
    transition: height .25s ease;
}
.ptr-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--clr-border, #e5e7eb);
    border-top-color: var(--clr-primary, #1b6b2a);
    border-radius: 50%;
    opacity: 0;
    transform: rotate(0deg);
    transition: opacity .15s;
}
.pull-to-refresh.pulling .ptr-spinner {
    opacity: 1;
}
.pull-to-refresh.refreshing .ptr-spinner {
    opacity: 1;
    animation: ptr-spin .6s linear infinite;
}
@keyframes ptr-spin {
    to { transform: rotate(360deg); }
}

/* ---------- CSS Custom Properties ---------- */
:root {
    --clr-primary: #1b6b2a;
    --clr-primary-dark: #14521f;
    --clr-primary-light: #e8f5e9;
    --clr-accent: #d4a843;
    --clr-accent-light: #fdf5e0;
    --clr-danger: #d94444;
    --clr-danger-light: #fdeaea;
    --clr-text: #1e1e1e;
    --clr-text-muted: #6b7280;
    --clr-bg: #f5f5f5;
    --clr-card: #ffffff;
    --clr-border: #e5e7eb;
    --clr-badge-bg: rgba(50,50,50,.78);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 14px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
    --transition: .2s ease;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --tab-height: 60px;
    --topbar-height: 52px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

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

/* ---------- Base ---------- */
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
    font-family: var(--font);
    background-color: var(--clr-bg);
    color: var(--clr-text);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: calc(var(--tab-height) + var(--safe-bottom));
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--clr-primary); text-decoration: none; }

/* Hide old header & nav – app uses top-bar + tab-bar */
header, nav { display: none !important; }

/* ===========================
   TOP BAR (app-style)
   =========================== */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--clr-card);
    border-bottom: 1px solid var(--clr-border);
    padding: 10px 16px;
    padding-top: calc(10px + var(--safe-top));
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--topbar-height);
}

.top-bar-logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--clr-primary);
    letter-spacing: -.5px;
    white-space: nowrap;
    text-decoration: none;
}

.top-bar-back {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--clr-primary);
    border-radius: 50%;
    transition: background var(--transition);
}
.top-bar-back:hover {
    background: var(--clr-bg);
}

.top-bar-search {
    flex: 1;
    position: relative;
}

.top-bar-search input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1.5px solid var(--clr-border);
    border-radius: 50px;
    font-size: .9rem;
    font-family: var(--font);
    background: var(--clr-bg);
    transition: var(--transition);
}

.top-bar-search input:focus {
    outline: none;
    border-color: var(--clr-primary);
    background: var(--clr-card);
    box-shadow: 0 0 0 3px rgba(27,107,42,.1);
}

.top-bar-search input::placeholder { color: #9ca3af; }

.top-bar-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #9ca3af;
    pointer-events: none;
}

.top-bar-action {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--clr-text);
    transition: var(--transition);
}

.top-bar-action:hover { background: var(--clr-bg); }

/* Auth buttons in top bar (logged-out users) */
.top-bar-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}
.btn-auth-ghost {
    padding: 5px 12px;
    font-size: .78rem;
    font-weight: 600;
    font-family: var(--font);
    border: 1.5px solid var(--clr-border);
    border-radius: 50px;
    background: transparent;
    color: var(--clr-text);
    text-decoration: none;
    white-space: nowrap;
    transition: var(--transition);
    cursor: pointer;
}
.btn-auth-ghost:hover {
    border-color: var(--clr-primary);
    color: var(--clr-primary);
    background: rgba(27,107,42,.04);
}
.btn-auth-cta {
    padding: 5px 12px;
    font-size: .78rem;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    border-radius: 50px;
    background: var(--clr-primary);
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    transition: var(--transition);
    cursor: pointer;
}
.btn-auth-cta:hover {
    background: #155d24;
}
@media (max-width: 520px) {
    .btn-auth-ghost { font-size: .72rem; padding: 5px 10px; }
    .btn-auth-cta { font-size: .72rem; padding: 5px 10px; }
}

/* Home search row (full-width below top-bar) */
.home-search-row {
    position: relative;
    padding: 8px 16px 10px;
    background: var(--clr-card);
}
.home-search-row input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1.5px solid var(--clr-border);
    border-radius: 50px;
    font-size: .9rem;
    font-family: var(--font);
    background: var(--clr-bg);
    transition: var(--transition);
}
.home-search-row input:focus {
    outline: none;
    border-color: var(--clr-primary);
    background: var(--clr-card);
    box-shadow: 0 0 0 3px rgba(27,107,42,.1);
}
.home-search-row input::placeholder { color: #9ca3af; }
.home-search-row svg {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #9ca3af;
    pointer-events: none;
}

/* Search suggestions dropdown */
.search-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: var(--clr-card);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    max-height: 340px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.suggestion-group-title {
    padding: 10px 16px;
    font-weight: 700;
    color: var(--clr-text-muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--clr-bg);
    border-bottom: 1px solid var(--clr-border);
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background var(--transition);
}

.suggestion-item:hover { background: var(--clr-primary-light); }
.suggestion-item-icon { font-size: 1rem; width: 22px; text-align: center; }
.suggestion-item-text { flex: 1; }
.suggestion-item-label { display: block; font-weight: 600; font-size: .88rem; color: var(--clr-text); }
.suggestion-item-info { display: block; font-size: .75rem; color: var(--clr-text-muted); }

/* ===========================
   BOTTOM TAB BAR
   =========================== */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    height: calc(var(--tab-height) + var(--safe-bottom));
    background: var(--clr-card);
    border-top: 1px solid var(--clr-border);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding-top: 6px;
    padding-bottom: var(--safe-bottom);
    z-index: 200;
    overflow: visible;
}

.tab-bar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--clr-text-muted);
    font-size: .65rem;
    font-weight: 600;
    padding: 4px 0;
    transition: color var(--transition);
    position: relative;
}

.tab-bar a.active { color: var(--clr-primary); }

.tab-bar a svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tab-bar a.active svg { stroke-width: 2.5; }

/* The center "+" button */
.tab-bar a.tab-center {
    position: relative;
    top: -14px;
}

.tab-bar a.tab-center .tab-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(27,107,42,.35);
}

.tab-bar a.tab-center svg {
    stroke: white;
    width: 28px;
    height: 28px;
}

.tab-bar a.tab-center span.tab-label { display: none; }

/* Badge on tab (e.g. message count) */
.tab-badge {
    position: absolute;
    top: -2px;
    right: calc(50% - 18px);
    background: var(--clr-danger);
    color: white;
    font-size: .6rem;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ===========================
   CATEGORY PILLS (horizontal scroll)
   =========================== */
.category-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-pills::-webkit-scrollbar { display: none; }

.category-pill {
    flex-shrink: 0;
    padding: 8px 18px;
    border-radius: 50px;
    border: 1.5px solid var(--clr-border);
    background: var(--clr-card);
    font-size: .85rem;
    font-weight: 600;
    color: var(--clr-text);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: var(--font);
}

.category-pill:hover { border-color: var(--clr-primary); color: var(--clr-primary); }

.category-pill.active {
    background: var(--clr-primary);
    color: white;
    border-color: var(--clr-primary);
}

/* ===========================
   SECTION HEADERS
   =========================== */
.section-header {
    padding: 20px 16px 10px;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--clr-text);
}

/* ===========================
   FINN-STYLE AD CARDS (2-column grid)
   =========================== */
.finn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 12px 24px;
}

.finn-card {
    cursor: pointer;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--clr-card);
    transition: transform var(--transition);
}

.finn-card:active { transform: scale(.97); }

.finn-card-img {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #e5e7eb;
    overflow: hidden;
}

.finn-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.finn-card-img .no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b0b0b0;
    font-size: .8rem;
    background: linear-gradient(135deg, #e8e8e8, #d5d5d5);
}

/* Price badge – overlay on image */
.finn-price-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: var(--clr-badge-bg);
    color: white;
    font-weight: 700;
    font-size: .82rem;
    padding: 5px 10px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Heart / favorite button */
.finn-heart {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 2;
}

.finn-heart svg {
    width: 18px;
    height: 18px;
    stroke: #6b7280;
    fill: none;
    stroke-width: 2;
    transition: fill .15s ease, stroke .15s ease;
}

.finn-heart.liked svg {
    fill: var(--clr-danger);
    stroke: var(--clr-danger);
}

.finn-heart:hover { transform: scale(1.1); }

/* Card info below image */
.finn-card-info {
    padding: 10px 10px 14px;
    min-height: 58px;
}

.finn-card-location {
    font-size: .75rem;
    color: var(--clr-text-muted);
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.finn-card-title {
    font-size: .88rem;
    font-weight: 600;
    color: var(--clr-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===========================
   PAGE CONTENT (app-style)
   =========================== */
.app-page {
    max-width: 600px;
    margin: 0 auto;
}

.app-page-wide {
    max-width: 800px;
    margin: 0 auto;
}

.app-content {
    padding: 16px;
}

.app-card {
    background: var(--clr-card);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--clr-text);
    padding: 20px 16px 8px;
}

.page-subtitle {
    font-size: .88rem;
    color: var(--clr-text-muted);
    padding: 0 16px 16px;
}

/* ===========================
   BUTTONS (app style)
   =========================== */
.btn {
    padding: 14px 28px;
    font-size: .95rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1.4;
    font-family: var(--font);
    width: 100%;
}

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

.btn-primary:active { background: var(--clr-primary-dark); }

.btn-secondary {
    background: var(--clr-bg);
    color: var(--clr-text);
    border: 1.5px solid var(--clr-border);
}

.btn-secondary:active { background: #e5e7eb; }

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

/* Profile links section */
.profile-links-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--clr-border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ---------- Settings section ---------- */
.settings-section {
    margin-top: 24px;
    padding: 20px 16px;
    background: var(--clr-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--clr-border);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.setting-label {
    font-size: .9rem;
    font-weight: 600;
    color: var(--clr-text);
}

.setting-description {
    font-size: .8rem;
    color: var(--clr-text-muted);
    margin-top: 2px;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--clr-border);
    border-radius: 28px;
    transition: .25s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: .25s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--clr-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.profile-link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 4px;
    font-size: .88rem;
    font-weight: 500;
    color: var(--clr-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background .15s ease;
}

.profile-link-item:hover,
.profile-link-item:active {
    background: var(--clr-bg);
}

.profile-link-item svg {
    color: var(--clr-text-muted);
    flex-shrink: 0;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.button-group .btn { flex: 1; }

/* ===========================
   FORMS (app-style)
   =========================== */
.form-group { margin-bottom: 18px; }

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--clr-text);
    font-size: .88rem;
}

input, select, textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 16px;
    background: var(--clr-card);
    transition: var(--transition);
    -webkit-appearance: none;
}

input[type="checkbox"] {
    width: auto;
    padding: 0;
    -webkit-appearance: checkbox;
    appearance: checkbox;
}

textarea { resize: vertical; min-height: 110px; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px rgba(27,107,42,.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.required { color: var(--clr-danger); }

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

.price-input-wrapper input { padding-right: 40px; }

.price-unit {
    position: absolute;
    right: 14px;
    font-weight: 700;
    color: var(--clr-text);
    pointer-events: none;
}

.specifications-box {
    background: var(--clr-bg);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--clr-border);
}

.spec-section { margin-bottom: 14px; }
.spec-section:last-child { margin-bottom: 0; }
.spec-section select { margin-top: 6px; }

/* ===========================
   TABS (Auth)
   =========================== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--clr-border);
    margin-bottom: 24px;
}

.tab-button {
    flex: 1;
    padding: 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    color: var(--clr-text-muted);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    font-family: var(--font);
    text-align: center;
}

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

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===========================
   MESSAGES (Finn-style)
   =========================== */
body[data-page="messages"] {
    overflow: hidden;
    height: 100dvh;
    padding-bottom: 0;
}
body[data-page="messages"] .top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}
.messages-container {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: calc(var(--topbar-height) + var(--safe-top));
    left: 0;
    right: 0;
    bottom: calc(var(--tab-height) + var(--safe-bottom));
    background: var(--clr-card);
    overflow: hidden;
}

/* --- Conversation list --- */
.conversations-list {
    overflow-y: auto;
    flex: 1;
    background: var(--clr-card);
}

.no-conversations {
    padding: 40px 16px;
    text-align: center;
    color: var(--clr-text-muted);
    font-size: .9rem;
}

/* Conversation item – Finn-style */
.convo-item {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--clr-border);
    cursor: pointer;
    transition: background .15s ease;
    align-items: center;
}
.convo-item:active { background: var(--clr-bg); }
.convo-item.active { background: var(--clr-primary-light); }

/* Thumbnail with avatar overlay */
.convo-thumb {
    position: relative;
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    overflow: visible;
}
.convo-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--clr-bg);
}
.convo-thumb-placeholder {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
    background: var(--clr-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--clr-text-muted);
}

/* Avatar badge overlapping thumbnail bottom-right */
.convo-avatar {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--clr-primary-light);
    border: 2px solid var(--clr-card);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.convo-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.convo-avatar-letter {
    font-size: .7rem;
    font-weight: 800;
    color: var(--clr-primary);
}

/* Conversation body text */
.convo-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}
.convo-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.convo-ad-name {
    font-weight: 700;
    font-size: .92rem;
    color: var(--clr-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.convo-date {
    font-size: .72rem;
    color: var(--clr-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.convo-preview {
    font-size: .8rem;
    color: var(--clr-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* --- Chat panel --- */
.messages-panel { display: none; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
#conversationPanel { min-height: 0; overflow: hidden; }

.chat-back-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px 4px 0;
    color: var(--clr-text);
}

.messages-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--clr-border);
    background: var(--clr-card);
    display: flex;
    align-items: center;
    gap: 10px;
}
.messages-header h2 { color: var(--clr-primary); margin: 0 0 2px; font-size: 1rem; }
.messages-header p { margin: 0; font-size: .75rem; color: var(--clr-text-muted); }

.chat-header-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--clr-primary-light);
    color: var(--clr-primary);
    font-weight: 700;
    font-size: .95rem;
    text-decoration: none;
    transition: box-shadow var(--transition);
}
.chat-header-avatar:hover {
    box-shadow: 0 0 0 2px var(--clr-primary);
}

/* ===========================
   SOLD STATUS
   =========================== */
.detail-sold-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    letter-spacing: 4px;
    text-transform: uppercase;
    z-index: 5;
    pointer-events: none;
}

.detail-image {
    position: relative;
}

.sold-badge-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    color: white;
    letter-spacing: 2px;
    z-index: 3;
    pointer-events: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.finn-card-sold {
    opacity: .75;
}

.finn-card-sold .finn-card-img {
    position: relative;
}

/* ===========================
   REVIEW STARS
   =========================== */
.review-field {
    margin-bottom: 14px;
}
.review-label {
    display: block;
    font-size: .82rem;
    font-weight: 700;
    color: var(--clr-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.star-rating {
    display: flex;
    gap: 4px;
}
.star-rating .star {
    font-size: 2rem;
    cursor: pointer;
    color: #f59e0b;
    transition: transform .1s;
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
}
.star-rating .star:hover {
    transform: scale(1.15);
}

/* Sold tag in conversations */
.convo-sold-tag {
    display: inline-block;
    background: #f59e0b;
    color: white;
    font-size: .55rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: .5px;
}
.convo-thumb-sold {
    position: relative;
}
.convo-thumb-sold::after {
    content: 'SOLGT';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .5rem;
    font-weight: 800;
    letter-spacing: 1px;
    border-radius: var(--radius-sm);
    pointer-events: none;
}

.messages-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--clr-bg);
}

.message { display: flex; margin-bottom: 6px; }
.message.sent { justify-content: flex-end; }
.message.received { justify-content: flex-start; }

.message-wrap {
    max-width: 75%;
    display: flex;
    flex-direction: column;
}
.message.sent .message-wrap { align-items: flex-end; }
.message.received .message-wrap { align-items: flex-start; }

.message-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: .88rem;
    line-height: 1.45;
    word-wrap: break-word;
}

.message.sent .message-bubble {
    background: var(--clr-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
    background: var(--clr-card);
    color: var(--clr-text);
    border: 1px solid var(--clr-border);
    border-bottom-left-radius: 4px;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
    padding: 0 4px;
}

.message-time { font-size: .65rem; color: var(--clr-text-muted); }

.msg-check {
    font-size: .65rem;
    color: var(--clr-text-muted);
    letter-spacing: -2px;
}
.msg-check.msg-read {
    color: var(--clr-primary);
}

/* Ulest-indikator i samtalelisten */
.convo-unread .convo-ad-name { color: var(--clr-text); }
.convo-unread .convo-preview { color: var(--clr-text); font-weight: 600; }
.convo-unread-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--clr-primary);
    flex-shrink: 0;
    align-self: center;
}

.messages-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--clr-border);
    background: var(--clr-card);
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.messages-input-area textarea {
    flex: 1;
    padding: 11px 16px;
    border: 1.5px solid var(--clr-border);
    border-radius: 22px;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.4;
    resize: none;
    min-height: 44px;
    height: 44px;
    max-height: 120px;
    overflow-y: auto;
    word-wrap: break-word;
    background: var(--clr-card);
    color: var(--clr-text);
    box-sizing: border-box;
}

.messages-input-area textarea:focus {
    border-color: var(--clr-primary);
    outline: none;
}

.messages-input-area button {
    padding: 11px 20px;
    background: var(--clr-primary);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: .85rem;
    cursor: pointer;
    font-family: var(--font);
    flex-shrink: 0;
}

.messages-input-area button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

body.composing .tab-bar { display: none; }
body.composing .messages-container { bottom: 0; }

/* Mobile: full-screen list/chat toggle */
.messages-container.chat-open .conversations-list { display: none; }
.messages-container.chat-open .messages-panel { display: flex; }
.messages-container.chat-open .chat-back-btn { display: block; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--clr-text-muted);
    font-size: .9rem;
}

.no-conversations {
    padding: 32px;
    text-align: center;
    color: var(--clr-text-muted);
    font-size: .88rem;
}

/* ===========================
   STATUS MESSAGES
   =========================== */
.success {
    color: #166534;
    background: var(--clr-primary-light);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: none;
    font-weight: 600;
    font-size: .88rem;
    border-left: 4px solid var(--clr-primary);
}

.resend-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background: var(--clr-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}
.resend-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.error {
    color: #991b1b;
    background: var(--clr-danger-light);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: none;
    font-weight: 600;
    font-size: .88rem;
    border-left: 4px solid var(--clr-danger);
}

/* ===========================
   NOT LOGGED IN
   =========================== */
.not-logged-in {
    text-align: center;
    padding: 48px 24px;
    margin: 40px 16px;
    background: var(--clr-card);
    border-radius: var(--radius-lg);
}

.not-logged-in h2 { color: var(--clr-text); margin-bottom: 10px; font-size: 1.2rem; }
.not-logged-in p { color: var(--clr-text-muted); margin-bottom: 24px; font-size: .9rem; }

.not-logged-in a {
    display: inline-block;
    background: var(--clr-primary);
    color: white;
    padding: 14px 36px;
    border-radius: var(--radius-sm);
    font-weight: 700;
}

/* ===========================
   AD DETAILS
   =========================== */
.detail-top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--clr-card);
    border-bottom: 1px solid var(--clr-border);
    padding: 10px 16px;
    padding-top: calc(10px + var(--safe-top));
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--topbar-height);
}

.detail-back {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--clr-text);
    font-size: 1.3rem;
}

.detail-back:hover { background: var(--clr-bg); }

.detail-top-title {
    flex: 1;
    font-weight: 700;
    font-size: 1rem;
    color: var(--clr-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detail-top-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.detail-top-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    transition: background var(--transition);
}
.detail-top-btn:hover {
    background: var(--clr-bg);
}
.detail-top-btn svg {
    stroke: var(--clr-text) !important;
}
.detail-top-btn.liked svg {
    fill: var(--clr-danger) !important;
    stroke: var(--clr-danger) !important;
}

.detail-image {
    width: 100%;
    aspect-ratio: 4/3;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b0b0b0;
    overflow: hidden;
}

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

.detail-body { padding: 20px 16px; }

.detail-price {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--clr-text);
    margin-bottom: 4px;
}

.detail-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--clr-text);
    margin-bottom: 12px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.detail-tag {
    padding: 5px 12px;
    background: var(--clr-bg);
    border-radius: 50px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--clr-text-muted);
}

/* Set clubs detail (ad-details) */
.set-clubs-detail {
    margin-top: 16px;
    background: var(--clr-bg);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.set-clubs-detail-label {
    font-size: .82rem;
    font-weight: 700;
    color: var(--clr-text);
    margin-bottom: 10px;
}

.set-clubs-detail-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
}

.set-club-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    font-weight: 500;
    color: var(--clr-text);
    padding: 4px 0;
}

.detail-section {
    padding: 18px 0;
    border-top: 1px solid var(--clr-border);
}

.detail-section-title {
    font-size: .82rem;
    font-weight: 700;
    color: var(--clr-text);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-bottom: 10px;
}

.detail-desc {
    font-size: .92rem;
    color: var(--clr-text-muted);
    line-height: 1.65;
    white-space: pre-line;
}

.detail-seller-card {
    background: var(--clr-bg);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.detail-seller-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 50%;
    background: var(--clr-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--clr-primary);
    font-weight: 800;
    overflow: hidden;
    flex-shrink: 0;
}

.detail-seller-name { font-weight: 700; font-size: .95rem; color: var(--clr-text); }
.detail-seller-sub { font-size: .78rem; color: var(--clr-text-muted); }

.detail-contact-btn {
    position: sticky;
    bottom: calc(var(--tab-height) + var(--safe-bottom) + 12px);
    margin: 0 16px 10px;
    padding: 16px;
    background: var(--clr-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: calc(100% - 32px);
    font-family: var(--font);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(27,107,42,.3);
}

.detail-contact-btn:active { background: var(--clr-primary-dark); }

/* ===========================
   FILTERS (browse page)
   =========================== */
.filters-bar {
    padding: 12px 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.filters-bar::-webkit-scrollbar { display: none; }

.filter-chip {
    padding: 8px 14px;
    border: 1.5px solid var(--clr-border);
    border-radius: 50px;
    background: var(--clr-card);
    font-size: .82rem;
    font-weight: 600;
    color: var(--clr-text);
    cursor: pointer;
    font-family: var(--font);
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-chip.active {
    border-color: var(--clr-primary);
    background: var(--clr-primary-light);
    color: var(--clr-primary);
}

.sort-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 14px 20px;
    border: none;
    background: none;
    font-size: .9rem;
    font-family: var(--font);
    cursor: pointer;
    color: var(--clr-text);
    transition: background .15s;
}
.sort-option:not(:last-child) {
    border-bottom: 1px solid var(--clr-border);
}
.sort-option:hover {
    background: var(--clr-bg);
}
.sort-option.active {
    color: var(--clr-primary);
    font-weight: 700;
}

/* Save search button (inline with filter tags) */
.save-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border: 1.5px dashed var(--clr-primary);
    border-radius: 50px;
    background: transparent;
    color: var(--clr-primary);
    font-size: .78rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.save-search-btn:hover {
    background: var(--clr-primary-light);
}
.save-search-btn svg {
    stroke: currentColor;
    flex-shrink: 0;
}

/* ===========================
   CATEGORY PAGE (sidebar becomes drawer on mobile)
   =========================== */
.category-container {
    max-width: 600px;
    margin: 0 auto;
}

.sidebar {
    background: var(--clr-card);
    padding: 16px;
    margin: 0 12px 12px;
    border-radius: var(--radius-md);
}

.filter-section { margin-bottom: 18px; }

.filter-title {
    font-weight: 700;
    color: var(--clr-text);
    margin-bottom: 10px;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.filter-option {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
}

.filter-option input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: var(--clr-primary);
    cursor: pointer;
}

.filter-option label {
    margin: 0;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 400;
}

.main-content { padding: 0 12px; }

.category-header {
    padding: 16px;
    background: var(--clr-card);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.category-header h1 { margin: 0 0 4px; text-align: left; font-size: 1.3rem; color: var(--clr-text); }
.category-header p { color: var(--clr-text-muted); margin: 0; font-size: .82rem; }

.ads-grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding-bottom: 20px;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--clr-text-muted);
    background: var(--clr-card);
    border-radius: var(--radius-md);
}

/* ===========================
   PROFILE PAGE
   =========================== */
.profile-card {
    background: var(--clr-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 12px;
}

.profile-header {
    text-align: center;
    padding: 32px 20px 24px;
    background: linear-gradient(135deg, var(--clr-primary-light), var(--clr-accent-light));
}

.profile-avatar { font-size: 3rem; margin-bottom: 10px; }
.profile-name { font-size: 1.25rem; font-weight: 800; color: var(--clr-text); }
.profile-email { color: var(--clr-text-muted); font-size: .85rem; margin-top: 2px; }

.handicap-badge {
    display: inline-block;
    background: var(--clr-primary-light);
    border: 2px solid var(--clr-primary);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    color: var(--clr-primary);
    margin-top: 14px;
}

.handicap-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .5px; color: var(--clr-text-muted); margin-bottom: 2px; }
.handicap-value { font-size: 1.3rem; font-weight: 800; }

.profile-stat {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--clr-border);
}

.stat-label { color: var(--clr-text-muted); font-size: .82rem; }
.stat-value { font-weight: 700; color: var(--clr-primary); font-size: .82rem; }

.profile-stats-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 10px 20px;
    border-top: 1px solid var(--clr-border);
}

.profile-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.profile-stat-item .stat-num {
    font-size: .88rem;
    font-weight: 800;
    color: var(--clr-text);
}

.profile-stat-item .stat-txt {
    font-size: .78rem;
    color: var(--clr-text-muted);
}

/* Profile Tabs */
.profile-tabs {
    display: flex;
    background: var(--clr-card);
    border-radius: var(--radius-md);
    margin-bottom: 2px;
    overflow: hidden;
    border: 1px solid var(--clr-border);
}

.profile-tab {
    flex: 1;
    padding: 12px 6px;
    border: none;
    background: none;
    font-family: var(--font);
    font-size: .78rem;
    font-weight: 600;
    color: var(--clr-text-muted);
    cursor: pointer;
    position: relative;
    transition: color var(--transition);
}

.profile-tab.active {
    color: var(--clr-primary);
}

.profile-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 2.5px;
    background: var(--clr-primary);
    border-radius: 2px 2px 0 0;
}

.profile-tab-content {
    display: none;
    padding: 12px 0;
}

.profile-tab-content.active {
    display: block;
}

/* Profile ads grid (reuses finn-card styles) */
.profile-ads-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.profile-show-more {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background: none;
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .82rem;
    font-weight: 600;
    color: var(--clr-primary);
    cursor: pointer;
}

.content-section {
    background: var(--clr-card);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.section-title {
    font-size: 1.05rem;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--clr-border);
    color: var(--clr-text);
}

.ad-item {
    background: var(--clr-bg);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--clr-border);
}

.ad-info { overflow: hidden; min-width: 0; flex: 1; margin-right: 12px; }
.ad-info h4 { color: var(--clr-primary); margin-bottom: 3px; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-info p { color: var(--clr-text-muted); font-size: .78rem; margin: 0; }
.ad-price { font-weight: 800; color: var(--clr-primary); white-space: nowrap; }

/* ===========================
   ABOUT PAGE
   =========================== */
.about-section {
    line-height: 1.7;
}

.about-section h2 { color: var(--clr-text); margin-bottom: 14px; font-size: 1.3rem; }
.about-section p { color: var(--clr-text-muted); margin-bottom: 14px; font-size: .92rem; }
.about-section h3 { color: var(--clr-text); margin-top: 24px; margin-bottom: 10px; font-size: 1.05rem; }

.values-list { list-style: none; padding: 0; }

.values-list li {
    padding: 8px 0 8px 28px;
    position: relative;
    color: var(--clr-text-muted);
    font-size: .92rem;
}

.values-list li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: var(--clr-primary);
    font-weight: 800;
}

/* ===========================
   MODAL
   =========================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--clr-card);
    margin: 80px auto;
    padding: 24px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--clr-text);
}

.modal-close {
    float: right;
    font-size: 1.4rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-form textarea { min-height: 90px; }

.modal-buttons { display: flex; gap: 8px; justify-content: flex-end; }

.modal-buttons button {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: .85rem;
    font-family: var(--font);
}

.modal-buttons button.primary { background: var(--clr-primary); color: white; }
.modal-buttons button.secondary { background: var(--clr-bg); color: var(--clr-text); border: 1px solid var(--clr-border); }

/* Fullscreen image viewer */
.image-viewer-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1300;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
}

.image-viewer-img {
    width: 100%;
    max-width: min(1100px, 96vw);
    max-height: 88vh;
    object-fit: contain;
}

.image-viewer-close {
    position: absolute;
    top: max(16px, var(--safe-top));
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.image-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10;
}

.image-viewer-prev { left: 12px; }
.image-viewer-next { right: 12px; }

.image-viewer-counter {
    position: absolute;
    bottom: max(14px, calc(var(--safe-bottom) + 6px));
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: .82rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
}

@media (max-width: 640px) {
    .image-viewer-nav {
        width: 36px;
        height: 36px;
    }
    .image-viewer-nav svg {
        width: 20px;
        height: 20px;
    }
}

/* Set clubs checkboxes */
.set-clubs-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.set-clubs-checkboxes.set-clubs-columns {
    grid-auto-flow: column;
    grid-template-rows: repeat(5, auto);
}

.set-clubs-checkboxes label {
    font-weight: 400;
    font-size: .85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* Segmented control (iron type toggle) */
.segmented-control {
    display: flex;
    background: var(--clr-bg);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 3px;
    border: 1px solid var(--clr-border);
}

.seg-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-size: .85rem;
    font-weight: 500;
    color: var(--clr-text-muted);
    border-radius: calc(var(--radius-md) - 2px);
    cursor: pointer;
    transition: all .2s ease;
}

.seg-btn.active {
    background: var(--clr-primary);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.handicap-info {
    background: var(--clr-primary-light);
    padding: 10px 14px;
    border-left: 4px solid var(--clr-primary);
    margin-top: 8px;
    font-size: .8rem;
    color: var(--clr-text-muted);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ===========================
   EMPTY / LOADING
   =========================== */
/* Beta banner */
.beta-banner {
    position: relative;
    margin: 8px 16px;
    padding: 14px 36px 14px 16px;
    background: var(--clr-primary-light);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--clr-primary);
}
.beta-banner-badge {
    display: inline-block;
    background: var(--clr-primary);
    color: white;
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 50px;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.beta-banner p {
    font-size: .85rem;
    color: var(--clr-text);
    margin: 4px 0;
    line-height: 1.4;
}
.beta-banner a {
    font-size: .84rem;
    color: var(--clr-primary);
    font-weight: 600;
    text-decoration: none;
}
.beta-banner-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--clr-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* Onboarding card (in-grid CTA) */
.onboarding-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 24px 16px;
    background: var(--clr-primary-light);
    border: 1.5px dashed var(--clr-primary);
    border-radius: var(--radius-md);
    min-height: 200px;
}
.onboarding-card-title {
    margin: 0;
    font-size: .92rem;
    font-weight: 700;
    color: var(--clr-text);
}
.onboarding-card-sub {
    margin: 0 0 4px;
    font-size: .82rem;
    color: var(--clr-text-muted);
}

.empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: var(--clr-text-muted);
    font-size: .9rem;
}

/* ===========================
   DESKTOP ENHANCEMENTS (> 600px)
   =========================== */
@media (min-width: 601px) {
    .section-header {
        max-width: 800px;
        margin: 0 auto;
        padding: 20px 20px 10px;
    }
    .finn-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 800px;
        margin: 0 auto;
        padding: 0 20px 24px;
    }
    .filters-bar, .active-filters {
        max-width: 800px;
        margin-left: auto;
        margin-right: auto;
        padding-left: 20px;
        padding-right: 20px;
    }
    .filter-sheet { max-width: 800px; }

    .app-page { max-width: 600px; }

    .messages-container {
        flex-direction: row;
        max-width: 800px;
        margin: 0 auto;
        height: calc(100vh - var(--topbar-height) - var(--tab-height) - 40px);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        margin-top: 10px;
    }
    .conversations-list {
        width: 320px;
        flex-shrink: 0;
        border-right: 1px solid var(--clr-border);
        border-bottom: none;
    }
    .messages-panel { display: flex; }
    .messages-container.chat-open .conversations-list { display: block; }
    .messages-container.chat-open .chat-back-btn { display: none; }
}

@media (min-width: 900px) {
    .section-header { max-width: 1000px; }
    .finn-grid { grid-template-columns: repeat(4, 1fr); max-width: 1000px; }
    .filters-bar, .active-filters { max-width: 1000px; }
    .filter-sheet { max-width: 1000px; }
}

/* Password toggle */
.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 44px; }
.pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--clr-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}
.pw-toggle:hover { color: var(--clr-text); }

/* ===========================
   REPORT BUTTON
   =========================== */
.detail-report-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 0 16px 16px;
    padding: 12px;
    background: none;
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-sm);
    color: var(--clr-text-muted);
    font-size: .85rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    text-align: center;
}
.detail-report-btn:active { background: var(--clr-bg); }

/* ===========================
   CHAT ACTION MENU
   =========================== */
.chat-action-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    padding: 4px 0;
    z-index: 100;
    min-width: 200px;
}
.chat-action-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    border: none;
    background: none;
    font-size: .88rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    color: var(--clr-text);
}
.chat-action-menu button:active { background: var(--clr-bg); }

/* ===========================
   ADMIN PANEL
   =========================== */
.admin-stat-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.admin-stat-num {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--clr-primary);
}
.admin-stat-label {
    font-size: .78rem;
    color: var(--clr-text-muted);
    margin-top: 2px;
}
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.admin-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    overflow-x: auto;
}
.admin-tab {
    padding: 8px 16px;
    border: 1.5px solid var(--clr-border);
    border-radius: 20px;
    background: white;
    font-size: .82rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    white-space: nowrap;
    color: var(--clr-text-muted);
}
.admin-tab.active {
    background: var(--clr-primary);
    color: white;
    border-color: var(--clr-primary);
}
.admin-report-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--clr-border);
}
.admin-report-card:has([style*="e67e22"]) { border-left-color: #e67e22; }

/* ===========================
   BROWSE FILTER SHEET
   =========================== */
.filter-chip {
    appearance: auto;
    padding-right: 24px;
}

.filter-btn {
    appearance: none !important;
    padding-right: 14px !important;
    gap: 6px;
    white-space: nowrap;
}

.filter-btn.active {
    border-color: var(--clr-primary);
    background: var(--clr-primary-light);
    color: var(--clr-primary);
}

.filter-badge {
    background: var(--clr-primary);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 2px;
}

/* Active filter tags */
.active-filters {
    padding: 0 16px 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--clr-primary-light);
    color: var(--clr-primary);
    border-radius: 50px;
    font-size: .78rem;
    font-weight: 600;
}

.active-filter-tag button {
    background: none;
    border: none;
    color: var(--clr-primary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0 0 0 2px;
    line-height: 1;
}

/* Sheet overlay */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
}
.sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Filter sheet */
.filter-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 100%);
    width: 100%;
    background: var(--clr-card);
    border-radius: 16px 16px 0 0;
    z-index: 1000;
    transition: transform .3s cubic-bezier(.32,.72,0,1);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.filter-sheet.active {
    transform: translate(-50%, 0);
}

.filter-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--clr-border);
    border-radius: 4px;
    margin: 10px auto 0;
}

.filter-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 8px;
}

.filter-sheet-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.filter-sheet-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--clr-text-muted);
    cursor: pointer;
    padding: 4px 8px;
}

.filter-sheet-body {
    padding: 8px 20px 16px;
    overflow-y: auto;
    flex: 1;
}

.filter-group {
    margin-bottom: 16px;
}

.filter-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--clr-text);
}

.filter-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-family: var(--font);
    background: var(--clr-bg);
    color: var(--clr-text);
    box-sizing: border-box;
}

.filter-input:focus {
    border-color: var(--clr-primary);
    outline: none;
}

.filter-sheet-footer {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    padding-bottom: calc(12px + var(--safe-bottom, 0px));
    border-top: 1px solid var(--clr-border);
}

.filter-sheet-footer .btn {
    flex: 1;
}

/* ===========================
   SELLER PROFILE PAGE
   =========================== */
.seller-profile-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--clr-bg);
    font-size: 2.2rem;
    margin: 0 auto 8px;
    border: 3px solid white;
    box-shadow: 0 2px 12px rgba(0,0,0,.1);
}

/* ===========================
   REVIEW DISPLAY (seller profile)
   =========================== */
.rating-overview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 0;
}
.rating-big-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--clr-text);
}
.rating-count {
    font-weight: 400;
    color: var(--clr-text-muted);
    font-size: .85rem;
}
.review-card {
    background: white;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 10px;
    border: 1px solid var(--clr-border);
}
.review-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}
.review-card-info {
    display: flex;
    flex-direction: column;
}
.review-card-name {
    font-weight: 700;
    font-size: .92rem;
    color: var(--clr-text);
}
.review-card-date {
    font-size: .75rem;
    color: var(--clr-text-muted);
}
.review-card-stars {
    flex-shrink: 0;
}
.review-card-ad {
    font-size: .78rem;
    color: var(--clr-text-muted);
    margin-bottom: 6px;
    font-style: italic;
}
.review-card-comment {
    font-size: .88rem;
    color: var(--clr-text);
    line-height: 1.45;
    margin-bottom: 8px;
}
.review-card-details {
    display: flex;
    gap: 16px;
    font-size: .72rem;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: .3px;
    font-weight: 600;
}

/* Rating badge inline (ad-details seller card) */
.seller-rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: .78rem;
    color: #f59e0b;
    font-weight: 600;
    margin-top: 2px;
}
.seller-rating-badge .rating-num {
    color: var(--clr-text-muted);
    font-size: .73rem;
}

/* Clickable seller card in ad-details */
.detail-seller-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background .15s;
    border-radius: var(--radius-sm);
    padding: 10px;
    margin: -10px;
}
.detail-seller-link:hover {
    background: var(--clr-bg);
}
.detail-seller-link:active {
    background: var(--clr-border);
}

/* Chat header nav buttons */
.chat-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--clr-primary);
    background: var(--clr-primary-light);
    text-decoration: none;
    transition: background var(--transition);
    flex-shrink: 0;
}
.chat-nav-btn:hover {
    background: var(--clr-border);
}

/* ---------- Skeleton Loading ---------- */
@keyframes skeletonPulse {
    0% { opacity: .6; }
    50% { opacity: 1; }
    100% { opacity: .6; }
}
.skeleton {
    background: var(--clr-border);
    border-radius: var(--radius-sm);
    animation: skeletonPulse 1.4s ease-in-out infinite;
}
.skeleton-card {
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}
.skeleton-card-img {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--clr-border);
    animation: skeletonPulse 1.4s ease-in-out infinite;
}
.skeleton-card-info {
    padding: 10px;
}
.skeleton-line {
    height: 12px;
    background: var(--clr-border);
    border-radius: 6px;
    animation: skeletonPulse 1.4s ease-in-out infinite;
    margin-bottom: 8px;
}
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 65%; }
.skeleton-line.long { width: 90%; }

.skeleton-detail-img {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--clr-border);
    animation: skeletonPulse 1.4s ease-in-out infinite;
}
.skeleton-detail-body { padding: 16px; }
.skeleton-detail-price {
    height: 24px;
    width: 120px;
    background: var(--clr-border);
    border-radius: 6px;
    animation: skeletonPulse 1.4s ease-in-out infinite;
    margin-bottom: 12px;
}
.skeleton-detail-title {
    height: 18px;
    width: 80%;
    background: var(--clr-border);
    border-radius: 6px;
    animation: skeletonPulse 1.4s ease-in-out infinite;
    margin-bottom: 16px;
}

.skeleton-convo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--clr-border);
}
.skeleton-convo-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--clr-border);
    animation: skeletonPulse 1.4s ease-in-out infinite;
    flex-shrink: 0;
}
.skeleton-convo-lines { flex: 1; }
.detail-body { transition: opacity .25s ease; }

/* ---------- Toast Notifications ---------- */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: .88rem;
    font-weight: 500;
    max-width: calc(100% - 32px);
    width: max-content;
    box-shadow: 0 6px 24px rgba(0,0,0,.18);
    transition: opacity .3s ease, transform .3s ease;
    pointer-events: auto;
}
.toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast-icon {
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
}
.toast-msg {
    flex: 1;
    line-height: 1.35;
}
.toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0 0 8px;
    line-height: 1;
    opacity: .6;
}
.toast-close:hover { opacity: 1; }

.toast-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.toast-success .toast-icon { color: #059669; }
.toast-success .toast-close { color: #065f46; }

.toast-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.toast-error .toast-icon { color: #dc2626; }
.toast-error .toast-close { color: #991b1b; }

.toast-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}
.toast-warning .toast-icon { color: #d97706; }
.toast-warning .toast-close { color: #92400e; }

.toast-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
.toast-info .toast-icon { color: #2563eb; }
.toast-info .toast-close { color: #1e40af; }

/* ---------- Load More Button ---------- */
.load-more-btn {
    display: block;
    margin: 20px auto 80px;
    padding: 14px 36px;
    background: var(--clr-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: .92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s ease;
}
.load-more-btn:hover {
    background: var(--clr-primary-dark, #1b6b2a);
}
.load-more-btn:active {
    transform: scale(.97);
}

/* ---------- Image Drag Sort ---------- */
.img-sortable { transition: transform .15s ease, opacity .15s ease; }
.img-sortable.drag-over {
    outline: 2px solid var(--clr-primary);
    outline-offset: 2px;
    border-radius: var(--radius-md);
    transform: scale(1.05);
}

/* ===========================
   PUBLISH OVERLAY
   =========================== */
.publish-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}
.publish-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.publish-modal {
    background: var(--clr-surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 90%;
    max-width: 360px;
    text-align: center;
}
.publish-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}
.publish-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .92rem;
    color: var(--clr-text-muted);
    opacity: .4;
    transition: opacity .3s ease;
}
.publish-step.active {
    opacity: 1;
    color: var(--clr-text);
    font-weight: 600;
}
.publish-step.done {
    opacity: 1;
    color: var(--clr-primary);
}
.publish-step.done .spinner-small {
    animation: none;
    border: none;
    width: 20px;
    height: 20px;
}
.publish-step.done .spinner-small::after {
    content: '✓';
    font-size: 16px;
    font-weight: 700;
    color: var(--clr-primary);
}
.publish-step-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.spinner-small {
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--clr-border);
    border-top-color: var(--clr-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.publish-success {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: fadeInUp .4s ease;
}
.publish-success h3 {
    margin: 0;
    font-size: 1.15rem;
    color: var(--clr-text);
}
.publish-success p {
    margin: 0 0 12px;
    color: var(--clr-text-muted);
    font-size: .88rem;
}
.publish-checkmark {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--clr-primary-light);
    color: var(--clr-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
