/* ═══════════════════════════════════════════════════════════
   AJR — Styles v3.0
   Dark-first design system. Refined, calm, Islamic aesthetic.
   Fonts: Fraunces (display) + DM Sans (body) + Amiri (arabic)
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,700;0,9..144,900;1,9..144,300&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,300&family=Amiri:ital,wght@0,400;0,700;1,400&display=swap');

/* ── TOKENS ────────────────────────────────────────────── */
:root {
    /* Brand */
    --green:     #2D6A4F;
    --green-2:   #40916C;
    --green-3:   #74C69D;
    --gold:      #D4A843;
    --gold-2:    #F0C040;
    --red:       #C1292E;

    /* Dark surfaces */
    --bg-0:      #0D0F0E;   /* deepest — app bg */
    --bg-1:      #141917;   /* cards, sheets */
    --bg-2:      #1C2220;   /* elevated cards */
    --bg-3:      #252E2B;   /* inputs, hover */
    --border:    #2A3330;
    --border-2:  #3A4440;

    /* Typography */
    --text-0:    #F0EDE8;   /* primary */
    --text-1:    #B8B5AF;   /* secondary */
    --text-2:    #72706C;   /* muted */
    --text-arabic: #D4C89A; /* arabic text warm */

    /* Radius */
    --r-sm:  8px;
    --r-md:  14px;
    --r-lg:  20px;
    --r-xl:  28px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-md: 0 6px 24px rgba(0,0,0,0.5);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.6);

    /* Legacy compat */
    --bg:            var(--bg-2);
    --text:          var(--text-0);
    --muted:         var(--text-2);
    --algeria-green: var(--green);
    --algeria-light: var(--green-2);
    --algeria-red:   var(--red);
    --radius:        var(--r-md);
    --shadow:        var(--shadow-sm);
}

/* ── BASE ───────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html { color-scheme: dark; }

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--bg-0);
    color: var(--text-0);
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 0; height: 0; }

/* ── SPIN ANIMATION ────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-ring {
    0%, 100% { box-shadow: 0 0 0 0 rgba(45,106,79,0.5); }
    70%       { box-shadow: 0 0 0 16px rgba(45,106,79,0); }
}

/* ── AUTH ───────────────────────────────────────────────── */
.auth-screen {
    position: fixed;
    inset: 0;
    background: #0f1712;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    z-index: 5000;
}

.auth-logo {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--green), var(--green-2));
    border-radius: 22px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Amiri', serif;
    font-size: 36px; color: white;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(45,106,79,0.4);
}

.auth-title {
    font-family: 'Fraunces', serif;
    font-size: 28px; font-weight: 700;
    color: var(--text-0);
    margin-bottom: 6px;
    text-align: center;
}

.auth-sub {
    font-size: 14px; color: var(--text-1);
    text-align: center; margin-bottom: 32px; line-height: 1.6;
}

.auth-tabs {
    display: flex; gap: 4px;
    background: #1e2a24;
    border-radius: var(--r-md);
    padding: 4px; width: 100%;
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1; padding: 10px;
    border: none; border-radius: var(--r-sm);
    font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
    background: transparent; color: var(--text-2);
}
.auth-tab.active {
    background: var(--green); color: white;
    box-shadow: var(--shadow-sm);
}

.auth-form { width: 100%; display: flex; flex-direction: column; gap: 12px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label { font-size: 12px; font-weight: 600; color: var(--text-1); letter-spacing: 0.4px; }

.form-input {
    padding: 14px 16px;
    background: #1e2a24;
    border: 1.5px solid #3a4f45;
    border-radius: var(--r-md);
    color: var(--text-0);
    font-size: 15px; font-family: inherit;
    outline: none; transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--green-2); }
.form-input::placeholder { color: var(--text-2); }

.submit-btn {
    width: 100%; padding: 15px;
    background: linear-gradient(135deg, var(--green), var(--green-2));
    color: white; border: none;
    border-radius: var(--r-md);
    font-size: 16px; font-weight: 700;
    cursor: pointer; margin-top: 4px;
    transition: opacity 0.2s; font-family: inherit;
}
.submit-btn:active { opacity: 0.88; }

.google-btn {
    width: 100%; padding: 14px 16px;
    background: var(--bg-2); color: var(--text-0);
    border: 1.5px solid var(--border-2);
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center; gap: 10px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    font-family: inherit; transition: background 0.2s;
}
.google-btn:hover { background: var(--bg-3); }

.auth-divider {
    display: flex; align-items: center; gap: 12px;
    color: var(--text-2); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

.guest-btn {
    background: none; border: none;
    color: var(--text-2); font-size: 14px;
    cursor: pointer; padding: 8px; font-family: inherit;
    text-decoration: underline; text-underline-offset: 3px;
}

/* ── MAIN APP ───────────────────────────────────────────── */
#mainApp { display: none; }
#mainApp.show { display: block; }

/* ── HEADER ────────────────────────────────────────────── */
.app-header {
    position: sticky; top: 0; z-index: 100;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex; align-items: center; justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--green), var(--green-2));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Amiri', serif; font-size: 18px; color: white;
    font-weight: 700;
}

.brand-text h1 {
    font-family: 'Fraunces', serif;
    font-size: 18px; font-weight: 700; color: var(--text-0);
    margin: 0;
}
.brand-text span { font-size: 10px; color: var(--text-2); }

.header-actions { display: flex; gap: 6px; }

.icon-btn {
    width: 38px; height: 38px;
    border-radius: var(--r-sm);
    background: var(--bg-2);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-1);
    position: relative; transition: background 0.15s;
}
.icon-btn:active { background: var(--bg-3); }

.badge-count {
    position: absolute; top: -4px; right: -4px;
    background: var(--red); color: white;
    font-size: 9px; font-weight: 700;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-1);
}

.location-bar {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer; font-size: 12px;
    color: var(--text-1);
}

/* ── SEARCH ────────────────────────────────────────────── */
.search-container {
    padding: 10px 16px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
}

.search-box { display: flex; gap: 8px; }

.search-input {
    flex: 1; padding: 11px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    font-size: 14px; outline: none;
    background: var(--bg-2);
    color: var(--text-0); font-family: inherit;
    transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--green-2); }
.search-input::placeholder { color: var(--text-2); }

.search-btn {
    width: 42px; height: 42px;
    background: var(--bg-2);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-1);
}

/* ── FILTER PILLS ──────────────────────────────────────── */
.filter-pills {
    display: flex; gap: 6px;
    padding: 10px 16px;
    overflow-x: auto;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}
.filter-pills::-webkit-scrollbar { display: none; }

.filter-pill {
    padding: 7px 16px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px; font-weight: 600;
    color: var(--text-1);
    cursor: pointer; white-space: nowrap;
    transition: all 0.15s;
}
.filter-pill.active { background: var(--green); color: white; border-color: var(--green); }
.filter-pill.gold { background: rgba(212,168,67,0.12); color: var(--gold); border-color: rgba(212,168,67,0.3); }

/* ── SECTIONS ──────────────────────────────────────────── */
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 16px 10px;
}

.section-title {
    font-size: 15px; font-weight: 700;
    color: var(--text-0);
    display: flex; align-items: center; gap: 6px;
    letter-spacing: -0.2px;
}
.section-title svg { color: var(--green); flex-shrink: 0; }

.section-link {
    font-size: 12px; font-weight: 600;
    color: var(--green-3); cursor: pointer;
}

/* ── HERO / ZAKAT ──────────────────────────────────────── */
.hero-section {
    margin: 14px 16px;
    background: linear-gradient(135deg, #1A3D2B 0%, #1E3528 100%);
    border-radius: var(--r-xl);
    padding: 20px;
    border: 1px solid rgba(64,145,108,0.3);
    position: relative; overflow: hidden;
}

.hero-section::before {
    content: 'زكاة';
    position: absolute; right: -8px; bottom: -8px;
    font-family: 'Amiri', serif;
    font-size: 90px; color: rgba(64,145,108,0.08);
    line-height: 1; pointer-events: none;
}

.hero-title { font-size: 19px; font-weight: 700; color: var(--text-0); margin-bottom: 3px; }
.hero-subtitle { font-size: 13px; color: var(--text-1); margin-bottom: 16px; }

.zakat-box {
    background: rgba(255,255,255,0.06);
    border-radius: var(--r-md);
    padding: 14px;
    border: 1px solid rgba(255,255,255,0.1);
}

.zakat-input-row { display: flex; gap: 8px; margin-bottom: 10px; }

.zakat-input {
    flex: 1;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--r-sm);
    padding: 11px 14px;
    color: white; font-size: 18px; font-weight: 600;
    outline: none; font-family: inherit;
}
.zakat-input::placeholder { color: rgba(255,255,255,0.4); }

.zakat-currency {
    padding: 11px 14px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--r-sm);
    font-weight: 700; color: rgba(255,255,255,0.7);
    font-size: 14px;
    display: flex; align-items: center;
}

.zakat-result {
    background: rgba(255,255,255,0.08);
    border-radius: var(--r-sm);
    padding: 14px;
    display: none;
}
.zakat-result.show { display: block; animation: fadeIn 0.3s; }
.zakat-amount { font-size: 26px; font-weight: 800; color: var(--green-3); margin-bottom: 2px; }
.zakat-conversion { font-size: 12px; color: var(--text-1); margin-bottom: 12px; }

.zakat-btn {
    width: 100%; padding: 12px;
    background: var(--green);
    color: white; border: none;
    border-radius: var(--r-sm);
    font-size: 14px; font-weight: 700;
    cursor: pointer; font-family: inherit;
    transition: opacity 0.2s;
}
.zakat-btn:active { opacity: 0.85; }

/* ── HASANAT CARDS ─────────────────────────────────────── */
.hasanat-scroll {
    display: flex; gap: 10px;
    padding: 0 16px;
    overflow-x: auto; scrollbar-width: none;
}
.hasanat-scroll::-webkit-scrollbar { display: none; }

.hasanat-card {
    min-width: 130px;
    background: var(--bg-1);
    border-radius: var(--r-lg);
    padding: 16px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.2s;
    border-top: 3px solid transparent;
}
.hasanat-card:active { transform: scale(0.97); }
.hasanat-card.green { border-top-color: var(--green); }
.hasanat-card.red { border-top-color: var(--red); }
.hasanat-card.gold { border-top-color: var(--gold); }
.hasanat-card.purple { border-top-color: #8b5cf6; }

.hasanat-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 10px;
    font-size: 20px;
}
.hasanat-card.green .hasanat-icon { background: rgba(45,106,79,0.2); }
.hasanat-card.red .hasanat-icon { background: rgba(193,41,46,0.15); }
.hasanat-card.gold .hasanat-icon { background: rgba(212,168,67,0.15); }
.hasanat-card.purple .hasanat-icon { background: rgba(139,92,246,0.15); }

.hasanat-number { font-size: 22px; font-weight: 800; margin-bottom: 2px; }
.hasanat-card.green .hasanat-number { color: var(--green-3); }
.hasanat-card.red .hasanat-number { color: #ff6b70; }
.hasanat-card.gold .hasanat-number { color: var(--gold-2); }
.hasanat-card.purple .hasanat-number { color: #a78bfa; }

.hasanat-label { font-size: 12px; font-weight: 600; color: var(--text-0); margin-bottom: 2px; }
.hasanat-desc { font-size: 10px; color: var(--text-2); }

/* ── PRODUCT CARDS ─────────────────────────────────────── */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px; padding: 0 16px;
}

.product-card {
    background: var(--bg-1);
    border-radius: var(--r-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.product-card:active { transform: scale(0.97); }

.product-image {
    aspect-ratio: 1;
    background: var(--bg-2);
    position: relative; overflow: hidden;
}
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-image img:not([src]), .product-image img[src=""] {
    display: none;
}

.product-badges {
    position: absolute; top: 8px; left: 8px; right: 8px;
    display: flex; flex-wrap: wrap; gap: 3px; z-index: 2;
}

.badge { padding: 3px 7px; border-radius: 5px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-gold { background: var(--gold); color: #1a1000; }
.badge-halal { background: var(--green); color: white; }
.badge-shield { background: var(--green); color: white; }
.badge-danger { background: var(--red); color: white; }
.badge-warning { background: var(--gold); color: #1a1000; }

.product-fav {
    position: absolute; top: 8px; right: 8px;
    width: 30px; height: 30px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    border: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: white;
    z-index: 3; font-size: 14px;
}

.product-info { padding: 10px; }

.product-price-row { display: flex; align-items: baseline; gap: 5px; margin-bottom: 4px; }
.product-price { font-size: 16px; font-weight: 800; color: var(--text-0); }
.product-price.gold { color: var(--gold-2); }
.product-gold-alt { font-size: 11px; color: var(--text-2); }

.product-title {
    font-size: 12px; font-weight: 500; line-height: 1.4;
    color: var(--text-1); margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden; min-height: 34px;
}

.product-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-2); }
.ethical-warning { color: #ff6b70; font-size: 10px; margin-top: 3px; font-weight: 600; }

/* ── ETHICAL PANEL ─────────────────────────────────────── */
.ethical-panel {
    background: var(--bg-1);
    border-radius: var(--r-xl);
    padding: 18px;
    margin: 14px 16px;
    border: 1px solid var(--border);
}

.ethical-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 14px; padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.shield-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--green), var(--green-2));
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: white;
}

.check-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px; margin-bottom: 8px;
    border-radius: var(--r-sm);
    background: var(--bg-2);
    cursor: pointer; transition: background 0.15s;
    border-left: 3px solid transparent;
}
.check-item:active { transform: scale(0.99); }
.check-item.pass { border-left-color: var(--green); background: rgba(45,106,79,0.12); }
.check-item.warn { border-left-color: var(--gold); background: rgba(212,168,67,0.1); }
.check-item.block { border-left-color: var(--red); background: rgba(193,41,46,0.1); }

.check-icon {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0; margin-top: 1px;
}
.pass .check-icon { background: rgba(45,106,79,0.2); color: var(--green-3); }
.warn .check-icon { background: rgba(212,168,67,0.2); color: var(--gold-2); }
.block .check-icon { background: rgba(193,41,46,0.2); color: #ff6b70; }

.check-content { flex: 1; }
.check-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; color: var(--text-0); }
.check-message { font-size: 12px; color: var(--text-1); line-height: 1.5; }
.check-action { margin-top: 6px; color: var(--green-3); font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; }

.community-verification { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.verification-stats { display: flex; gap: 14px; margin-bottom: 10px; }
.stat { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-1); }
.stat-value { font-weight: 700; color: var(--green-3); }

.report-btn {
    width: 100%; padding: 11px;
    background: transparent;
    border: 1.5px solid var(--red);
    color: #ff6b70;
    border-radius: var(--r-sm);
    font-size: 13px; font-weight: 700;
    cursor: pointer; font-family: inherit;
}
.report-btn:active { background: rgba(193,41,46,0.12); }

/* ── SCANNER ───────────────────────────────────────────── */
.scanner-fab {
    position: fixed; bottom: 88px; right: 16px;
    width: 58px; height: 58px;
    background: linear-gradient(135deg, var(--green), var(--green-2));
    border-radius: 50%;
    border: 3px solid var(--bg-0);
    color: white; font-size: 24px;
    box-shadow: 0 4px 20px rgba(45,106,79,0.5);
    cursor: pointer; z-index: 999;
    display: flex; align-items: center; justify-content: center;
    animation: pulse-ring 2.5s infinite;
}
.scanner-fab:active { transform: scale(0.92); animation: none; }

.scanner-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.97);
    z-index: 3000;
    display: none; flex-direction: column;
    align-items: center; justify-content: flex-start;
    padding: 20px; overflow-y: auto;
}
.scanner-modal.active { display: flex; }

.scanner-header {
    width: 100%;
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; padding-top: 44px;
}
.scanner-title { color: white; font-size: 19px; font-weight: 700; }
.scanner-close {
    width: 42px; height: 42px;
    background: rgba(255,255,255,0.12);
    border: none; border-radius: 50%;
    color: white; font-size: 22px; cursor: pointer;
}

.scanner-tabs {
    display: flex; gap: 6px; margin-bottom: 18px;
    background: rgba(255,255,255,0.08);
    padding: 4px; border-radius: var(--r-sm);
}
.scanner-tab {
    padding: 9px 18px;
    background: transparent; border: none;
    color: rgba(255,255,255,0.5);
    font-size: 13px; font-weight: 600;
    border-radius: 6px; cursor: pointer; transition: all 0.2s;
    font-family: inherit;
}
.scanner-tab.active { background: var(--green); color: white; }

#reader { width: 100%; max-width: 350px; border-radius: var(--r-lg); overflow: hidden; margin-bottom: 18px; }
#reader video { border-radius: var(--r-lg); }

.ocr-section { width: 100%; max-width: 350px; display: none; }
.ocr-section.active { display: block; }
.ocr-preview {
    width: 100%; height: 180px;
    background: rgba(255,255,255,0.08);
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px; overflow: hidden; position: relative;
}
.ocr-preview img { width: 100%; height: 100%; object-fit: cover; }
.ocr-preview .placeholder { color: rgba(255,255,255,0.4); text-align: center; padding: 16px; }
.file-input { display: none; }
.file-label {
    display: block; width: 100%; padding: 14px;
    background: var(--green); color: white;
    text-align: center; border-radius: var(--r-md);
    cursor: pointer; margin-bottom: 10px; font-weight: 600;
}
.ocr-status { color: rgba(255,255,255,0.7); text-align: center; font-size: 13px; margin-top: 10px; min-height: 20px; }
.ocr-progress {
    width: 100%; height: 3px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px; margin-top: 6px; overflow: hidden;
}
.ocr-progress-bar { height: 100%; background: var(--green); width: 0%; transition: width 0.3s; }

.manual-input-section { width: 100%; max-width: 350px; margin-top: 16px; }
.ingredient-textarea {
    width: 100%; padding: 14px;
    border: 1.5px solid rgba(255,255,255,0.15);
    border-radius: var(--r-md);
    font-size: 14px;
    background: rgba(255,255,255,0.07);
    color: white; resize: vertical; min-height: 110px;
    font-family: inherit;
}
.ingredient-textarea::placeholder { color: rgba(255,255,255,0.35); }
.ingredient-textarea:focus { outline: none; border-color: var(--green); }
.analyze-btn {
    width: 100%; padding: 14px;
    background: var(--gold); color: #1a1000;
    border: none; border-radius: var(--r-md);
    font-size: 15px; font-weight: 700;
    cursor: pointer; margin-top: 10px; font-family: inherit;
}

/* ── RESULTS ───────────────────────────────────────────── */
.results-list { padding: 0 16px; display: none; }
.results-list.show { display: block; }

.result-item {
    background: var(--bg-1);
    border-radius: var(--r-lg);
    padding: 18px; margin-bottom: 10px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--green);
    animation: fadeIn 0.3s;
}

.result-arabic {
    font-family: 'Amiri', serif;
    font-size: 20px; color: var(--text-arabic);
    margin-bottom: 10px; line-height: 1.8; text-align: right;
}
.result-text { font-size: 14px; line-height: 1.6; margin-bottom: 10px; color: var(--text-0); }
.result-meta { display: flex; gap: 10px; font-size: 12px; }
.result-tag { padding: 3px 10px; background: var(--green); color: white; border-radius: 20px; font-weight: 700; font-size: 10px; }
.result-source { color: var(--text-2); }
.result-context { margin-top: 10px; padding: 10px; background: var(--bg-2); border-radius: var(--r-sm); font-size: 12px; color: var(--text-1); }
.close-results { text-align: center; margin-bottom: 14px; }
.close-results-btn { color: var(--green-3); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }

/* ── BOTTOM NAV ─────────────────────────────────────────── */
.app-page { display: none; min-height: 100vh; background: var(--bg-0); }
.app-page.active { display: block; }

.bottom-nav {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 430px;
    background: var(--bg-1);
    border-top: 1px solid var(--border);
    display: flex; justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 1000;
}

.nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 12px;
    color: var(--text-2);
    font-size: 9px; font-weight: 600; letter-spacing: 0.3px;
    cursor: pointer; border: none; background: none;
    border-radius: var(--r-sm); transition: color 0.2s;
    font-family: inherit;
}
.nav-item svg { transition: all 0.2s; }
.nav-item.active { color: var(--green-3); }
.nav-item.active svg { stroke: var(--green-3); }
.nav-icon { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; }
.nav-sell { position: relative; top: -14px; }
.nav-sell-btn {
    width: 54px; height: 54px;
    background: linear-gradient(135deg, var(--green), var(--green-2));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 18px rgba(45,106,79,0.5);
    border: 3px solid var(--bg-0);
    cursor: pointer; transition: transform 0.2s;
}
.nav-sell-btn:active { transform: scale(0.92); }

/* ── TOAST ─────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 96px; left: 50%;
    transform: translateX(-50%) translateY(30px);
    background: var(--bg-3);
    border: 1px solid var(--border-2);
    color: var(--text-0);
    padding: 12px 20px;
    border-radius: var(--r-md);
    font-size: 13px; font-weight: 500;
    z-index: 4000; opacity: 0;
    transition: all 0.25s;
    max-width: 320px; text-align: center;
    backdrop-filter: blur(10px);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── MODALS ────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    z-index: 2000;
    align-items: flex-end; justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal-sheet {
    background: var(--bg-1);
    width: 100%; max-width: 430px;
    max-height: 92vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    overflow: hidden;
    animation: slideUp 0.3s cubic-bezier(0.34,1.26,0.64,1);
}

.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px;
    background: var(--bg-1);
}
.modal-close {
    width: 36px; height: 36px;
    background: var(--bg-2);
    border: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-1); font-size: 18px;
}
.modal-title { font-size: 17px; font-weight: 700; flex: 1; color: var(--text-0); }
.modal-body { padding: 18px; overflow-y: auto; max-height: 72vh; }

.forgot-text { color: var(--text-1); margin-bottom: 18px; line-height: 1.6; font-size: 14px; }

.success-icon {
    width: 56px; height: 56px;
    background: rgba(45,106,79,0.15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; margin: 0 auto 18px;
}

.hidden { display: none !important; }

/* ── REPORT ─────────────────────────────────────────────── */
.report-options { display: flex; flex-direction: column; gap: 10px; }
.report-option {
    padding: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    cursor: pointer; transition: all 0.15s;
    background: var(--bg-2);
}
.report-option:active { border-color: var(--red); background: rgba(193,41,46,0.1); }
.report-option.selected { border-color: var(--red); background: rgba(193,41,46,0.1); }
.report-option-title { font-weight: 600; margin-bottom: 3px; font-size: 14px; color: var(--text-0); }
.report-option-desc { font-size: 12px; color: var(--text-1); }

.report-textarea {
    width: 100%; padding: 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    font-size: 13px; resize: vertical; min-height: 90px;
    margin-top: 14px; font-family: inherit;
    background: var(--bg-2); color: var(--text-0);
}
.report-textarea:focus { outline: none; border-color: var(--green); }

/* ── SADAQA ─────────────────────────────────────────────── */
.sadaqa-section { padding: 16px; }
.sadaqa-grid, #crowdfundingContainer { padding: 0 16px; }

.sadaqa-card {
    background: var(--bg-1);
    border-radius: var(--r-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer; transition: transform 0.2s;
    margin-bottom: 12px;
}
.sadaqa-card:active { transform: scale(0.98); }

.sadaqa-image { position: relative; height: 150px; overflow: hidden; }
.sadaqa-image img { width: 100%; height: 100%; object-fit: cover; }

.sadaqa-badge { position: absolute; top: 10px; left: 10px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; color: white; }
.sadaqa-badge.available { background: var(--green); }
.sadaqa-badge.reserved { background: var(--gold); color: #1a1000; }

.verified-badge { position: absolute; top: 10px; right: 10px; background: var(--green); color: white; padding: 3px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; }

.sadaqa-content { padding: 14px; }
.sadaqa-content h3 { font-size: 14px; margin-bottom: 5px; color: var(--text-0); }
.sadaqa-desc { font-size: 12px; color: var(--text-1); margin-bottom: 10px; line-height: 1.5; }
.sadaqa-meta { display: flex; gap: 10px; font-size: 11px; color: var(--text-2); margin-bottom: 8px; }
.sadaqa-donor { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 8px; color: var(--text-1); }
.female-badge { background: #9d174d; color: white; padding: 2px 6px; border-radius: 8px; font-size: 9px; font-weight: 700; }
.pickup-options { display: flex; gap: 5px; flex-wrap: wrap; }
.pickup-tag { background: var(--bg-2); padding: 3px 8px; border-radius: 6px; font-size: 10px; color: var(--text-1); border: 1px solid var(--border); }

/* ── CROWDFUNDING ──────────────────────────────────────── */
.crowdfunding-card {
    background: var(--bg-1);
    border-radius: var(--r-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 12px;
}
.crowdfunding-image { position: relative; height: 130px; }
.crowdfunding-image img { width: 100%; height: 100%; object-fit: cover; }

.progress-overlay { position: absolute; bottom: 0; left: 0; right: 0; height: 6px; background: rgba(0,0,0,0.4); }
.progress-bar { height: 100%; background: var(--green); transition: width 0.5s; }
.progress-text { position: absolute; right: 10px; top: -22px; background: var(--green); color: white; padding: 2px 7px; border-radius: 6px; font-size: 10px; font-weight: 800; }

.crowdfunding-content { padding: 14px; }
.crowdfunding-content h3 { font-size: 14px; margin-bottom: 5px; color: var(--text-0); }
.crowdfunding-desc { font-size: 12px; color: var(--text-1); margin-bottom: 10px; }

.crowdfunding-stats { display: flex; justify-content: space-between; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.crowdfunding-stats .stat { text-align: center; }
.stat-value { display: block; font-size: 15px; font-weight: 800; color: var(--green-3); }
.stat-label { font-size: 10px; color: var(--text-2); }

.organizer { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 10px; color: var(--text-1); }
.donate-btn { width: 100%; padding: 12px; background: var(--gold); color: #1a1000; border: none; border-radius: var(--r-sm); font-size: 13px; font-weight: 800; cursor: pointer; font-family: inherit; }

/* ── LIBRARY CATEGORIES ─────────────────────────────────── */
.library-categories {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 8px; padding: 0 16px; margin-bottom: 14px;
}

/* ── FABs ───────────────────────────────────────────────── */
.fab-sadaqa {
    position: fixed; bottom: 165px; right: 16px;
    width: 52px; height: 52px;
    background: var(--gold);
    border-radius: 50%;
    border: 3px solid var(--bg-0);
    color: #1a1000; font-size: 22px;
    box-shadow: 0 4px 16px rgba(212,168,67,0.4);
    cursor: pointer; z-index: 998;
    display: flex; align-items: center; justify-content: center;
}

/* ── LOADING ANIMATION ──────────────────────────────────── */
@keyframes loading-bar {
    0%   { width: 0%; margin-left: 0; }
    50%  { width: 60%; margin-left: 20%; }
    100% { width: 0%; margin-left: 100%; }
}

/* ── IBADAH WIDGET ──────────────────────────────────────── */
#ibadahWidgetCount { transition: all 0.3s; }

/* ── PROTECTION MODAL ───────────────────────────────────── */
.protection-modal { background: var(--bg-1); padding: 22px; border-radius: var(--r-xl); }
.protection-modal h3 { color: var(--green-3); margin-bottom: 10px; }
.protection-modal ul { list-style: none; margin: 14px 0; }
.protection-modal li { padding: 8px 0; border-bottom: 1px solid var(--border); color: var(--text-1); font-size: 13px; }

/* ── EMOTION GRID ───────────────────────────────────────── */
.emotion-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 16px; margin-bottom: 20px; }
.emotion-btn {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px 6px;
    text-align: center; cursor: pointer; transition: all 0.15s;
}
.emotion-btn:active { border-color: var(--green); background: rgba(45,106,79,0.1); }
.emotion-icon { font-size: 26px; margin-bottom: 5px; display: block; }
.emotion-name { font-size: 10px; font-weight: 600; color: var(--text-1); }

/* ── PRODUCT DETAIL ─────────────────────────────────────── */
.detail-image { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg-2); }
.detail-price { font-size: 28px; font-weight: 900; color: var(--text-0); }
.detail-gallery { display: flex; gap: 6px; padding: 10px 16px; overflow-x: auto; }
.detail-thumb {
    width: 60px; height: 60px; object-fit: cover; border-radius: 8px;
    cursor: pointer; border: 2px solid transparent; flex-shrink: 0;
}
.detail-thumb.active { border-color: var(--green-2); }

/* ── UTILITY ─────────────────────────────────────────────── */
.text-muted { color: var(--text-2); }
.text-green { color: var(--green-3); }
.text-gold  { color: var(--gold-2); }
.text-red   { color: #ff6b70; }

/* Quran-reader smooth loading */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.shimmer {
    background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
    background-size: 400px 100%;
    animation: shimmer 1.2s ease-in-out infinite;
    border-radius: var(--r-sm);
}

/* ══════════════════════════════════════════
   AJR WARM — menos negro, más vida
══════════════════════════════════════════ */
:root {
    --green:       #1A7A4A !important;
    --green-2:     #22A060 !important;
    --green-3:     #4DD880 !important;
    --gold:        #E8A020 !important;
    --gold-2:      #FFC030 !important;

    /* Fondos cálidos — no negros puros */
    --bg-0:        #0E1A12 !important;
    --bg-1:        #162018 !important;
    --bg-2:        #1C2A20 !important;
    --bg-3:        #223228 !important;
    --border:      #2A3D30 !important;
    --border-2:    #344D3C !important;

    /* Texto más brillante */
    --text-0:      #F5F2EE !important;
    --text-1:      #C8C4BC !important;
    --text-2:      #8A8880 !important;
    --text-arabic: #F0DC98 !important;
}

/* Body — verde forestal cálido, no negro */
body {
    background: linear-gradient(180deg, #0E1A12 0%, #111F15 100%) !important;
}

/* Auth screen — más cálida */
.auth-screen {
    background:
        radial-gradient(ellipse at 20% 10%, rgba(26,122,74,0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 90%, rgba(255,192,48,0.1) 0%, transparent 50%),
        #0A130D !important;
}

/* Header más visible */
.header {
    background: linear-gradient(160deg,#0A1A0C,#0E2012,#122518) !important;
    border-bottom: 1px solid rgba(77,216,128,0.12) !important;
}

/* Cards más visibles */
.product-card {
    background: var(--bg-1) !important;
    border: 1px solid rgba(255,255,255,0.07) !important;
    border-radius: 18px !important;
    transition: transform 0.12s !important;
}
.product-card:active { transform: scale(0.97) !important; }

/* Hasanat cards */
.hasanat-card {
    background: var(--bg-1) !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
}

/* Nav bar */
.bottom-nav, .nav-bar {
    background: rgba(12,20,14,0.97) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border-top: 1px solid rgba(77,216,128,0.1) !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4) !important;
}
.nav-item { position: relative !important; }
.nav-item.active { color: #4DD880 !important; }
.nav-item.active svg {
    stroke: #4DD880 !important;
    filter: drop-shadow(0 0 6px rgba(77,216,128,0.5)) !important;
}
.nav-item.active::after {
    content: ''; position: absolute; top: 0; left: 50%;
    transform: translateX(-50%);
    width: 28px; height: 3px;
    background: linear-gradient(90deg, transparent, #4DD880, transparent);
    border-radius: 0 0 3px 3px;
}
.nav-item:active { transform: scale(0.88) !important; }

/* Modales */
.modal-overlay {
    background: rgba(0,0,0,0.8) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}
.modal-sheet {
    background: var(--bg-1) !important;
    border-top: 1px solid rgba(77,216,128,0.12) !important;
    animation: slideUp 0.28s cubic-bezier(0.34,1.4,0.64,1) !important;
}

/* Botones */
.submit-btn {
    background: linear-gradient(135deg,#1A7A4A,#22A060) !important;
    box-shadow: 0 4px 18px rgba(26,122,74,0.4) !important;
}
.filter-pill.active {
    background: linear-gradient(135deg,#1A7A4A,#22A060) !important;
    border-color: #1A7A4A !important;
    box-shadow: 0 2px 10px rgba(26,122,74,0.3) !important;
}
.scanner-fab {
    background: linear-gradient(135deg,#1A7A4A,#22A060) !important;
    box-shadow: 0 4px 20px rgba(26,122,74,0.5) !important;
}

/* Inputs */
.form-input, .search-input {
    background: var(--bg-2) !important;
    border-color: var(--border) !important;
    color: var(--text-0) !important;
}

/* Ibadah widget */
[onclick="Ibadah.openTracker()"] {
    border: 1px solid rgba(77,216,128,0.15) !important;
}
#ibadahWidgetCount {
    color: #FFC030 !important;
    text-shadow: 0 0 16px rgba(255,192,48,0.3) !important;
}

/* Height fixes */
#mainApp.show { display: block !important; min-height: 100vh; }
.app-page.active { display: block !important; min-height: 100vh; }

/* Scrollbar */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-thumb { background: rgba(77,216,128,0.4); border-radius: 3px; }
