/* Design System & Base Settings */
:root {
    --bg-primary: #0a0513;
    --bg-secondary: #1a0f30;
    --primary-color: #ff2a5f;
    --secondary-color: #ec4899;
    --accent-color: #f43f5e;
    --gold: #f59e0b;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(26, 15, 48, 0.45);
    --glass-border: rgba(255, 42, 95, 0.25);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --font-arabic: 'Cairo', sans-serif;
    --font-serif: 'Playfair Display', serif;
    --font-cursive: 'Great Vibes', cursive;
}

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

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(255, 42, 95, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(245, 158, 11, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.15) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(168, 85, 247, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-light);
    font-family: var(--font-arabic);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Canvas overlay for particle effect */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

/* -------------------------------------------------------------
   GIFT OVERLAY SCREEN
---------------------------------------------------------------- */
.gift-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #1e113a 0%, #0c061a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.8s cubic-bezier(0.77, 0, 0.175, 1), visibility 0.8s;
}

.gift-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.gift-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    text-align: center;
    padding: 2rem;
}

.gift-instruction {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-light);
    text-shadow: 0 0 10px rgba(255, 42, 95, 0.6);
    line-height: 1.5;
}

.gift-instruction span {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* Beautiful Glowing Gift Box */
.gift-box {
    position: relative;
    width: 160px;
    height: 160px;
    cursor: pointer;
    filter: drop-shadow(0 0 20px rgba(255, 42, 95, 0.4));
    transform-origin: bottom center;
}

/* Shaking animation on click/hover suggestion */
.gift-box.shake {
    animation: gift-shake 0.6s infinite alternate cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.gift-box.open {
    animation: gift-pop-open 1.2s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Gift Box Ribbon Loops (Bow on Top) */
.ribbon-loop-left, .ribbon-loop-right {
    position: absolute;
    top: -24px;
    width: 45px;
    height: 35px;
    border: 8px solid var(--primary-color);
    border-radius: 50% 50% 0 50%;
    transform-origin: bottom right;
    z-index: 10;
}

.ribbon-loop-left {
    left: 42px;
    transform: rotate(-35deg);
}

.ribbon-loop-right {
    right: 42px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(35deg);
    transform-origin: bottom left;
}

/* Lid */
.gift-lid {
    position: absolute;
    top: 0;
    left: -5px;
    width: 170px;
    height: 35px;
    background: #ff477e;
    border-radius: 4px;
    z-index: 5;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.8s cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

.lid-ribbon {
    position: absolute;
    left: 50%;
    top: 0;
    width: 26px;
    height: 100%;
    background: var(--gold);
    transform: translateX(-50%);
}

/* Box Body */
.gift-body {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 160px;
    height: 128px;
    background: #e11d48;
    border-radius: 0 0 8px 8px;
    z-index: 2;
    overflow: hidden;
    transition: transform 0.8s cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

.body-ribbon {
    position: absolute;
    left: 50%;
    top: 0;
    width: 26px;
    height: 100%;
    background: var(--gold);
    transform: translateX(-50%);
    box-shadow: inset 0 0 5px rgba(0,0,0,0.15);
}

/* Animations for Gift Box */
@keyframes gift-shake {
    0% { transform: rotate(-5deg) scale(1); }
    100% { transform: rotate(5deg) scale(1.05); }
}

@keyframes gift-pop-open {
    0% { transform: scale(1); }
    20% { transform: scale(0.9) rotate(-3deg); }
    50% { transform: scale(1.1) rotate(3deg); }
    100% { transform: scale(0); opacity: 0; }
}

/* When opening, the lid and ribbon fly away */
.gift-box.open .gift-lid {
    transform: translateY(-80px) rotate(-15deg);
    opacity: 0;
}

.gift-box.open .ribbon-loop-left,
.gift-box.open .ribbon-loop-right {
    transform: translateY(-90px) rotate(45deg) scale(0);
    opacity: 0;
    transition: transform 0.8s, opacity 0.8s;
}

/* -------------------------------------------------------------
   FLOATING AUDIO TOGGLE
---------------------------------------------------------------- */
.audio-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(10, 5, 19, 0.6);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.audio-toggle:active {
    transform: scale(0.9);
}

.audio-toggle.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px);
}

/* Spin animation for record */
.vinyl-record {
    position: relative;
    width: 44px;
    height: 44px;
    background: #111;
    border-radius: 50%;
    border: 2px solid #222;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: spin 3.5s linear infinite;
    animation-play-state: paused;
}

.audio-toggle.playing .vinyl-record {
    animation-play-state: running;
}

.vinyl-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    opacity: 0.85;
}

.vinyl-center {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--bg-primary);
    border-radius: 50%;
    border: 2.5px solid var(--gold);
}

/* Small waveform animation at bottom of button */
.music-wave {
    position: absolute;
    bottom: -6px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
}

.music-wave span {
    width: 2.5px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 1px;
    transition: height 0.3s ease;
}

.audio-toggle.playing .music-wave span {
    animation: wave-bounce 1s ease-in-out infinite alternate;
}

.audio-toggle.playing .music-wave span:nth-child(2) {
    animation-delay: 0.2s;
    background-color: var(--secondary-color);
}

.audio-toggle.playing .music-wave span:nth-child(3) {
    animation-delay: 0.4s;
    background-color: var(--gold);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes wave-bounce {
    0% { height: 3px; }
    100% { height: 12px; }
}

/* -------------------------------------------------------------
   MAIN CONTENT AREA
---------------------------------------------------------------- */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 480px; /* Perfect Mobile Width */
    margin: 0 auto;
    padding: 5rem 1.5rem 4rem 1.5rem;
    gap: 3rem;
    transition: opacity 1s ease, transform 1s ease;
}

.main-content.hidden {
    opacity: 0;
    transform: translateY(30px);
    pointer-events: none;
}

/* Header */
.header {
    text-align: center;
    width: 100%;
}

.english-title {
    font-family: var(--font-cursive);
    font-size: 3.5rem;
    color: var(--gold);
    text-shadow: 0 2px 10px rgba(245, 158, 11, 0.4);
    margin-bottom: -0.5rem;
    letter-spacing: 1px;
    line-height: 1;
}

.arabic-title {
    font-family: var(--font-arabic);
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-light);
    text-shadow: 0 4px 12px rgba(255, 42, 95, 0.5);
    margin-top: 0.5rem;
}

.sender-tag {
    font-family: var(--font-cursive);
    font-size: 1.9rem;
    color: #e2e8f0;
    text-shadow: 0 2px 8px rgba(255, 42, 95, 0.4);
    margin-top: 0.2rem;
    letter-spacing: 1px;
}

/* Glowing text animation */
.animate-rainbow {
    background: linear-gradient(to right, #ff2a5f, #ec4899, #f59e0b, #ec4899, #ff2a5f);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine-gradient 3s linear infinite;
}

@keyframes shine-gradient {
    to { background-position: 200% center; }
}

/* -------------------------------------------------------------
   POLAROID CARD SECTION
---------------------------------------------------------------- */
.photo-section {
    display: flex;
    justify-content: center;
    width: 100%;
}

.polaroid-wrapper {
    position: relative;
    padding: 10px;
    perspective: 1000px;
}

.polaroid-card {
    background: #ffffff;
    padding: 12px 12px 24px 12px;
    border-radius: 4px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(255, 42, 95, 0.2);
    transform: rotate(-3deg);
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    width: 250px;
    position: relative;
    overflow: hidden;
    animation: polaroid-float 6s ease-in-out infinite alternate;
}

.polaroid-card:hover, .polaroid-card:active {
    transform: rotate(1deg) scale(1.03);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 50px rgba(255, 42, 95, 0.4);
}

.photo-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, transparent 60%);
    pointer-events: none;
    z-index: 2;
}

.birthday-photo {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 2px;
    border: 1px solid #eee;
}

.polaroid-caption {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-family: var(--font-arabic);
}

.caption-date {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
}

.caption-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Polaroid floating animation */
@keyframes polaroid-float {
    0% { transform: translateY(0px) rotate(-3deg); }
    100% { transform: translateY(-12px) rotate(-1deg); }
}

/* Floating Stickers on Polaroid */
.sticker {
    position: absolute;
    font-size: 1.8rem;
    z-index: 5;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.3));
    animation: sticker-wiggle 3s ease-in-out infinite alternate;
}

.sticker-heart {
    top: -15px;
    right: -10px;
    animation-delay: 0.2s;
}

.sticker-sparkle {
    bottom: 25px;
    left: -15px;
    font-size: 1.6rem;
    animation-delay: 0.5s;
}

.sticker-star {
    top: 50%;
    right: -20px;
    font-size: 1.5rem;
    animation-delay: 0.9s;
}

@keyframes sticker-wiggle {
    0% { transform: scale(1) rotate(-10deg); }
    100% { transform: scale(1.15) rotate(10deg); }
}

/* -------------------------------------------------------------
   MESSAGE & BADGE SECTION
---------------------------------------------------------------- */
.message-section {
    width: 100%;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 42, 95, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.special-message {
    font-size: 1.25rem;
    line-height: 1.8;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.age-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 0.6rem 1.8rem;
    font-size: 1.15rem;
    font-weight: 800;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 42, 95, 0.4);
    animation: pulse-badge 2s infinite alternate;
}

.age-number {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-style: italic;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin: 0 0.2rem;
}

@keyframes pulse-badge {
    0% { transform: scale(1); box-shadow: 0 4px 15px rgba(255, 42, 95, 0.4); }
    100% { transform: scale(1.06); box-shadow: 0 6px 22px rgba(255, 42, 95, 0.6); }
}

/* -------------------------------------------------------------
   INTERACTIVE BIRTHDAY CAKE
---------------------------------------------------------------- */
.cake-section {
    width: 100%;
    display: flex;
    justify-content: center;
}

.cake-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.cake-instruction {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
    animation: flash 2s infinite;
}

.cake-container {
    position: relative;
    width: 180px;
    height: 180px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

/* Candle */
.candle {
    position: absolute;
    bottom: 95px;
    width: 8px;
    height: 35px;
    background: linear-gradient(to right, #e2e8f0, #cbd5e1);
    border-radius: 2px;
    z-index: 10;
}

.candle::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 3px;
    width: 2px;
    height: 6px;
    background: #475569;
}

/* Glowing Candle Flame */
.flame {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 20px;
    background: radial-gradient(circle at center, #fff 20%, #f59e0b 60%, #ef4444 100%);
    border-radius: 50% 50% 20% 20% / 60% 60% 40% 40%;
    box-shadow: 0 0 10px #f59e0b, 0 0 20px #ef4444;
    animation: flame-flicker 0.15s ease-in-out infinite alternate;
    transform-origin: bottom center;
}

.flame.extinguished {
    display: none;
}

/* Candle smoke animation */
.smoke {
    position: absolute;
    top: -12px;
    left: 2px;
    width: 4px;
    height: 0;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
}

.smoke.active {
    animation: blow-smoke 1.5s forwards ease-out;
}

/* CSS Cake Layers */
.cake-base {
    position: relative;
    width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
}

.cake-layer {
    position: relative;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    box-shadow: inset 0 -5px 0 rgba(0,0,0,0.1);
}

.layer-top {
    width: 90px;
    height: 35px;
    background: #f472b6; /* Pink cake */
}

/* Cream Dripping Details */
.frosting {
    position: absolute;
    top: 0;
    width: 100%;
    height: 10px;
    background: #ffffff; /* White frosting */
    border-radius: 4px 4px 0 0;
}

.drip {
    position: absolute;
    top: 8px;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-radius: 50%;
}

.drip:nth-child(2) { left: 10px; height: 12px; }
.drip:nth-child(3) { left: 35px; height: 15px; }
.drip:nth-child(4) { left: 60px; height: 11px; }
.drip:nth-child(5) { left: 80px; height: 13px; }

.layer-middle {
    width: 115px;
    height: 40px;
    background: #f43f5e; /* Rose layer */
    margin-top: -2px;
}

.cream-fill {
    position: absolute;
    top: 0;
    width: 100%;
    height: 6px;
    background: #ffffff;
}

.layer-bottom {
    width: 140px;
    height: 45px;
    background: #be123c; /* Deep red base */
    margin-top: -2px;
}

/* Sprinkles on the cake */
.sprinkle {
    position: absolute;
    width: 6px;
    height: 3px;
    border-radius: 2px;
}

.layer-top .sprinkle:nth-child(6) { top: 18px; left: 20px; background: #fbbf24; transform: rotate(15deg); }
.layer-top .sprinkle:nth-child(7) { top: 22px; left: 45px; background: #60a5fa; transform: rotate(-35deg); }
.layer-top .sprinkle:nth-child(8) { top: 16px; left: 65px; background: #34d399; transform: rotate(45deg); }

.layer-middle .sprinkle:nth-child(2) { top: 15px; left: 30px; background: #fbbf24; transform: rotate(20deg); }
.layer-middle .sprinkle:nth-child(3) { top: 25px; left: 80px; background: #ffffff; transform: rotate(-10deg); }

/* Cake Stand */
.cake-stand {
    width: 160px;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 4;
}

/* Cake Animations */
@keyframes flame-flicker {
    0% { transform: translateX(-50%) scale(1) rotate(-1deg); }
    100% { transform: translateX(-50%) scale(1.08) rotate(1deg); }
}

@keyframes blow-smoke {
    0% { height: 0; opacity: 1; transform: translateY(0) scaleX(1); }
    50% { height: 20px; opacity: 0.6; transform: translateY(-10px) scaleX(1.5); }
    100% { height: 35px; opacity: 0; transform: translateY(-25px) scaleX(2); }
}

@keyframes flash {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; color: var(--gold); }
}

/* -------------------------------------------------------------
   BALLOON FLOATING SYSTEM
---------------------------------------------------------------- */
.balloon-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

.balloon {
    position: absolute;
    bottom: -150px;
    width: 60px;
    height: 75px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    pointer-events: auto; /* Allow users to click/tap them! */
    cursor: pointer;
    box-shadow: inset -5px -5px 10px rgba(0, 0, 0, 0.15), 0 8px 20px rgba(0, 0, 0, 0.15);
    animation: float-up 10s linear forwards;
    transform-origin: bottom center;
}

/* Thread attached to balloon */
.balloon::before {
    content: "";
    position: absolute;
    bottom: -12px;
    left: 28px;
    width: 4px;
    height: 4px;
    background: inherit;
    border-radius: 0 0 2px 2px;
    clip-path: polygon(25% 0%, 75% 0%, 100% 100%, 0% 100%);
}

.balloon::after {
    content: "";
    position: absolute;
    bottom: -45px;
    left: 29px;
    width: 1.5px;
    height: 35px;
    background: rgba(255, 255, 255, 0.35);
}

/* Colors for balloons */
.balloon.pink { background: rgba(244, 63, 94, 0.85); border: 1px solid #f43f5e; }
.balloon.gold { background: rgba(245, 158, 11, 0.85); border: 1px solid #f59e0b; }
.balloon.purple { background: rgba(168, 85, 247, 0.85); border: 1px solid #a855f7; }
.balloon.blue { background: rgba(59, 130, 246, 0.85); border: 1px solid #3b82f6; }
.balloon.green { background: rgba(16, 185, 129, 0.85); border: 1px solid #10b981; }

/* Balloon pop animation */
.balloon.popped {
    animation: pop-burst 0.25s forwards ease-out !important;
    pointer-events: none;
}

@keyframes float-up {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    33% {
        transform: translateY(-33vh) translateX(20px) rotate(4deg);
    }
    66% {
        transform: translateY(-66vh) translateX(-20px) rotate(-4deg);
    }
    100% {
        transform: translateY(-110vh) translateX(5px) rotate(2deg);
    }
}

@keyframes pop-burst {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.8; }
    100% { transform: scale(0); opacity: 0; }
}

/* -------------------------------------------------------------
   EMOJI FLOAT SYSTEM
---------------------------------------------------------------- */
.floating-emoji {
    position: fixed;
    font-size: 2rem;
    pointer-events: none;
    z-index: 15;
    animation: emoji-float 8s linear forwards;
    will-change: transform, opacity;
}

@keyframes emoji-float {
    0% {
        transform: translateY(105vh) rotate(0deg) scale(0.6);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-10vh) rotate(360deg) scale(1.2);
        opacity: 0;
    }
}

/* -------------------------------------------------------------
   FOOTER SECTION
---------------------------------------------------------------- */
.footer {
    text-align: center;
    padding: 1.5rem;
    width: 100%;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(10, 5, 19, 0.8);
    transition: opacity 1s ease;
}

.footer.hidden {
    opacity: 0;
}
