/* style.css */
:root {
    --bg: #050505;
    --fg: #ffffff;
    --accent-green: #007a3d;
    --accent-red: #ce1126;
    --muted: rgba(255, 255, 255, 0.4);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body, html { width: 100%; height: 100%; background-color: var(--bg); color: var(--fg); font-family: 'Inter', sans-serif; overflow-x: hidden; }

/* Loading Overlay */
.loading-overlay { position: fixed; inset: 0; background: var(--bg); z-index: 10000; display: flex; align-items: center; justify-content: center; opacity: 1; transition: opacity 0.5s ease-out 0.2s; pointer-events: none; }
.loading-overlay.hidden { opacity: 0; }
.loading-text { font-family: 'Cormorant Garamond', serif; font-size: clamp(1.5rem, 4vw, 3rem); font-weight: 300; letter-spacing: 0.3em; color: var(--fg); opacity: 0; animation: loadingPulse 1.5s ease-in-out infinite; }
@keyframes loadingPulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* Canvas */
#canvas { display: block; position: fixed; top: 0; left: 0; z-index: 1; pointer-events: none; }

/* ==================== DRAGON TRANSITION (From Provided Code) ==================== */
.dragon-wipe {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 200; pointer-events: none; display: flex; align-items: center;
}
.dragon-trail {
    position: absolute; top: 0; right: 0; width: 100vw; height: 100%;
    background: #000000; transform: scaleX(0); transform-origin: left center;
}
.dragon-body {
    position: relative; width: 300px; height: 300px; flex-shrink: 0; z-index: 2;
    transform: translateX(100vw); opacity: 0;
}
.dragon-body svg { width: 100%; height: 100%; fill: #000000; filter: drop-shadow(0 0 10px rgba(0,0,0,0.5)); }

.dragon-wipe.animate .dragon-body { opacity: 1; animation: dragonFly 2s cubic-bezier(0.7, 0, 0.3, 1) forwards; }
.dragon-wipe.animate .dragon-trail { animation: dragonTrailExpand 2s cubic-bezier(0.7, 0, 0.3, 1) forwards; }
.dragon-wipe.fade-out { opacity: 1; animation: dragonFadeOut 1s ease-in forwards; }

@keyframes dragonFly {
    0% { transform: translateX(100vw) rotate(10deg); }
    20% { transform: translateX(60vw) rotate(0deg); }
    50% { transform: translateX(0vw) rotate(-5deg); }
    100% { transform: translateX(-120vw) rotate(-10deg); }
}
@keyframes dragonTrailExpand {
    0% { transform: scaleX(0); }
    10% { transform: scaleX(0.1); }
    100% { transform: scaleX(3); }
}
@keyframes dragonFadeOut { to { opacity: 0; } }

/* Main App */
#main-app { position: relative; z-index: 10; opacity: 0; transition: opacity 0.8s ease; min-height: 100vh; overflow-y: auto; }
#main-app.visible { opacity: 1; }

/* Navigation */
.main-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 50; padding: 1.5rem 3rem; display: flex; justify-content: space-between; align-items: center; background: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent); }
.logo { font-family: 'Cormorant Garamond', serif; font-size: 1.5rem; letter-spacing: 0.2em; text-transform: uppercase; cursor: pointer; }
.nav-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.nav-btn { background: transparent; border: none; font-family: 'Inter', sans-serif; font-size: 0.8rem; color: var(--muted); cursor: pointer; transition: color 0.3s; text-transform: uppercase; }
.nav-btn:hover { color: var(--fg); }
.nav-btn.active { color: var(--accent-green); }

/* Pages */
.page-view { display: none; width: 100%; min-height: 100vh; padding: 120px 5% 5%; opacity: 0; transform: translateY(20px); transition: opacity 0.5s ease, transform 0.5s ease; }
.page-view.active { display: block; opacity: 1; transform: translateY(0); }

/* Home */
#page-home { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.home-title { font-family: 'Cormorant Garamond', serif; font-size: clamp(3rem, 10vw, 8rem); letter-spacing: 0.1em; margin-bottom: 1rem; }
.home-subtitle { max-width: 600px; line-height: 1.6; color: var(--muted); margin-bottom: 2rem; }
.cta-btn { background: transparent; color: var(--fg); border: 1px solid rgba(255,255,255,0.3); padding: 1rem 2rem; cursor: pointer; transition: all 0.3s; }
.cta-btn:hover { background: var(--fg); color: #000; }

/* Grid & Cards */
.section-header { margin-bottom: 3rem; }
.section-title { font-family: 'Cormorant Garamond', serif; font-size: 2.5rem; margin-bottom: 0.5rem; }
.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.country-card { background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); padding: 2rem; cursor: pointer; transition: all 0.4s; }
.country-card:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--accent-green); transform: translateY(-5px); }
.card-name { font-size: 1.2rem; margin-bottom: 0.5rem; font-weight: 600; }
.card-sub { font-size: 0.8rem; color: var(--muted); }
.card-action { font-size: 0.7rem; color: var(--accent-green); margin-top: 1.5rem; text-transform: uppercase; }

/* Liberation */
.liberation-content { max-width: 800px; margin: 0 auto; font-family: 'Tajawal', sans-serif; direction: rtl; text-align: right; color: rgba(255, 255, 255, 0.85); line-height: 1.8; }
.lib-section { margin-bottom: 3rem; padding-bottom: 2rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.lib-title { font-size: 1.8rem; color: var(--accent-green); margin-bottom: 1rem; font-family: 'Cormorant Garamond', serif; direction: ltr; text-align: left; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.95); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 2rem; opacity: 0; visibility: hidden; transition: all 0.3s; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content { background: #0a0a0a; border: 1px solid rgba(255,255,255,0.1); width: 100%; max-width: 900px; max-height: 90vh; overflow-y: auto; padding: 3rem; position: relative; transform: scale(0.95); transition: transform 0.3s; }
.modal-overlay.active .modal-content { transform: scale(1); }
.modal-close { position: absolute; top: 1rem; left: 1rem; background: transparent; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; margin: 2rem 0; font-size: 0.9rem; }
.data-table th { text-align: right; padding: 12px 15px; background-color: rgba(0, 122, 61, 0.2); color: var(--accent-green); border-bottom: 2px solid var(--accent-green); }
.data-table td { padding: 12px 15px; border-bottom: 1px solid rgba(255,255,255,0.1); color: #ccc; }

/* Donation */
.donate-btn { position: fixed; bottom: 30px; right: 30px; background: transparent; border: 1px solid var(--accent-green); color: var(--accent-green); padding: 10px 20px; font-size: 0.8rem; cursor: pointer; z-index: 100; transition: all 0.3s; }
.donate-btn:hover { background: var(--accent-green); color: #fff; }

/* Light Page (White Door) */
.door-container { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 80vh; cursor: pointer; }
.white-door { width: 120px; height: 200px; background: rgba(255, 255, 255, 0.9); border-radius: 80px 80px 0 0; position: relative; transition: all 0.6s ease; box-shadow: 0 0 30px rgba(255,255,255,0.3); }
.white-door::before { content: ''; position: absolute; top: 50%; left: 15px; width: 10px; height: 10px; background: #333; border-radius: 50%; }
.door-container:hover .white-door { transform: perspective(500px) rotateY(-30deg); box-shadow: 20px 0 40px rgba(0,0,0,0.5); background: #fff; }
.door-text { margin-top: 2rem; letter-spacing: 0.2em; text-transform: uppercase; font-size: 0.8rem; color: var(--muted); }

/* Brain Heaven Theme */
#brain-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 20000; display: none; overflow-y: auto; background: linear-gradient(135deg, #e0f7fa 0%, #e8f5e9 50%, #fff8e1 100%); font-family: 'Tajawal', sans-serif; color: #2c3e50; }
#brain-container.visible { display: flex; }
.back-btn-heaven { position: fixed; top: 20px; left: 20px; z-index: 20001; background: rgba(255,255,255,0.8); border: none; backdrop-filter: blur(5px); padding: 10px 20px; border-radius: 20px; color: #2e7d32; font-weight: bold; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.back-btn-heaven:hover { background: #fff; transform: translateY(-2px); }
.heaven-layout { display: flex; width: 100%; min-height: 100vh; padding-top: 80px; }
.heaven-sidebar { width: 280px; background: rgba(255, 255, 255, 0.5); backdrop-filter: blur(15px); border-right: 1px solid rgba(255,255,255,0.6); padding: 2rem 1.5rem; display: flex; flex-direction: column; gap: 12px; height: 100vh; position: sticky; top: 0; }
.heaven-logo { font-size: 1.8rem; text-align: center; color: #1b5e20; margin-bottom: 2rem; font-weight: bold; font-family: 'Cormorant Garamond', serif; }
.heaven-cat-btn { background: rgba(255,255,255,0.6); border: none; padding: 14px 20px; border-radius: 16px; text-align: right; cursor: pointer; display: flex; align-items: center; gap: 12px; color: #37474f; transition: all 0.3s; font-size: 1rem; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.heaven-cat-btn:hover { background: rgba(255,255,255,0.9); transform: translateX(-5px); }
.heaven-cat-btn.active { background: #ffffff; color: #1b5e20; font-weight: bold; box-shadow: 0 8px 20px rgba(0,0,0,0.08); border: 1px solid #a5d6a7; }
.heaven-main { flex: 1; padding: 2rem 3rem; display: flex; flex-direction: column; align-items: center; }
.heaven-search-box { width: 100%; max-width: 700px; margin-bottom: 3rem; position: relative; }
.heaven-search-input { width: 100%; padding: 20px 25px 20px 60px; border-radius: 50px; border: none; background: rgba(255,255,255,0.9); font-size: 1.1rem; color: #263238; box-shadow: 0 10px 40px rgba(0,0,0,0.08); transition: all 0.3s; font-family: 'Tajawal', sans-serif; }
.heaven-search-input:focus { outline: none; background: #fff; box-shadow: 0 15px 50px rgba(0,0,0,0.12); transform: translateY(-2px); }
.heaven-search-icon { position: absolute; right: 25px; top: 50%; transform: translateY(-50%); color: #66bb6a; font-size: 1.4rem; }
.heaven-autocomplete { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-radius: 20px; margin-top: 10px; padding: 15px; box-shadow: 0 15px 40px rgba(0,0,0,0.1); display: none; z-index: 100; border: 1px solid rgba(0,0,0,0.05); }
.heaven-autocomplete.show { display: block; }
.heaven-autocomplete-item { padding: 15px; cursor: pointer; border-radius: 12px; margin-bottom: 5px; transition: background 0.2s; text-align: right; }
.heaven-autocomplete-item:hover { background: #f1f8e9; }
.heaven-autocomplete-item q { display: block; font-weight: 600; color: #2e7d32; quotes: none; }
.heaven-autocomplete-item span { display: block; font-size: 0.85rem; color: #78909c; margin-top: 5px; }
.heaven-results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; width: 100%; }
.heaven-card { background: rgba(255,255,255,0.7); backdrop-filter: blur(5px); border-radius: 20px; padding: 2rem; border: 1px solid rgba(255,255,255,0.8); transition: all 0.4s; cursor: pointer; direction: rtl; }
.heaven-card:hover { transform: translateY(-8px); box-shadow: 0 20px 40px rgba(46, 125, 50, 0.15); background: #fff; border-color: #c8e6c9; }
.heaven-card-q { font-size: 1.2rem; font-weight: 700; color: #1b5e20; margin-bottom: 1rem; }
.heaven-card-a { font-size: 0.95rem; color: #546e7a; line-height: 1.7; margin-bottom: 1.5rem; }
.heaven-card-ref { font-size: 0.85rem; color: #81c784; font-weight: bold; text-align: left; }
.heaven-modal-overlay { position: fixed; inset: 0; background: rgba(232, 245, 233, 0.7); backdrop-filter: blur(10px); z-index: 30000; display: none; align-items: center; justify-content: center; padding: 2rem; }
.heaven-modal-overlay.show { display: flex; }
.heaven-modal-box { background: #fff; border-radius: 30px; width: 100%; max-width: 650px; padding: 3rem; position: relative; box-shadow: 0 30px 80px rgba(0,0,0,0.15); animation: slideUp 0.5s ease; border: 1px solid #e0e0e0; }
.heaven-modal-close { position: absolute; top: 20px; left: 20px; background: #f5f5f5; border: none; width: 35px; height: 35px; border-radius: 50%; cursor: pointer; font-size: 1.2rem; line-height: 1; color: #757575; }
.heaven-modal-q { font-size: 1.7rem; color: #2e7d32; margin-bottom: 1.5rem; text-align: center; }
.heaven-modal-a { font-size: 1.1rem; line-height: 2; color: #37474f; text-align: justify; }

@media (max-width: 768px) {
    .heaven-layout { flex-direction: column; }
    .heaven-sidebar { width: 100%; height: auto; flex-direction: row; overflow-x: auto; padding: 1rem; }
    .heaven-cat-btn { min-width: 110px; justify-content: center; }
    .heaven-logo { display: none; }
    .heaven-results-grid { grid-template-columns: 1fr; }
    .heaven-main { padding: 1.5rem; }
    .dragon-body { width: 200px; height: 200px; }
}
