/* ══════════════════════════════════════════
   GLOBAL THEME TOKENS
   Used across all Freeupper pages
══════════════════════════════════════════ */
:root {
    --p: #8b5cf6;
    --pd: #6c3fc5;
    --pl: #a78bfa;
    --pdim: rgba(139, 92, 246, .15);
    --pbrd: rgba(139, 92, 246, .28);
    --pglow: rgba(108, 63, 197, .45);
    --danger: #f87171;
    --warn: #fb923c;
    --ok: #4ade80;
    --blue: #60a5fa;
}

[data-theme="dark"] {
    --bg: #000;
    --bg2: #0a0a0a;
    --bg3: #111;
    --bg4: #1a1a1a;
    --bg5: #222;
    --brd: rgba(255, 255, 255, .07);
    --brd2: rgba(255, 255, 255, .12);
    --text: #fff;
    --muted: rgba(255, 255, 255, .4);
    --muted2: rgba(255, 255, 255, .22);
    --inp: rgba(255, 255, 255, .05);
    --rowh: rgba(255, 255, 255, .04);
    --navbg: rgba(0, 0, 0, .97);
    --sidebg: #0a0a0a;
    --dotbg: rgba(255, 255, 255, .07);
    --dotc: #fff;
    --cardsh: 0 2px 16px rgba(0, 0, 0, .5);
}

[data-theme="light"] {
    --bg: #ffffff;
    --bg2: #fff;
    --bg3: #fff;
    --bg4: #e8e8ed;
    --bg5: #d8d8de;
    --brd: rgba(0, 0, 0, .08);
    --brd2: rgba(0, 0, 0, .13);
    --text: #0d0d0d;
    --muted: rgba(0, 0, 0, .44);
    --muted2: rgba(0, 0, 0, .26);
    --inp: rgba(0, 0, 0, .05);
    --rowh: rgba(0, 0, 0, .04);
    --navbg: rgba(242, 242, 247, .97);
    --sidebg: #fff;
    --dotbg: rgba(0, 0, 0, .07);
    --dotc: #0d0d0d;
    --cardsh: 0 2px 16px rgba(0, 0, 0, .1);
}

/* ══════════════════════════════════════════
   GLOBAL BASE STYLES
══════════════════════════════════════════ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background .3s, color .3s;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 0;
}

/* Input/select styling */
input,
textarea,
select,
button {
    font-family: inherit;
}

/* Link styling */
a {
    color: var(--p);
    text-decoration: none;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Smooth transitions */
* {
    transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}

/* ══════════════════════════════════════════
   HASHTAG STYLES (clickable #tags)
══════════════════════════════════════════ */

/* ── Inline clickable hashtag (in post content, comments) ── */
.hashtag-link {
    color: var(--p);
    font-weight: 700;
    cursor: pointer;
    transition: color .15s, text-decoration .15s;
    display: inline;
    text-decoration: none;
}

.hashtag-link:hover {
    text-decoration: underline;
    color: var(--pl);
}

.hashtag-link:active {
    opacity: .7;
}

/* ── Hashtag in post content — keep inline with surrounding text ── */
.hashtag-inline {
    display: inline;
}

/* ── Hashtag pill/badge (used in tag lists, discovery, search results) ── */
.hashtag-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 100px;
    background: var(--pdim);
    border: 1px solid var(--pbrd);
    color: var(--pl);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, transform .12s, border-color .15s;
    white-space: nowrap;
    text-decoration: none;
}

.hashtag-pill:hover {
    background: rgba(139, 92, 246, .22);
    border-color: var(--p);
    transform: scale(1.04);
}

.hashtag-pill:active {
    transform: scale(.96);
}

/* ── Hashtag count badge (used in search discovery) ── */
.hashtag-count {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    margin-left: 4px;
}

/* ── Hashtag row (search results, discovery list) ── */
.hashtag-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 4px;
    border-bottom: 1px solid var(--brd);
    cursor: pointer;
    transition: background .12s;
    border-radius: 4px;
}

.hashtag-row:hover {
    background: var(--rowh);
}

.hashtag-row .tag-name {
    font-weight: 700;
    color: var(--text);
    font-size: 14px;
}

.hashtag-row .tag-count {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

/* ══════════════════════════════════════════
   VERIFICATION BADGE
   Unified purple badge – use via JS helper:
   getVerifiedBadgeHTML(verifiedStatus, size)
   NOTE: If a badge still looks big, check whether
   getVerifiedBadgeHTML sets inline width/height —
   inline styles will override these CSS rules.
══════════════════════════════════════════ */

/* ── Standard badge (default) ── */
.verified-badge {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--p), var(--pd));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 6px var(--pglow);
    margin-left: 2px;
    vertical-align: middle;
}

.verified-badge.hidden {
    display: none !important;
}

.verified-badge svg {
    width: 9px;
    height: 9px;
    stroke: #fff;
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Small badge (inline with usernames) ── */
.verified-badge-sm {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--p), var(--pd));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px var(--pglow);
    margin-left: 2px;
    vertical-align: middle;
}

.verified-badge-sm.hidden {
    display: none !important;
}

.verified-badge-sm svg {
    width: 7px;
    height: 7px;
    stroke: #fff;
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Large badge (profile page) ── */
.verified-badge-lg {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--p), var(--pd));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 12px var(--pglow);
    margin-left: 3px;
    vertical-align: middle;
}

.verified-badge-lg.hidden {
    display: none !important;
}

.verified-badge-lg svg {
    width: 10px;
    height: 10px;
    stroke: #fff;
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Wrapper for dynamic badge updates (JS uses data-author-badge-wrapper) ── */
[data-author-badge-wrapper] {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-left: 2px;
}

/* ══════════════════════════════════════════
   VERIFICATION BADGE - ANIMATION
══════════════════════════════════════════ */
.verified-badge,
.verified-badge-sm,
.verified-badge-lg {
    animation: badgePulse 3s ease-in-out infinite;
}

@keyframes badgePulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ══════════════════════════════════════════
   VERIFICATION STATUS CARD (for settings/profile)
══════════════════════════════════════════ */
.verification-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 6px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
}

.verification-status.verified {
    background: rgba(74, 222, 128, .12);
    border: 1px solid rgba(74, 222, 128, .3);
    color: var(--ok);
}

.verification-status.pending {
    background: rgba(251, 146, 60, .12);
    border: 1px solid rgba(251, 146, 60, .3);
    color: var(--warn);
}

.verification-status.unverified {
    background: var(--inp);
    border: 1px solid var(--brd);
    color: var(--muted);
}

.verification-status .badge-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.verification-status .badge-icon svg {
    width: 10px;
    height: 10px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.verification-status.verified .badge-icon {
    background: rgba(74, 222, 128, .2);
}

.verification-status.pending .badge-icon {
    background: rgba(251, 146, 60, .2);
}

.verification-status.unverified .badge-icon {
    background: var(--bg4);
}

/* ══════════════════════════════════════════
   MARKETPLACE – LISTING CARDS
══════════════════════════════════════════ */
.listing-card {
    background: var(--bg2);
    border: 1px solid var(--brd);
    border-radius: 16px;
    padding: 16px;
    transition: border-color .2s, box-shadow .2s, transform .15s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.listing-card:hover {
    border-color: var(--pbrd);
    box-shadow: var(--cardsh);
    transform: translateY(-2px);
}

.listing-card .cover-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 12px;
    background: var(--bg4);
}

.listing-card .title {
    font-weight: 700;
    font-size: 15px;
    margin: 10px 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.listing-card .price {
    font-weight: 800;
    font-size: 17px;
    color: var(--p);
    margin: 2px 0;
}

.listing-card .seller {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
}

.listing-card .seller .avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg4);
    flex-shrink: 0;
}

.listing-card .seller .name {
    font-weight: 600;
    color: var(--text);
}

.listing-card .meta {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--brd);
}

.listing-card .meta .status-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 100px;
    letter-spacing: .04em;
}

.listing-card .meta .status-badge.active {
    background: rgba(74, 222, 128, .12);
    color: var(--ok);
}

.listing-card .meta .status-badge.sold {
    background: rgba(251, 146, 60, .12);
    color: var(--warn);
}

.listing-card .meta .status-badge.archived {
    background: var(--inp);
    color: var(--muted);
}

.listing-card .meta .status-badge.deleted {
    background: rgba(248, 113, 113, .12);
    color: var(--danger);
}

/* ── Listing grid layout ── */
.listing-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 8px 0;
}

@media (min-width: 480px) {
    .listing-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 768px) {
    .listing-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* ══════════════════════════════════════════
   FAVORITE (HEART) BUTTON
══════════════════════════════════════════ */
.fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, transform .1s;
    color: var(--muted);
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, .4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.fav-btn:hover {
    background: rgba(139, 92, 246, .25);
    transform: scale(1.1);
}

.fav-btn.saved {
    color: #f87171;
}

.fav-btn.saved svg {
    fill: #f87171;
}

.fav-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: fill .15s;
}

/* ══════════════════════════════════════════
   SKELETON LOADING SHIMMER
══════════════════════════════════════════ */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: var(--bg4);
    background: linear-gradient(90deg, var(--bg4) 25%, var(--bg5) 50%, var(--bg4) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 14px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.skeleton-text.w-75 {
    width: 75%;
}
.skeleton-text.w-50 {
    width: 50%;
}
.skeleton-text.w-25 {
    width: 25%;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
}

.skeleton-card {
    background: var(--bg2);
    border: 1px solid var(--brd);
    border-radius: 16px;
    padding: 16px;
}

/* ══════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    stroke: var(--muted2);
    fill: none;
    stroke-width: 1.5;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 14px;
    color: var(--muted);
    max-width: 320px;
    margin: 0 auto;
}

/* ══════════════════════════════════════════
   CATEGORY FILTER (marketplace)
══════════════════════════════════════════ */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
}

.category-filter select,
.category-filter input {
    flex: 1 1 160px;
    min-width: 120px;
}

.category-filter .search-input {
    flex: 2 1 200px;
}

.category-filter .filter-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    display: block;
    margin-bottom: 2px;
}

.category-filter .filter-group {
    flex: 1 1 160px;
}

/* ══════════════════════════════════════════
   STATUS INDICATORS (for listings)
══════════════════════════════════════════ */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px 3px 6px;
    border-radius: 100px;
}

.status-indicator .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-indicator.active .dot {
    background: var(--ok);
}
.status-indicator.active {
    color: var(--ok);
}

.status-indicator.sold .dot {
    background: var(--warn);
}
.status-indicator.sold {
    color: var(--warn);
}

.status-indicator.archived .dot {
    background: var(--muted);
}
.status-indicator.archived {
    color: var(--muted);
}

/* ══════════════════════════════════════════
   UTILITY CLASSES
══════════════════════════════════════════ */
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

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

.text-sm {
    font-size: 13px;
}

.text-xs {
    font-size: 11px;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.gap-1 {
    gap: 4px;
}
.gap-2 {
    gap: 8px;
}
.gap-3 {
    gap: 12px;
}
.gap-4 {
    gap: 16px;
}

.flex {
    display: flex;
}
.flex-col {
    flex-direction: column;
}
.items-center {
    align-items: center;
}
.justify-between {
    justify-content: space-between;
}
.flex-wrap {
    flex-wrap: wrap;
}

.mt-1 {
    margin-top: 4px;
}
.mt-2 {
    margin-top: 8px;
}
.mt-3 {
    margin-top: 12px;
}
.mt-4 {
    margin-top: 16px;
}
.mb-1 {
    margin-bottom: 4px;
}
.mb-2 {
    margin-bottom: 8px;
}
.mb-3 {
    margin-bottom: 12px;
}
.mb-4 {
    margin-bottom: 16px;
}

.w-full {
    width: 100%;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.rounded-full {
    border-radius: 9999px;
}

/* ── Scrollable horizontal container ── */
.scroll-x {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 0 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.scroll-x::-webkit-scrollbar {
    display: none;
}

.scroll-x>* {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
══════════════════════════════════════════ */
@media (max-width: 480px) {
    .listing-card .price {
        font-size: 15px;
    }
    .listing-card .title {
        font-size: 14px;
    }
}

@media (min-width: 768px) {
    .listing-grid {
        gap: 20px;
    }
}

/* ══════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn .3s ease both;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp .4s ease both;
}
