/* =====================================================
   AffOneWorld - Premium Mobile-First Magazine CSS
   Aesthetic: Bold Editorial / Dark Luxury
   ===================================================== */

/* ---------- CSS Variables ---------- */
:root {
    --brand-primary:   #7c3aed;
    --brand-secondary: #a855f7;
    --brand-accent:    #f59e0b;
    --brand-cta:       #10b981;

    --bg-page:    #f8f7ff;
    --bg-surface: #ffffff;
    --bg-raised:  #f1f0fa;
    --bg-input:   #f4f3fe;

    --text-primary:   #0f0a1e;
    --text-secondary: #4b4576;
    --text-muted:     #9590b0;
    --text-inverse:   #ffffff;

    --border:       rgba(124,58,237,0.12);
    --border-strong: rgba(124,58,237,0.28);

    --shadow-sm:  0 1px 4px rgba(15,10,30,0.08);
    --shadow-md:  0 4px 16px rgba(15,10,30,0.10);
    --shadow-lg:  0 8px 32px rgba(15,10,30,0.14);
    --shadow-xl:  0 16px 48px rgba(15,10,30,0.16);

    --radius-sm:  8px;
    --radius-md:  14px;
    --radius-lg:  20px;
    --radius-xl:  28px;
    --radius-full: 9999px;

    --font-display: 'Syne', sans-serif;
    --font-body:    'Inter', sans-serif;

    --nav-height:    60px;
    --bottom-nav-h:  64px;
    --transition:    0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Category colors */
    --cat-tech:       #6366f1;
    --cat-finance:    #10b981;
    --cat-crypto:     #f59e0b;
    --cat-make-money: #ef4444;
    --cat-reviews:    #8b5cf6;
    --cat-tutorials:  #06b6d4;
}

[data-theme="dark"] {
    --bg-page:    #0a0717;
    --bg-surface: #120e22;
    --bg-raised:  #1a1430;
    --bg-input:   #1e1838;

    --text-primary:   #f0eeff;
    --text-secondary: #b8b0d8;
    --text-muted:     #6b6488;

    --border:       rgba(168,85,247,0.12);
    --border-strong: rgba(168,85,247,0.28);

    --shadow-sm:  0 1px 4px rgba(0,0,0,0.3);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
    --shadow-xl:  0 16px 48px rgba(0,0,0,0.6);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    padding-top: var(--nav-height);
    padding-bottom: calc(var(--bottom-nav-h) + 16px);
    min-height: 100vh;
    transition: background var(--transition-slow), color var(--transition-slow);
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
ul, ol { list-style: none; }
input, textarea, select { font: inherit; }

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-primary);
}

h1 { font-size: clamp(1.6rem, 6vw, 2.4rem); }
h2 { font-size: clamp(1.25rem, 4.5vw, 1.8rem); }
h3 { font-size: clamp(1rem, 4vw, 1.4rem); }
h4 { font-size: 1rem; }

p { color: var(--text-secondary); margin-bottom: 1em; }

/* ---------- Top Navigation ---------- */
.top-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    z-index: 900;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: box-shadow var(--transition);
}

.top-nav.scrolled { box-shadow: var(--shadow-md); }

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 16px;
    max-width: 600px;
    margin: 0 auto;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.logo-icon {
    width: 32px; height: 32px;
    background: var(--brand-primary);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: white;
}
.logo-icon svg { width: 16px; height: 16px; }

.logo-accent { color: var(--brand-accent); }

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

.nav-btn {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
}
.nav-btn:active { background: var(--bg-raised); }
.nav-btn svg { width: 20px; height: 20px; }

.nav-avatar {
    width: 34px; height: 34px;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    overflow: hidden;
    border: 2px solid var(--brand-secondary);
}
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }

.btn-nav-login {
    padding: 6px 14px;
    background: var(--brand-primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-display);
    transition: opacity var(--transition);
}
.btn-nav-login:active { opacity: 0.85; }

/* ---------- Search Bar ---------- */
.search-bar {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    z-index: 899;
    animation: slideDown 0.2s ease;
}
.search-bar.active { display: block; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    padding: 0 16px;
    border: 1.5px solid var(--border);
    transition: border-color var(--transition);
}
.search-input-wrap:focus-within { border-color: var(--brand-primary); }
.search-input-wrap svg { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }

.search-input-wrap input {
    flex: 1;
    border: none;
    background: none;
    padding: 11px 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}
.search-input-wrap input::placeholder { color: var(--text-muted); }

#searchClose {
    color: var(--text-muted);
    padding: 4px;
}

.search-results {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-md);
    background: var(--bg-raised);
    transition: background var(--transition);
}
.search-result-item:active { background: var(--bg-input); }
.search-result-item img {
    width: 46px; height: 38px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}
.search-result-item .result-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.search-result-item .result-cat {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ---------- Main Content ---------- */
.main-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---------- Section Headers ---------- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 24px 0 14px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title svg { width: 18px; height: 18px; color: var(--brand-primary); }

.section-link {
    font-size: 0.8rem;
    color: var(--brand-primary);
    font-weight: 600;
    font-family: var(--font-display);
}

/* ---------- Hero / Featured Post ---------- */
.hero-card {
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
    aspect-ratio: 16/9;
    margin: 16px 0;
    box-shadow: var(--shadow-lg);
}

.hero-card img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.hero-card:active img { transform: scale(1.02); }

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--brand-accent);
    color: #0f0a1e;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-display);
    margin-bottom: 8px;
    width: fit-content;
}
.hero-badge svg { width: 12px; height: 12px; }

.hero-title {
    font-size: clamp(1rem, 4.5vw, 1.4rem);
    color: white;
    line-height: 1.3;
    margin-bottom: 10px;
    font-family: var(--font-display);
    font-weight: 800;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.75);
    font-size: 0.75rem;
}
.hero-meta span { display: flex; align-items: center; gap: 4px; }
.hero-meta svg { width: 12px; height: 12px; }

/* ---------- Article Cards ---------- */
.articles-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.article-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: box-shadow var(--transition), transform var(--transition);
    display: block;
}

.article-card:active {
    transform: scale(0.985);
    box-shadow: var(--shadow-md);
}

.card-horizontal {
    display: flex;
    gap: 0;
}

.card-image {
    position: relative;
    flex-shrink: 0;
    width: 120px;
    height: 110px;
    overflow: hidden;
}
.card-image img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
    background: var(--bg-raised);
}
.card-image img[data-src] { opacity: 0; transition: opacity 0.3s ease; }
.card-image img.loaded { opacity: 1; }

.card-image-full {
    position: relative;
    width: 100%;
    aspect-ratio: 16/8;
    overflow: hidden;
}
.card-image-full img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.card-badge {
    position: absolute;
    top: 8px; left: 8px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font-display);
    color: white;
    backdrop-filter: blur(10px);
}

.card-body {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.card-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-display);
    line-height: 1.35;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.card-title-lg {
    font-size: 1.1rem;
    -webkit-line-clamp: 3;
    margin-bottom: 8px;
}

.card-excerpt {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
    line-height: 1.5;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.card-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}
.card-meta svg { width: 11px; height: 11px; }

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
}

.btn-read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--brand-primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-display);
    transition: opacity var(--transition);
}
.btn-read-more svg { width: 13px; height: 13px; }
.btn-read-more:active { opacity: 0.85; }

.card-actions-sm {
    display: flex;
    align-items: center;
    gap: 4px;
}
.card-action-btn {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: background var(--transition), color var(--transition);
}
.card-action-btn.liked, .card-action-btn.bookmarked { color: var(--brand-primary); }
.card-action-btn svg { width: 16px; height: 16px; }

/* ---------- Trending Scroll ---------- */
.trending-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 0 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.trending-scroll::-webkit-scrollbar { display: none; }

.trending-card {
    flex-shrink: 0;
    width: 160px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: block;
    transition: transform var(--transition);
}
.trending-card:active { transform: scale(0.96); }

.trending-card-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    background: var(--bg-raised);
}

.trending-card-body { padding: 10px; }
.trending-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-display);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    color: var(--text-primary);
    margin-bottom: 5px;
}
.trending-rank {
    font-family: var(--font-display);
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ---------- Category Grid ---------- */
.categories-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.category-card {
    border-radius: var(--radius-lg);
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}
.category-card::before {
    content: '';
    position: absolute;
    right: -10px; top: -10px;
    width: 70px; height: 70px;
    border-radius: 50%;
    opacity: 0.08;
    background: var(--cat-color, var(--brand-primary));
}
.category-card:active { transform: scale(0.97); }

.category-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: white;
}
.category-icon svg { width: 20px; height: 20px; }

.category-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.category-count {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ---------- Affiliate CTA Buttons ---------- */
.affiliate-section {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.affiliate-card {
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: var(--shadow-sm);
}

.affiliate-info { flex: 1; min-width: 0; }
.affiliate-platform {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}
.affiliate-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-affiliate {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
    font-family: var(--font-display);
    transition: opacity var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-affiliate svg { width: 13px; height: 13px; }
.btn-affiliate:active { opacity: 0.8; }

.btn-buy-now    { background: var(--brand-cta); color: white; }
.btn-get-offer  { background: var(--brand-primary); color: white; }
.btn-visit-site { background: var(--bg-raised); color: var(--text-primary); border: 1.5px solid var(--border-strong); }
.btn-learn-more { background: var(--brand-accent); color: #0f0a1e; }

/* ---------- Article Detail ---------- */
.article-hero {
    margin: 0 -16px;
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}
.article-hero img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.article-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg-page) 0%, transparent 50%);
}

.article-header {
    padding: 16px 0;
}

.article-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-display);
    color: white;
    margin-bottom: 10px;
}

.article-title {
    font-size: clamp(1.3rem, 5vw, 1.8rem);
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.article-byline {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.author-avatar {
    width: 38px; height: 38px;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.8rem;
    overflow: hidden;
    flex-shrink: 0;
}
.author-avatar img { width: 100%; height: 100%; object-fit: cover; }

.author-info { flex: 1; }
.author-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}
.article-date-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.reading-time-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--bg-raised);
    border-radius: var(--radius-full);
    font-size: 0.68rem;
    color: var(--text-muted);
}
.reading-time-badge svg { width: 10px; height: 10px; }

/* Article Body Content */
.article-content {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-secondary);
}
.article-content h2 {
    font-size: 1.2rem;
    margin: 24px 0 10px;
    color: var(--text-primary);
    padding-left: 12px;
    border-left: 3px solid var(--brand-primary);
}
.article-content h3 {
    font-size: 1rem;
    margin: 18px 0 8px;
    color: var(--text-primary);
}
.article-content p { margin-bottom: 14px; }
.article-content ul, .article-content ol {
    padding-left: 20px;
    margin-bottom: 14px;
    list-style: disc;
}
.article-content ol { list-style: decimal; }
.article-content li { margin-bottom: 6px; }
.article-content a { color: var(--brand-primary); text-decoration: underline; }
.article-content strong { color: var(--text-primary); font-weight: 700; }
.article-content blockquote {
    border-left: 4px solid var(--brand-primary);
    padding: 12px 16px;
    background: var(--bg-raised);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 16px 0;
    font-style: italic;
}

/* In-Article Ad */
.ad-in-article {
    margin: 24px 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Engagement Bar */
.engagement-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin: 24px 0;
}

.engage-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-display);
    transition: background var(--transition), color var(--transition);
}
.engage-btn svg { width: 20px; height: 20px; }
.engage-btn.active { color: var(--brand-primary); }
.engage-btn:active { background: var(--bg-raised); }

.share-buttons {
    display: flex;
    gap: 8px;
    margin: 16px 0;
}
.share-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border-radius: var(--radius-md);
    font-size: 0.78rem;
    font-weight: 600;
    color: white;
    transition: opacity var(--transition);
}
.share-btn:active { opacity: 0.8; }
.share-btn svg { width: 16px; height: 16px; }
.share-whatsapp  { background: #25D366; }
.share-telegram  { background: #229ED9; }
.share-facebook  { background: #1877F2; }

/* ---------- Comments ---------- */
.comments-section { margin: 24px 0; }
.comment-input-wrap {
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    margin-bottom: 16px;
}
.comment-input-wrap textarea {
    width: 100%;
    border: none;
    background: none;
    resize: none;
    min-height: 80px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}
.comment-input-wrap textarea::placeholder { color: var(--text-muted); }
.comment-submit {
    width: 100%;
    padding: 10px;
    background: var(--brand-primary);
    color: white;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.88rem;
    margin-top: 10px;
    transition: opacity var(--transition);
}
.comment-submit:active { opacity: 0.85; }

.comment-item {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}
.comment-avatar {
    width: 34px; height: 34px;
    border-radius: var(--radius-full);
    background: var(--bg-raised);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--brand-primary);
    border: 1.5px solid var(--border);
}
.comment-body {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}
.comment-author { font-size: 0.8rem; font-weight: 700; color: var(--text-primary); }
.comment-date   { font-size: 0.68rem; color: var(--text-muted); margin-bottom: 5px; }
.comment-text   { font-size: 0.85rem; color: var(--text-secondary); }

/* ---------- Auth Forms ---------- */
.auth-page {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}
.auth-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 28px 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    width: 100%;
}
.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}
.auth-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 4px;
    text-align: center;
}
.auth-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 24px;
}

.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-family: var(--font-display);
}
.form-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.92rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}
.form-input.error { border-color: #ef4444; }
.form-error {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.input-icon-wrap {
    position: relative;
}
.input-icon-wrap svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}
.input-icon-wrap .form-input { padding-left: 40px; }

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--brand-primary);
    color: white;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    transition: opacity var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary:active { opacity: 0.85; }
.btn-primary svg { width: 18px; height: 18px; }

.auth-link {
    text-align: center;
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.auth-link a { color: var(--brand-primary); font-weight: 600; }

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; }
.alert-error   { background: rgba(239,68,68,0.1);  color: #dc2626; border: 1px solid rgba(239,68,68,0.2); }
.alert-success { background: rgba(16,185,129,0.1); color: #059669; border: 1px solid rgba(16,185,129,0.2); }
.alert-info    { background: rgba(124,58,237,0.08); color: var(--brand-primary); border: 1px solid var(--border); }

/* ---------- Profile / Dashboard ---------- */
.profile-header {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    margin: 0 -16px;
    padding: 28px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: white;
}

.profile-avatar-lg {
    width: 64px; height: 64px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.4rem;
    color: white;
    border: 3px solid rgba(255,255,255,0.5);
    overflow: hidden;
}
.profile-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }

.profile-name { font-family: var(--font-display); font-size: 1.2rem; font-weight: 800; }
.profile-email { font-size: 0.8rem; opacity: 0.85; }
.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 2px 8px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-full);
    font-size: 0.68rem;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.stat-number {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--brand-primary);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.menu-list {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}
.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    color: var(--text-primary);
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: var(--bg-raised); }

.menu-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.menu-item-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    background: var(--bg-raised);
    display: flex; align-items: center; justify-content: center;
    color: var(--brand-primary);
}
.menu-item-icon svg { width: 17px; height: 17px; }
.menu-item-label { font-size: 0.9rem; font-weight: 500; }
.menu-item-sub { font-size: 0.72rem; color: var(--text-muted); }
.menu-item-arrow { color: var(--text-muted); }
.menu-item-arrow svg { width: 16px; height: 16px; }

/* ---------- Bottom Navigation ---------- */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    z-index: 900;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}

.bnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    font-family: var(--font-display);
    transition: color var(--transition);
    position: relative;
}
.bnav-item svg { width: 22px; height: 22px; transition: transform var(--transition); }
.bnav-item.active { color: var(--brand-primary); }
.bnav-item.active svg { transform: scale(1.15); }
.bnav-item.active::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 28px; height: 3px;
    background: var(--brand-primary);
    border-radius: 0 0 4px 4px;
}

/* ---------- AI Chat Widget ---------- */
.ai-chat-widget {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + 16px);
    right: 16px;
    z-index: 800;
}

.chat-toggle {
    width: 52px; height: 52px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    display: flex; align-items: center; justify-content: center;
    color: white;
    box-shadow: var(--shadow-lg), 0 0 0 0 rgba(124,58,237,0.4);
    animation: pulse-ring 2s infinite;
    cursor: pointer;
    transition: transform var(--transition);
}
.chat-toggle:active { transform: scale(0.92); }
.chat-toggle svg { width: 24px; height: 24px; }

@keyframes pulse-ring {
    0%   { box-shadow: var(--shadow-lg), 0 0 0 0 rgba(124,58,237,0.4); }
    70%  { box-shadow: var(--shadow-lg), 0 0 0 12px rgba(124,58,237,0); }
    100% { box-shadow: var(--shadow-lg), 0 0 0 0 rgba(124,58,237,0); }
}

.chat-panel {
    display: none;
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 300px;
    max-height: 440px;
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    flex-direction: column;
    overflow: hidden;
    animation: chatOpen 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chat-panel.open { display: flex; }

@keyframes chatOpen {
    from { opacity: 0; transform: scale(0.85) translateY(20px); transform-origin: bottom right; }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white;
}
.chat-ai-info { display: flex; align-items: center; gap: 10px; }
.chat-ai-avatar {
    width: 34px; height: 34px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
}
.chat-ai-avatar svg { width: 16px; height: 16px; }
.chat-ai-info strong { font-size: 0.85rem; display: block; }
.chat-status {
    font-size: 0.65rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}
.chat-status::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}
.chat-close { color: white; padding: 4px; }
.chat-close svg { width: 18px; height: 18px; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
    max-height: 280px;
}

.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-bubble {
    max-width: 82%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 0.82rem;
    line-height: 1.5;
}
.chat-msg.bot .chat-bubble {
    background: var(--bg-raised);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}
.chat-msg.user .chat-bubble {
    background: var(--brand-primary);
    color: white;
    border-bottom-right-radius: 4px;
}
.chat-bubble.typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px;
}
.typing-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typing-bounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-6px); }
}

.chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
}
.chat-input-area input {
    flex: 1;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    padding: 9px 14px;
    font-size: 0.85rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition);
}
.chat-input-area input:focus { border-color: var(--brand-primary); }
#chatSend {
    width: 36px; height: 36px;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    color: white;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: opacity var(--transition);
}
#chatSend:active { opacity: 0.8; }
#chatSend svg { width: 16px; height: 16px; }

/* ---------- Toast Notifications ---------- */
.toast-container {
    position: fixed;
    top: calc(var(--nav-height) + 16px);
    right: 16px;
    left: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: all;
    max-width: 360px;
    margin: 0 auto;
    width: 100%;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast-icon { flex-shrink: 0; }
.toast-icon svg { width: 18px; height: 18px; }
.toast-msg { font-size: 0.85rem; flex: 1; }
.toast-success .toast-icon { color: #10b981; }
.toast-error   .toast-icon { color: #ef4444; }
.toast-info    .toast-icon { color: var(--brand-primary); }
.toast.fadeout { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut {
    to { opacity: 0; transform: translateY(-10px); }
}

/* ---------- Popup Ad ---------- */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: flex-end;
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.popup-box {
    background: var(--bg-surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 24px 20px;
    width: 100%;
    position: relative;
    animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
.popup-close {
    position: absolute;
    top: 12px; right: 12px;
    width: 30px; height: 30px;
    border-radius: var(--radius-full);
    background: var(--bg-raised);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
}
.popup-close svg { width: 16px; height: 16px; }

/* ---------- Ad Wrappers ---------- */
.ad-wrapper {
    margin: 10px 0;
    padding: 4px 16px;
    position: relative;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.ad-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: right;
    padding-bottom: 2px;
}

/* ---------- Skeleton Loading ---------- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-raised) 25%, var(--border) 50%, var(--bg-raised) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-card {
    height: 110px;
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state svg {
    width: 48px; height: 48px;
    margin: 0 auto 12px;
    opacity: 0.5;
}
.empty-state h3 { font-size: 1rem; margin-bottom: 6px; color: var(--text-secondary); }
.empty-state p  { font-size: 0.85rem; }

/* ---------- Loading Spinner ---------- */
.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 24px;
}
.spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Recommendations ---------- */
.recommendations-section { margin: 24px 0; }
.rec-cards {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.rec-cards::-webkit-scrollbar { display: none; }
.rec-card {
    flex-shrink: 0;
    width: 200px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    display: block;
    transition: transform var(--transition);
}
.rec-card:active { transform: scale(0.97); }
.rec-card-img {
    width: 100%; height: 110px;
    object-fit: cover;
    background: var(--bg-raised);
}
.rec-card-body { padding: 10px; }
.rec-card-title {
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--font-display);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Tags ---------- */
.tags-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 0;
}
.tag {
    padding: 4px 10px;
    background: var(--bg-raised);
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: background var(--transition);
}
.tag:active { background: var(--border); }

/* ---------- Newsletter ---------- */
.footer-newsletter { margin: 16px 0; }
.footer-newsletter h4 {
    font-family: var(--font-display);
    font-size: 0.9rem;
    margin-bottom: 10px;
}
.newsletter-form {
    display: flex;
    gap: 8px;
}
.newsletter-form input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}
.newsletter-form button {
    padding: 10px 16px;
    background: var(--brand-primary);
    color: white;
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 700;
}
.newsletter-msg { font-size: 0.78rem; color: var(--brand-cta); margin-top: 6px; }

/* ---------- Site Footer ---------- */
.site-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 24px 16px;
    margin: 24px -16px 0;
}
.footer-inner { max-width: 600px; margin: 0 auto; }
.footer-brand { margin-bottom: 16px; }
.footer-brand .logo-text { font-family: var(--font-display); font-size: 1.1rem; font-weight: 800; }
.footer-brand p { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }
.footer-links { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.footer-col h5 { font-family: var(--font-display); font-size: 0.82rem; font-weight: 800; margin-bottom: 10px; color: var(--text-primary); }
.footer-col ul li { margin-bottom: 6px; }
.footer-col ul li a { font-size: 0.8rem; color: var(--text-muted); transition: color var(--transition); }
.footer-col ul li a:active { color: var(--brand-primary); }
.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.footer-bottom p { font-size: 0.75rem; color: var(--text-muted); }
.footer-social { display: flex; gap: 10px; }
.footer-social a {
    width: 32px; height: 32px;
    border-radius: var(--radius-md);
    background: var(--bg-raised);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
}
.footer-social a svg { width: 15px; height: 15px; }

/* ---------- Utility Classes ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.d-none { display: none !important; }
.w-full { width: 100%; }

/* ---------- Page Transitions ---------- */
.page-enter {
    animation: pageIn 0.3s ease;
}
@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Referral Badge ---------- */
.referral-badge {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border-radius: var(--radius-lg);
    padding: 16px;
    color: white;
    margin: 16px 0;
}
.referral-code {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-align: center;
    padding: 10px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
    margin: 10px 0;
    cursor: pointer;
    user-select: all;
}

/* ---------- Scroll to top ---------- */
.scroll-top {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + 72px);
    right: 16px;
    width: 38px; height: 38px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--transition), transform var(--transition);
    pointer-events: none;
    z-index: 700;
}
.scroll-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}
.scroll-top svg { width: 18px; height: 18px; }

/* ---------- "You may also like" ---------- */
.also-like-section { margin: 28px 0; }
.also-like-label {
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* ---------- Infinite Scroll Sentinel ---------- */
#infiniteScrollSentinel {
    height: 1px;
    margin-top: -1px;
}
