/* Root Variables */
:root {
    --gold: #FFD700;
    --rose: #FFB6C1;
    --purple: #9370DB;
    --deep-purple: #7B68EE;
    --cream: #FFF8DC;
    --white: #FFFFFF;
    --dark: #2C2C2C;
    --gradient-primary: linear-gradient(135deg, var(--rose), var(--purple));
    --gradient-gold: linear-gradient(135deg, var(--gold), #FFA500);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-strong: 0 10px 40px rgba(0, 0, 0, 0.2);
    --font-main: 'Comfortaa', cursive;
    --font-decorative: 'Pacifico', cursive;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    color: var(--dark);
    background: linear-gradient(180deg, var(--cream) 0%, var(--white) 50%, var(--rose) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s;
}

#preloader.hide {
    opacity: 0;
    pointer-events: none;
}

.loader {
    text-align: center;
}

.loader .cake {
    width: 100px;
    height: 120px;
    margin: 0 auto 20px;
    position: relative;
    animation: bounce 1s infinite;
}

.loader .layer {
    width: 100px;
    height: 30px;
    background: var(--cream);
    border-radius: 10px;
    margin-bottom: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.loader .candle {
    width: 10px;
    height: 40px;
    background: var(--gold);
    margin: 10px auto;
    position: relative;
    border-radius: 5px;
}

.loader .candle::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 15px;
    background: radial-gradient(circle, #FF6B6B, #FFA500);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flicker 0.5s infinite;
}

.loader p {
    color: white;
    font-size: 1.2rem;
    font-weight: 300;
}

/* Music Player */
.music-player {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

#music-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-gold);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s, box-shadow 0.3s;
    animation: pulse 2s infinite;
}

#music-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-strong);
}

#music-toggle.playing {
    animation: rotate 3s linear infinite, pulse 2s infinite;
}

/* Floating Elements */
.floating-hearts {
    position: fixed;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.heart {
    position: absolute;
    font-size: 20px;
    animation: floatUp 6s infinite;
    opacity: 0.7;
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* Hero Section */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: var(--gradient-primary);
}

.sparkles {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 10% 20%, white, transparent),
        radial-gradient(2px 2px at 30% 40%, white, transparent),
        radial-gradient(1px 1px at 50% 60%, white, transparent),
        radial-gradient(2px 2px at 70% 80%, white, transparent),
        radial-gradient(1px 1px at 90% 10%, white, transparent);
    background-size: 200% 200%;
    animation: sparkle 3s linear infinite;
}

.balloons {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.balloon {
    position: absolute;
    width: 80px;
    height: 100px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    opacity: 0.9;
}

.balloon::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 100px;
    background: rgba(0, 0, 0, 0.2);
    left: 50%;
    bottom: -100px;
    transform: translateX(-50%);
}

.balloon-1 {
    background: var(--gold);
    left: 10%;
    animation: float 6s infinite ease-in-out;
}

.balloon-2 {
    background: var(--rose);
    left: 30%;
    animation: float 8s infinite ease-in-out 1s;
}

.balloon-3 {
    background: var(--purple);
    right: 30%;
    animation: float 7s infinite ease-in-out 0.5s;
}

.balloon-4 {
    background: var(--deep-purple);
    right: 10%;
    animation: float 9s infinite ease-in-out 1.5s;
}

.hero-content {
    text-align: center;
    z-index: 10;
    position: relative;
    padding: 40px 20px;
}

.birthday-title {
    font-family: var(--font-decorative);
    color: white;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    animation: fadeInScale 1.5s ease-out;
}

.birthday-title .line-1 {
    display: block;
    font-size: clamp(2rem, 6vw, 3.5rem);
    animation: slideInLeft 1s ease-out;
}

.birthday-title .line-2 {
    display: block;
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    color: var(--gold);
    animation: slideInRight 1s ease-out 0.5s both;
}

.hero-subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: white;
    opacity: 0;
    animation: fadeIn 1s ease-out 1.5s forwards;
    margin-top: 20px;
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s infinite;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
}

.scroll-text {
    color: white;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 10px;
    text-align: center;
    white-space: nowrap;
}

.arrow-down {
    width: 30px;
    height: 30px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

/* Gallery Section */
.gallery-section {
    padding: 80px 0;
    background: white;
    position: relative;
}

.section-title {
    font-family: var(--font-decorative);
    font-size: clamp(2rem, 5vw, 3rem);
    text-align: center;
    margin-bottom: 50px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gallery-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: var(--shadow-strong);
}

.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
    background: var(--gradient-primary);
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    aspect-ratio: 4/3;
}

.gallery-item:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-strong);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: white;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s;
}

.gallery-item:hover .gallery-overlay {
    transform: translateY(0);
}

.gallery-overlay p {
    font-size: 1rem;
    font-weight: 300;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
}

.gallery-nav button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    pointer-events: all;
    transition: background 0.3s, transform 0.3s;
    box-shadow: var(--shadow-soft);
}

.gallery-nav button:hover {
    background: white;
    transform: scale(1.1);
}

/* Video Section */
.video-section {
    padding: 80px 0;
    background: linear-gradient(135deg, var(--cream), white);
}

.section-subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: var(--purple);
    margin-bottom: 40px;
    font-weight: 300;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.video-item {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s, box-shadow 0.3s;
}

.video-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-strong);
}

.video-item video {
    width: 100%;
    height: auto;
    display: block;
}

/* Message Section */
.message-section {
    padding: 80px 0;
    background: var(--gradient-primary);
    position: relative;
    overflow: hidden;
}

.message-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
}

.message-card {
    background: white;
    border-radius: 20px;
    padding: 50px;
    box-shadow: var(--shadow-strong);
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.message-title {
    font-family: var(--font-decorative);
    font-size: 2rem;
    color: var(--purple);
    text-align: center;
    margin-bottom: 30px;
}

.message-content {
    animation: typewriter 2s steps(40, end);
}

.message-text {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 20px;
    color: var(--dark);
}

.message-signature {
    font-family: var(--font-decorative);
    font-size: 1.3rem;
    color: var(--purple);
    text-align: right;
    margin-top: 30px;
}

/* Wishes Section */
.wishes-section {
    padding: 80px 0;
    background: white;
    position: relative;
}

.birthday-cake-container {
    text-align: center;
    margin: 50px 0;
}

.birthday-cake {
    width: 200px;
    margin: 0 auto 30px;
    position: relative;
}

.cake-bottom,
.cake-middle,
.cake-top {
    width: 100%;
    border-radius: 10px;
    position: relative;
    box-shadow: var(--shadow-soft);
}

.cake-bottom {
    height: 60px;
    background: linear-gradient(135deg, #8B4513, #D2691E);
}

.cake-middle {
    height: 50px;
    background: linear-gradient(135deg, var(--rose), #FF69B4);
    margin-top: -10px;
}

.cake-top {
    height: 40px;
    background: linear-gradient(135deg, var(--cream), #FFFACD);
    margin-top: -10px;
}

.candles {
    display: flex;
    justify-content: space-around;
    position: absolute;
    top: -40px;
    width: 100%;
}

.candle-group {
    position: relative;
}

.candle-group .candle {
    width: 10px;
    height: 30px;
    background: var(--gold);
    border-radius: 5px;
}

.flame {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #FFA500, #FF6347);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flicker 0.5s infinite alternate;
}

.blow-candles-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-family: var(--font-main);
    background: var(--gradient-gold);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s, box-shadow 0.3s;
}

.blow-candles-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-strong);
}

.floating-wishes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-top: 50px;
}

.wish {
    padding: 10px 20px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 20px;
    font-size: 1rem;
    animation: floatWish 4s infinite ease-in-out;
    box-shadow: var(--shadow-soft);
}

.wish:nth-child(odd) {
    animation-delay: 0.5s;
}

.wish:nth-child(even) {
    animation-delay: 1s;
}

/* Finale Section */
.finale-section {
    padding: 100px 0;
    background: var(--gradient-primary);
    position: relative;
    overflow: hidden;
}

.finale-content {
    text-align: center;
    position: relative;
    z-index: 10;
}

.finale-title {
    font-family: var(--font-decorative);
    font-size: clamp(2.5rem, 7vw, 4rem);
    color: white;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.finale-text {
    font-size: 1.5rem;
    color: white;
    margin-bottom: 40px;
    font-weight: 300;
}

.celebration-btn {
    padding: 20px 50px;
    font-size: 1.5rem;
    font-family: var(--font-main);
    background: white;
    color: var(--purple);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: var(--shadow-strong);
    transition: transform 0.3s, box-shadow 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 15px;
}

.celebration-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

.firework-icon {
    font-size: 2rem;
    animation: rotate 2s linear infinite;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.95);
}

.lightbox.active {
    display: block;
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
    animation: zoomIn 0.5s;
}

.lightbox-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: white;
    padding: 10px 0;
    font-size: 1.2rem;
    margin-top: 20px;
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.lightbox-close:hover {
    color: var(--gold);
}

/* Animations */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    33% { transform: translateY(-20px) rotate(5deg); }
    66% { transform: translateY(-10px) rotate(-3deg); }
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes sparkle {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 200%; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes flicker {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

@keyframes floatWish {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes zoomIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-content {
        padding: 20px;
    }
    
    .gallery-container {
        grid-template-columns: 1fr;
    }
    
    .message-card {
        padding: 30px 20px;
    }
    
    .video-grid {
        grid-template-columns: 1fr;
    }
    
    .birthday-cake {
        transform: scale(0.8);
    }
    
    .floating-wishes {
        gap: 10px;
    }
    
    .wish {
        font-size: 0.9rem;
        padding: 8px 15px;
    }
    
    .gallery-nav button {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .birthday-title .line-1 {
        font-size: 1.8rem;
    }
    
    .birthday-title .line-2 {
        font-size: 2.2rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .celebration-btn {
        padding: 15px 30px;
        font-size: 1.2rem;
    }
    
    .message-text {
        font-size: 1rem;
    }
}

/* Touch-friendly adjustments */
@media (hover: none) {
    .gallery-item:active {
        transform: scale(0.98);
    }
    
    .gallery-overlay {
        transform: translateY(0);
        background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    body {
        background: white;
    }
    
    .section-title {
        color: var(--purple);
        -webkit-text-fill-color: var(--purple);
    }
}

/* Music Prompt Modal */
.music-prompt-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s;
}

.music-prompt-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.music-prompt-content {
    background: white;
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideInScale 0.5s ease-out;
}

.music-prompt-content h2 {
    font-family: var(--font-decorative);
    color: var(--purple);
    font-size: 2rem;
    margin-bottom: 20px;
}

.music-prompt-content p {
    color: var(--dark);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.music-prompt-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.prompt-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-family: var(--font-main);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: var(--shadow-soft);
}

.prompt-yes {
    background: var(--gradient-gold);
    color: white;
    flex: 1;
}

.prompt-no {
    background: #f0f0f0;
    color: var(--dark);
    flex: 1;
}

.prompt-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-strong);
}

@keyframes slideInScale {
    from {
        transform: scale(0.8) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mobile adjustments for music prompt */
@media (max-width: 480px) {
    .music-prompt-content {
        padding: 30px 20px;
    }
    
    .music-prompt-content h2 {
        font-size: 1.5rem;
    }
    
    .music-prompt-buttons {
        flex-direction: column;
    }
    
    .prompt-btn {
        width: 100%;
    }
}