/* --- أساسيات --- */
:root {
    --primary: #d32f2f;
    --pink-gradient: linear-gradient(to right, #ee9ca7, #ffdde1);
}

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background: var(--pink-gradient);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* --- الصفحات --- */
.page {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.8s ease-in-out;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
}
.page.active { opacity: 1; visibility: visible; transform: scale(1); z-index: 10; }
.hidden { display: none !important; }

/* --- المحتوى --- */
.content-box {
    background: rgba(255,255,255,0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    max-width: 90%;
}
input { padding: 10px; border-radius: 5px; border: 1px solid #ccc; text-align: center; font-size: 16px; margin: 10px 0; }
.error { color: red; font-size: 0.9rem; margin-top: 5px; }

/* --- معرض الصور (Gallery) --- */
.gallery {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px;
    max-height: 60vh;
    overflow-y: auto;
    width: 95%;
}
.gallery img {
    width: 80px; /* حجم صغير عشان يسيع الـ 10 صور */
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    opacity: 0;
    animation: popIn 0.5s forwards;
    animation-delay: calc(var(--i) * 0.1s);
    transition: transform 0.3s;
}
.gallery img:hover { transform: scale(1.1); }
@keyframes popIn { to { opacity: 1; } }

/* --- Lightbox (تكبير الصور) --- */
.lightbox {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none; justify-content: center; align-items: center;
    z-index: 2000; cursor: pointer;
}
.lightbox img { max-width: 90%; max-height: 90%; border-radius: 10px; box-shadow: 0 0 20px rgba(255,255,255,0.2); }
.close-btn { position: absolute; top: 20px; right: 30px; font-size: 40px; color: white; }

/* --- الأزرار --- */
button, .nav-btn {
    background: var(--primary); color: white; border: none; padding: 10px 25px;
    border-radius: 50px; font-size: 1.1rem; cursor: pointer; margin-top: 15px;
    box-shadow: 0 5px 15px rgba(211, 47, 47, 0.3);
}

/* --- الكروت (Flip Cards) --- */
.cards-container { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; }
.card { width: 100px; height: 140px; perspective: 1000px; cursor: pointer; }
.card-inner { position: relative; width: 100%; height: 100%; text-align: center; transition: transform 0.6s; transform-style: preserve-3d; }
.card.flipped .card-inner { transform: rotateY(180deg); }
.card-front, .card-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; align-items: center; justify-content: center; border-radius: 10px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.card-front { background: white; color: var(--primary); font-weight: bold; }
.card-back { background: var(--primary); color: white; transform: rotateY(180deg); font-size: 0.8rem; padding: 5px; font-weight: bold; }

/* --- الظرف --- */
.envelope-wrapper { position: relative; cursor: pointer; transition: transform 0.5s; margin-top: 20px; }
.envelope-wrapper:hover { transform: scale(1.05); }
.envelope { width: 300px; height: 200px; background: #ff5e6c; position: relative; border-radius: 0 0 10px 10px; }
.envelope::before { content: ""; position: absolute; top: 0; border-left: 150px solid transparent; border-right: 150px solid transparent; border-top: 130px solid #ff3b4e; transform-origin: top; transition: 0.6s; z-index: 3; }
.letter { position: absolute; bottom: 0; left: 15px; width: 270px; height: 180px; background: white; padding: 20px; transition: 0.6s; z-index: 2; text-align: center; overflow-y: auto; border-radius: 5px; box-sizing: border-box; }
.text { font-family: 'Cairo', sans-serif; font-size: 1rem; line-height: 1.6; }
.heart-seal { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -60%); z-index: 4; font-size: 25px; background: white; border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }

/* فتح الظرف */
.envelope-wrapper.open .envelope::before { transform: rotateX(180deg); z-index: 1; }
.envelope-wrapper.open .letter { transform: translateY(-100px); z-index: 3; }
.envelope-wrapper.open .heart-seal { display: none; }

/* --- الخلفية --- */
.timer { background: white; padding: 5px 15px; border-radius: 20px; display: inline-block; margin-bottom: 10px; font-weight: bold; color: #333; }
.hearts-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.floating-heart { position: absolute; animation: float 6s linear infinite; opacity: 0.7; bottom: -50px; }
@keyframes float { to { transform: translateY(-110vh); opacity: 0; } }
.music-control { font-size: 3rem; color: var(--primary); cursor: pointer; animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }