/* === المتغيرات والألوان === */
:root {
    --bg-color: #0d2a4a;
    --accent-teal: #42b8a7;
    --wave-back-color: #1a4a7a;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-color: #f0f8ff;
    --font-ar: 'Cairo', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-ar);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

/* === تحسين الصور === */
img {
    height: auto;
    max-width: 100%;
}

/* === الخلفية والمشهد === */
.background-scene {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background: linear-gradient(to bottom, #051937, #004d7a);
    pointer-events: none;
}

#stars {
    position: absolute; top: 0; left: 0; width: 100%; height: 60%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #eee, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 40px 70px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 50px 160px, #ddd, rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 150px 100px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 250px 200px, #eee, rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 300px 300px;
    opacity: 0.7;
    animation: twinkle 5s infinite alternate;
}

.moon {
    position: absolute; top: 12%; right: 10%; width: 80px; height: 80px;
    background: #fdfd96; border-radius: 50%; box-shadow: 0 0 50px #fdfd96, 0 0 20px #ffffff;
    opacity: 0.95;
}

.wave {
    position: absolute;
    bottom: -5px; 
    left: 0;
    width: 100%;
    height: 250px; 
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg viewBox='0 0 1440 320' xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none'%3e%3cpath fill='%230a3d62' fill-opacity='0.6' d='M0,192 C480,100 960,280 1440,192 L1440,320 L0,320 Z'/%3e%3cpath fill='%232bcbba' fill-opacity='0.85' d='M0,224 C480,290 960,150 1440,224 L1440,320 L0,320 Z'/%3e%3c/svg%3e");
    background-size: 1440px 250px;
    background-repeat: repeat-x;
    background-position: 0 bottom;
    z-index: 1;
    pointer-events: none;
    animation: waveScroll 15s linear infinite;
}
.wave2, .wave3 { display: none !important; }

@keyframes waveScroll { from { background-position-x: 0; } to { background-position-x: 1440px; } }

.floating-bottle-bg {
    position: absolute; bottom: 160px; right: 15%; width: 80px; opacity: 0.9; z-index: 4;
    animation: float 6s ease-in-out infinite; pointer-events: none;
}

/* === الشريط العلوي (Header) === */
.top-header {
    position: absolute; top: 0; left: 0; width: 100%; height: 70px;
    display: flex; align-items: center; padding: 0 20px; z-index: 100;
    direction: ltr; pointer-events: none;
}
.top-header > * { pointer-events: auto; }
.header-side.left-side { flex: 1; display: flex; justify-content: flex-start; gap: 10px; }
.header-side.right-side { flex: 1; display: flex; justify-content: flex-end; gap: 5px; }
.header-center-logo { flex: 0 0 auto; display: flex; justify-content: center; align-items: center; height: 100%; pointer-events: auto; }
.header-center-logo img {
    display: block; width: auto; max-height: 50px;
    object-fit: contain; filter: drop-shadow(0 0 5px rgba(66, 184, 167, 0.5)); transition: transform 0.3s;
}
.header-center-logo img:hover { transform: scale(1.1); }
.header-btn, #lang-switcher button {
    background: rgba(255, 255, 255, 0.15); border: 1px solid var(--glass-border);
    color: white; padding: 8px 16px; border-radius: 25px; cursor: pointer;
    font-family: var(--font-ar); font-weight: bold; backdrop-filter: blur(5px);
    transition: all 0.3s; pointer-events: auto;
}
.header-btn:hover, #lang-switcher button:hover, #lang-switcher button.active {
    background: var(--accent-teal); border-color: var(--accent-teal);
}

/* === القسم الرئيسي (Hero) === */
.hero-section { 
    position: relative; z-index: 10; padding: 20px; max-width: 800px; margin-top: 80px;
    min-height: 400px; /* لمنع اهتزاز الشاشة */
    display: flex; flex-direction: column; justify-content: center;
}
.title { font-size: 3.5rem; margin-bottom: 10px; font-weight: 900; text-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.subtitle { font-size: 1.4rem; margin-bottom: 20px; opacity: 0.9; }
.privacy-subtitle { font-size: 0.9rem; opacity: 0.6; margin-bottom: 40px; }
.hero-buttons { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.main-btn {
    position: relative; z-index: 20; padding: 15px 40px; font-size: 1.2rem; border: none; border-radius: 50px;
    cursor: pointer; font-family: inherit; font-weight: bold; transition: transform 0.2s, box-shadow 0.2s;
    background-color: var(--accent-teal); color: white; box-shadow: 0 4px 15px rgba(66, 184, 167, 0.4);
    pointer-events: auto;
}
.main-btn.secondary { background-color: transparent; border: 2px solid var(--accent-teal); box-shadow: none; }
.main-btn:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(66, 184, 167, 0.6); }

/* === التصفح والنوافذ === */
#browse-view { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 20; background: rgba(13, 42, 74, 0.9); display: flex; flex-direction: column; align-items: center; }

#continent-filter { 
    margin-top: 150px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 10px; z-index: 30; 
}
.continent-btn { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: #fff; padding: 8px 16px; border-radius: 20px; cursor: pointer; transition: all 0.3s; }
.continent-btn.active { background: var(--accent-teal); border-color: var(--accent-teal); font-weight: bold; }
#bottle-container { flex-grow: 1; width: 100%; position: relative; overflow: hidden; }
.bottle { position: absolute; width: 60px; height: 60px; background-image: url('bottle_icon.webp'); background-size: contain; background-repeat: no-repeat; cursor: pointer; animation: floatBottle 8s ease-in-out infinite; transition: transform 0.3s; }
.bottle:hover { transform: scale(1.2) rotate(10deg); }

/* Modals */
.modal-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: all 0.3s; backdrop-filter: blur(5px); }
.modal-container.show { opacity: 1; visibility: visible; }
.modal-content.wet-glass { background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.3); padding: 30px; border-radius: 20px; width: 90%; max-width: 500px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.5); position: relative; backdrop-filter: blur(20px); }
#message-input, #author-input { width: 100%; background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.2); border-radius: 10px; padding: 15px; color: white; font-family: inherit; font-size: 1rem; margin-bottom: 10px; outline: none; }
#message-input { height: 150px; resize: none; }
#char-counter { text-align: right; font-size: 0.8rem; color: #ccc; margin-bottom: 15px; }
.continent-chooser-title { text-align: right; margin-bottom: 10px; font-weight: bold; }
.continent-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; justify-content: center; }
.main-btn.disabled { background-color: #555; cursor: not-allowed; box-shadow: none; }
.close-btn { position: absolute; top: 15px; right: 15px; background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }
html[dir="ltr"] .close-btn { right: 15px; left: auto; }
.modal-header-title { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 20px; font-size: 1.2rem; font-weight: bold; color: var(--accent-teal); }
.modal-bottle-icon { width: 40px; height: 40px; object-fit: contain; }
#message-text { font-size: 1.1rem; line-height: 1.6; margin-bottom: 20px; white-space: pre-wrap; max-height: 300px; overflow-y: auto; }
.message-author { font-style: italic; color: var(--accent-teal); margin-bottom: 20px; text-align: left; }

.modal-actions { display: flex; flex-direction: column; gap: 15px; margin-top: 20px; }
.modal-actions button { width: 100%; padding: 12px; border-radius: 10px; border: none; cursor: pointer; font-weight: bold; font-family: inherit; font-size: 1rem; }
#close-read-modal { background: var(--accent-teal); color: white; order: 1; box-shadow: 0 4px 15px rgba(66, 184, 167, 0.3); }
#report-btn { background: transparent; color: #e05263; border: 1px solid rgba(224, 82, 99, 0.3); font-size: 0.9rem; order: 2; opacity: 0.7; transition: opacity 0.3s; }
#report-btn:hover { background: rgba(224, 82, 99, 0.1); opacity: 1; }

.link-box { background: rgba(0,0,0,0.3); padding: 10px; border-radius: 5px; word-break: break-all; margin: 15px 0; font-family: monospace; font-size: 0.9rem; user-select: all; }
.contact-links-container { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.contact-link { display: block; background: rgba(255,255,255,0.1); padding: 12px; border-radius: 10px; color: white; text-decoration: none; transition: background 0.3s; }
.contact-link:hover { background: rgba(255,255,255,0.2); }

#install-pwa-btn { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--bg-color); border: 1px solid var(--accent-teal); color: var(--accent-teal); padding: 10px 20px; border-radius: 25px; font-weight: bold; z-index: 50; cursor: pointer; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
#back-to-hero-btn { position: absolute; top: 50%; left: 10px; width: 40px; height: 40px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.2); border-radius: 50%; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; z-index: 40; }
#back-to-hero-btn::after { content: '›'; } 
html[dir="ltr"] #back-to-hero-btn { left: auto; right: 10px; transform: rotate(180deg); }

/* Animations */
@keyframes twinkle { 0%, 100% { opacity: 0.6; } 50% { opacity: 0.3; } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(5deg); } 50% { transform: translateY(-20px) rotate(-5deg); } }
@keyframes floatBottle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.hidden { display: none !important; }
body.modal-open { overflow: hidden; }

/* ========================================= */
/* ===  إضافات المدونة (BLOG STYLES)     === */
/* ========================================= */
.blog-container, .article-container {
    max-width: 1100px; margin: 100px auto 40px; padding: 20px;
    text-align: center; position: relative; z-index: 2;
    overflow-y: auto; max-height: 85vh;
}
.blog-container h1, .article-container h1 { font-size: 2.5rem; color: var(--accent-teal); margin-bottom: 5px; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.blog-container .subtitle { color: #ccc; font-size: 1.1rem; margin-bottom: 40px; }
.posts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 25px; }

.blog-card {
    padding: 25px; text-align: right; display: flex; flex-direction: column; justify-content: space-between;
    min-height: 240px; transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); border-radius: 15px; background: rgba(255, 255, 255, 0.05);
}
.blog-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3); border-color: var(--accent-teal); }
.blog-card h3 { color: #fff; font-size: 1.4rem; margin-bottom: 15px; line-height: 1.4; }
.blog-card .excerpt { color: #ddd; font-size: 0.95rem; line-height: 1.7; margin-bottom: 20px; flex-grow: 1; }

.card-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 15px; }
.card-footer .date { font-size: 0.85rem; color: #aaa; }
.read-more-btn { background: var(--accent-teal); color: #fff; padding: 6px 16px; border-radius: 20px; text-decoration: none; font-size: 0.9rem; font-weight: bold; transition: background 0.3s; }
.read-more-btn:hover { background: #36a090; }

.article-container { max-width: 850px; margin: 110px auto 40px; padding: 40px; text-align: right; color: #fff; border-radius: 15px; position: relative; z-index: 2; overflow-y: auto; max-height: 85vh; }
.article-meta { font-size: 0.9rem; color: #bbb; margin-bottom: 15px; }
.article-divider { border: 0; height: 1px; background: linear-gradient(to left, transparent, rgba(255,255,255,0.3), transparent); margin: 25px 0; }

.content-body { font-size: 1.2rem; line-height: 1.9; color: #e6e6e6; }
.content-body p { margin-bottom: 25px; }
.content-body h2 { color: #fff; margin-top: 40px; margin-bottom: 20px; font-size: 1.6rem; border-right: 4px solid var(--accent-teal); padding-right: 15px; }
.content-body ul, .content-body ol { margin-right: 30px; margin-bottom: 25px; }
.content-body blockquote { background: rgba(255,255,255,0.05); border-right: 3px solid var(--accent-teal); margin: 30px 0; padding: 20px; font-style: italic; color: #ddd; }
.content-body a { color: var(--accent-teal); text-decoration: underline; transition: color 0.2s; }
.content-body a:hover { color: #fff; }

.loading-spinner, .error-msg, .no-posts { text-align: center; color: #ccc; font-size: 1.1rem; grid-column: 1 / -1; padding: 20px; }
.error-msg { color: #ffcccc; }

/* ========================================= */
/* ===  8. MOBILE RESPONSIVE             === */
/* ========================================= */
@media (max-width: 768px) {
    body { position: fixed; width: 100%; height: 100%; overflow: hidden; }
    .top-header { height: 60px; padding: 0 10px; }
    .header-center-logo img { height: 40px; }
    .header-side.left-side { gap: 5px; }
    .header-side.right-side { gap: 5px; }
    .header-btn, #lang-switcher button { padding: 6px 10px; font-size: 0.8rem; }
    
    .hero-section { margin-top: 60px; padding: 10px; }
    .title { font-size: 2.2rem; margin-bottom: 5px; }
    .subtitle { font-size: 1.1rem; margin-bottom: 10px; }
    .privacy-subtitle { font-size: 0.8rem; margin-bottom: 20px; }
    .hero-buttons { flex-direction: column; width: 100%; max-width: 280px; margin: 0 auto; gap: 10px; }
    .main-btn { width: 100%; padding: 10px 30px; font-size: 1rem; }
    
    .moon { width: 50px; height: 50px; top: 12%; right: 5%; }
    .floating-bottle-bg { width: 50px; bottom: 120px; right: 10px; }
    .wave { height: 380px; background-size: 1440px 380px; }
    #install-pwa-btn { bottom: 15px; padding: 8px 16px; font-size: 0.9rem; }

    .blog-container, .article-container {
        margin-top: 90px; width: 95%; padding: 20px; max-height: 80vh;
    }
    .article-container h1 { font-size: 1.6rem; }
    .content-body { font-size: 1.05rem; }
}