/* 1. VARIABLES & THEMES */
:root[data-theme="light"] {
    --bg: #ffffff; --text: #1a1a1a; --accent: #2563eb; --card-bg: #f4f4f5; --border: #e4e4e7;
}
:root[data-theme="dark"] {
    --bg: #09090b; --text: #fafafa; --accent: #3b82f6; --card-bg: #18181b; --border: #27272a;
}

/* 2. CORE LAYOUT */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; font-size: 14px; transition: background 0.3s ease; }

header { border-bottom: 1px solid var(--border); padding: 0.75rem 1rem; position: sticky; top: 0; background: var(--bg); z-index: 100; }
nav { display: flex; justify-content: space-between; align-items: center; max-width: 900px; margin: 0 auto; }

.nav-links { display: flex; gap: 15px; align-items: center; }
.nav-links a { text-decoration: none; color: var(--text); font-size: 0.85rem; opacity: 0.8; transition: 0.2s; }
.nav-links a.active { opacity: 1; font-weight: bold; color: var(--accent); border-bottom: 2px solid var(--accent); }
.logo { font-weight: bold; font-size: 1.1rem !important; opacity: 1 !important; text-decoration: none; color: var(--text); }
.logo span { color: var(--accent); }

.nav-right { display: flex; align-items: center; gap: 12px; }

/* 3. CLOCK & PULSE */
.clock-widget { display: flex; flex-direction: column; align-items: flex-end; font-family: monospace; }
.clock-header { display: flex; align-items: center; gap: 5px; }
.pulse { width: 6px; height: 6px; background: #10b981; border-radius: 50%; animation: pulse-animation 2s infinite; }
@keyframes pulse-animation { 
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); } 
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); } 
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } 
}
.clock-label { font-size: 0.6rem; color: var(--accent); font-weight: bold; }
#clockTime { font-size: 0.85rem; opacity: 0.9; }

/* 4. SEARCH & THEME TOGGLE */
#searchInput { background: var(--card-bg); border: 1px solid var(--border); color: var(--text); padding: 6px 12px; border-radius: 20px; font-size: 0.8rem; outline: none; width: 140px; transition: 0.3s; }
#searchInput:focus { width: 180px; border-color: var(--accent); box-shadow: 0 0 8px rgba(37, 99, 235, 0.2); }
#themeToggle { background: none; border: none; cursor: pointer; color: var(--text); padding: 5px; display: flex; align-items: center; }

/* 5. CONTENT & POST CARDS */
main, .content-wrapper { max-width: 800px; margin: 2rem auto; padding: 0 1rem; min-height: 70vh; }
.post-card { border-bottom: 1px solid var(--border); padding: 1.5rem 0; }
.post-card h2 a { text-decoration: none; color: inherit; font-size: 1.4rem; transition: color 0.2s; }
.post-card h2 a:hover { color: var(--accent); }
.post-meta { font-size: 0.75rem; color: #71717a; margin: 5px 0; display: flex; align-items: center; gap: 8px; }
.category { color: var(--accent); font-weight: bold; text-transform: uppercase; font-size: 0.7rem; }
.post-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(37, 99, 235, 0.2); /* Very faint underline */
    transition: all 0.2s ease;
}

.post-content a:hover {
    border-bottom-color: var(--accent);
    background: rgba(37, 99, 235, 0.05); /* Extremely subtle highlight */
}

/* 6. SHARE & POST FOOTER */
.share-button { display: inline-flex; align-items: center; gap: 8px; background: var(--card-bg); border: 1px solid var(--border); color: var(--text); padding: 6px 12px; border-radius: 6px; font-size: 0.8rem; cursor: pointer; margin-top: 20px; transition: all 0.2s ease; }
.share-button:hover { background: var(--accent); color: white; border-color: var(--accent); }
.post-footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px dashed var(--border); font-family: monospace; font-size: 0.7rem; color: #71717a; display: flex; justify-content: space-between; }

/* 7. NEWS TICKER */
.news-ticker { display: flex; align-items: center; background: var(--card-bg); border: 1px solid var(--border); border-radius: 4px; margin: 1rem auto; max-width: 900px; overflow: hidden; height: 34px; }
.ticker-label { background: var(--accent); color: white; padding: 0 15px; font-weight: bold; font-size: 0.7rem; height: 100%; display: flex; align-items: center; z-index: 2; white-space: nowrap; }
.ticker-wrapper { overflow: hidden; flex-grow: 1; position: relative; }
.ticker-content { display: flex; white-space: nowrap; gap: 50px; padding: 5px 0; width: max-content; }
.ticker-item { font-size: 0.85rem; color: var(--text); }
.ticker-item a { color: var(--accent); text-decoration: none; font-weight: 500; }

/* 8. FOOTER */
footer { margin-top: 5rem; padding: 3rem 1rem; border-top: 1px solid var(--border); background: var(--bg); }
.footer-content { max-width: 900px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; color: #71717a; font-size: 0.8rem; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { text-decoration: none; color: var(--text); opacity: 0.6; transition: 0.2s; }
.footer-links a:hover { opacity: 1; color: var(--accent); }

/* 9. RESPONSIVE DESIGN */
@media (max-width: 600px) { 
    .clock-widget { display: none; } 
    #searchInput { width: 100px; } 
    .nav-links { gap: 10px; }
    .logo { font-size: 0.9rem !important; }
    .footer-content { flex-direction: column; gap: 1.5rem; text-align: center; }
}

/* 10. Referral Box Styling */
.referral-box {
    background: var(--card-bg);
    border: 1px solid var(--accent);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
    text-align: center; /* This keeps the box content centered */
}

.qr-container {
    margin: 15px 0;
}

.qr-code {
    width: 150px;       /* Fixed size so it's not overwhelming */
    height: 150px;
    border-radius: 4px;
    border: 5px solid white; /* Classic QR frame look */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.promo-code {
    display: inline-block;
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 8px 20px;
    background: var(--bg);
    border: 1px dashed var(--accent);
    margin: 10px 0;
    letter-spacing: 2px;
}

.promo-code:hover {
    background: var(--card-bg);
    border-style: solid; /* Changes from dashed to solid on hover */
    color: var(--accent);
}

/* --- 11. RELATED POSTS --- */
.related-posts {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.related-title {
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: #71717a;
    margin-bottom: 1.5rem;
}

.related-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.related-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: 0.2s ease;
}

.related-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.related-card h4 {
    margin-top: 8px;
    font-size: 1rem;
}

@media (max-width: 600px) {
    .related-grid { grid-template-columns: 1fr; }
}

.category.community { color: #8b5cf6; } /* A vibrant purple for social/community */
