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

:root, [data-theme="light"] {
    --primary: #6C5CE7;
    --primary-dark: #5A4BD1;
    --primary-light: #A29BFE;
    --success: #00B894;
    --danger: #E17055;
    --warning: #FDCB6E;
    --bg: #F8F9FA;
    --bg-card: #FFFFFF;
    --text: #2D3436;
    --text-muted: #636E72;
    --border: #DFE6E9;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --max-width: 680px;
}

[data-theme="dark"] {
    --primary: #A29BFE;
    --primary-dark: #6C5CE7;
    --primary-light: #6C5CE7;
    --success: #55EFC4;
    --danger: #FF7675;
    --warning: #FFEAA7;
    --bg: #1A1A2E;
    --bg-card: #16213E;
    --text: #E0E0E0;
    --text-muted: #A0A0B0;
    --border: #2A2A4A;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
}

html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Layout === */
.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 16px; }
main.container { flex: 1; padding-top: 24px; padding-bottom: 40px; }

/* === Navbar === */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-container { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.nav-brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand-tld { font-weight: 400; opacity: 0.6; }
.nav-right { display: flex; align-items: center; gap: 4px; }
.nav-link {
    display: none;
    padding: 6px 12px;
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    border-radius: var(--radius-sm);
}
.nav-link:hover { background: var(--bg); text-decoration: none; }
@media (min-width: 600px) {
    .nav-link { display: block; }
}

/* Hamburger button */
.menu-btn {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}
.menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: transform 0.2s;
}

/* Overlay */
.menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
}
.menu-overlay.open { display: block; }

/* Slide-out drawer */
.menu-drawer {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    max-width: 80vw;
    height: 100%;
    background: var(--bg-card);
    z-index: 300;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transition: right 0.25s ease;
}
.menu-drawer.open { right: 0; }

.menu-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.menu-drawer-title { font-weight: 700; font-size: 1.1rem; }
.menu-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    line-height: 1;
}

.menu-drawer-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    overflow-y: auto;
}
.menu-drawer-links a {
    display: block;
    padding: 14px 20px;
    color: var(--text);
    font-weight: 500;
    font-size: 1rem;
}
.menu-drawer-links a:hover { background: var(--bg); text-decoration: none; }

.menu-drawer-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.menu-drawer-footer a {
    display: block;
    padding: 10px 0;
    color: var(--text);
    font-weight: 500;
    text-align: center;
}
.menu-drawer-link-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 500;
    color: var(--danger);
    padding: 10px 0;
    width: 100%;
    text-align: center;
}

/* === Theme Toggle === */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    line-height: 1;
    color: var(--text);
}

/* === Hero === */
.hero {
    text-align: center;
    padding: 40px 16px 32px;
    margin-bottom: 24px;
}
.hero h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}
.hero p { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 20px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* === Stats Bar === */
.stats-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    margin-bottom: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.stats-bar span { white-space: nowrap; }
.stats-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}

/* === Feed Controls === */
.feed-controls { margin-bottom: 20px; }
.search-form { margin-bottom: 12px; }
.search-input { padding-left: 12px; }
.filter-row { margin-bottom: 10px; }
.sort-tabs { display: flex; gap: 4px; margin-bottom: 10px; justify-content: center; }
/* Tag scroll wrapper with arrows */
.tag-scroll-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}
.tag-arrow {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: background 0.2s;
}
.tag-arrow:hover { background: var(--border); }
.tag-filters {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tag-filters::-webkit-scrollbar { display: none; }
.tag-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.tag-pill:hover { background: var(--border); text-decoration: none; }
.tag-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.search-results-info { margin-bottom: 16px; }

/* === Card Tags === */
.card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.card-tags .tag-pill { font-size: 0.75rem; padding: 2px 8px; cursor: default; }

/* === Page Header === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 1.5rem; }

/* === Cards === */
.card {
    display: block;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    color: var(--text);
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-lg); text-decoration: none; }
.card-title { font-size: 1.1rem; margin-bottom: 8px; line-height: 1.3; }
.card-body { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 12px; }
.card-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.card-meta { color: var(--text-muted); font-size: 0.85rem; }
.prayer-count {
    background: var(--primary-light);
    color: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* === Request Detail === */
.request-detail { margin-bottom: 32px; }
.request-header { margin-bottom: 20px; }
.request-header h1 { font-size: 1.5rem; margin-bottom: 8px; }
.request-body {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    font-size: 1.05rem;
    line-height: 1.7;
}
.request-body p { margin-bottom: 12px; }
.request-body p:last-child { margin-bottom: 0; }

/* === Pray Section === */
.pray-section {
    text-align: center;
    padding: 24px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.prayer-count-display { margin-bottom: 16px; font-size: 1rem; color: var(--text-muted); }
.prayer-count-number { font-size: 2rem; font-weight: 800; color: var(--primary); display: block; }

/* === Share Section === */
.share-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.share-section label { font-size: 0.9rem; font-weight: 600; display: block; margin-bottom: 8px; }
.share-link { display: flex; gap: 8px; }
.share-link input { flex: 1; }

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s, transform 0.1s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cfd8dc; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-full { width: 100%; }
.btn-group { display: flex; gap: 12px; }

.btn-pray {
    background: var(--primary);
    color: #fff;
    font-size: 1.1rem;
    padding: 14px 32px;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
}
.btn-pray:hover { background: var(--primary-dark); color: #fff; }
.btn-pray.btn-waiting { opacity: 0.6; }
.btn-prayed {
    background: var(--success);
    color: #fff;
    font-size: 1.1rem;
    padding: 14px 32px;
    border-radius: 50px;
    cursor: default;
}

/* === Forms === */
.form { margin-top: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.form-input, .form input[type="text"], .form input[type="email"], .form input[type="password"],
.form textarea, .form select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font);
    background: var(--bg-card);
    color: var(--text);
    transition: border-color 0.2s;
}
.form-input:focus, .form input:focus, .form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108,92,231,0.15);
}
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-check label { margin-bottom: 0; font-weight: 500; }
.form-check input[type="checkbox"] { width: auto; margin: 0; }
.char-counter-wrap { position: relative; }
.char-counter {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.char-counter.warn { color: var(--warning); }
.char-counter.over { color: var(--danger); font-weight: 600; }
.form-error { color: var(--danger); font-size: 0.85rem; margin-top: 4px; }
.form-help { color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; }

/* === Auth Pages === */
.auth-card {
    max-width: 400px;
    margin: 40px auto;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px 24px;
    box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-muted); margin-bottom: 24px; }
.auth-switch { margin-top: 20px; text-align: center; font-size: 0.9rem; color: var(--text-muted); }

/* Auth divider ("or") */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Social login buttons (allauth provider list) */
.provider-login-list { display: flex; flex-direction: column; gap: 8px; }
.provider-login-list a, .provider-login-list button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    font-family: var(--font);
    text-decoration: none;
    transition: background 0.2s;
}
.provider-login-list a:hover, .provider-login-list button:hover {
    background: var(--bg);
    text-decoration: none;
}

/* === Form Page === */
.form-page {
    max-width: 540px;
    margin: 0 auto;
}
.form-page h1 { font-size: 1.5rem; margin-bottom: 4px; }

/* === Profile === */
.profile-header { text-align: center; margin-bottom: 24px; }
.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.profile-bio { color: var(--text-muted); max-width: 400px; margin: 8px auto; text-align: left; }
.profile-bio p { margin-bottom: 8px; }
.profile-bio p:last-child { margin-bottom: 0; }

/* === Avatar Images === */
.avatar-img { border-radius: 50%; object-fit: cover; }
.avatar-img-lg { width: 72px; height: 72px; margin-bottom: 12px; }
.avatar-img-sm { width: 40px; height: 40px; border-radius: 50%; }
.current-avatar { margin-bottom: 16px; text-align: center; }
.profile-rank {
    display: inline-block;
    padding: 4px 16px;
    background: var(--primary-light);
    color: #fff;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 8px;
}
.profile-section { margin-top: 32px; }
.profile-section h2 { font-size: 1.2rem; margin-bottom: 16px; }

/* === Stats Grid === */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); }
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

/* === Badges === */
.badge-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.badge-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: var(--shadow);
    font-size: 0.9rem;
}
.badge-icon { font-size: 1.2rem; }
.badge-name { font-weight: 600; }

/* === Prayer Avatars === */
.prayer-avatars { display: flex; flex-wrap: wrap; gap: 8px; }
.prayer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}
.prayer-avatar:hover { text-decoration: none; background: var(--primary); }

/* === Comments === */
.section { margin-top: 32px; }
.section h2 { font-size: 1.2rem; margin-bottom: 16px; }
.comment-form { margin-bottom: 24px; }
.comment-form textarea { margin-bottom: 8px; }
.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.comment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.comment-body p { margin-bottom: 8px; }
.comment-body p:last-child { margin-bottom: 0; }

/* === Leaderboard === */
.period-tabs { display: flex; gap: 4px; margin-bottom: 24px; overflow-x: auto; padding-bottom: 4px; }
.tab {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-card);
    white-space: nowrap;
}
.tab:hover { text-decoration: none; background: var(--border); }
.tab.active { background: var(--primary); color: #fff; }
.leaderboard { display: flex; flex-direction: column; gap: 8px; }
.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
.leaderboard-row.top-three { box-shadow: var(--shadow-lg); }
.lb-rank { font-size: 1.2rem; min-width: 32px; text-align: center; }
.lb-user { flex: 1; font-weight: 600; }
.lb-points { font-weight: 700; color: var(--primary); }

/* === Messages === */
.messages { margin-bottom: 16px; }
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.alert-success { background: #D4EDDA; color: #155724; }
.alert-error { background: #F8D7DA; color: #721C24; }
.alert-warning { background: #FFF3CD; color: #856404; }

/* === Utilities === */
.text-muted { color: var(--text-muted); font-size: 0.9rem; }
.text-danger { color: var(--danger); }
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.empty-state .btn { margin-top: 16px; }

/* === Infinite Scroll Loader === */
.scroll-loader { text-align: center; padding: 24px; }
.loader-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Social Share === */
.share-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    transition: opacity 0.2s;
}
.share-btn:hover { opacity: 0.85; text-decoration: none; color: #fff; }
.share-btn-x { background: #000; }
.share-btn-fb { background: #1877F2; }
.share-btn-wa { background: #25D366; }
.share-btn-tg { background: #0088CC; }
.share-btn-email { background: var(--text-muted); }
.share-btn-reddit { background: #FF4500; }

/* === About Page === */
.about-page h1 { font-size: 1.6rem; margin-bottom: 16px; }
.about-page h2 { font-size: 1.25rem; margin-top: 32px; margin-bottom: 16px; }
.about-section { margin-bottom: 16px; }
.about-section p { margin-bottom: 12px; line-height: 1.7; }
.about-steps { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.about-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.about-step h3 { font-size: 1rem; margin-bottom: 4px; }
.about-step p { color: var(--text-muted); margin: 0; line-height: 1.6; }
.step-number {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.about-cta {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    justify-content: center;
    flex-wrap: wrap;
}

/* === Footer === */
.footer {
    margin-top: auto;
    padding: 24px 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
