/* Safwan's World - Custom Styles */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&display=swap');

/* Base Styles */
* {
    font-family: 'Fredoka', sans-serif;
}

/* Space Theme - Star Field */
.stars-container {
    background-image:
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, white, transparent),
        radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 230px 80px, white, transparent),
        radial-gradient(2px 2px at 300px 150px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 370px 50px, white, transparent),
        radial-gradient(2px 2px at 450px 180px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 520px 90px, white, transparent),
        radial-gradient(2px 2px at 600px 200px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 680px 60px, white, transparent),
        radial-gradient(2px 2px at 750px 140px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 820px 100px, white, transparent),
        radial-gradient(2px 2px at 900px 220px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 980px 70px, white, transparent),
        radial-gradient(2px 2px at 1050px 160px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 1120px 40px, white, transparent),
        radial-gradient(2px 2px at 1200px 190px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 1280px 110px, white, transparent),
        radial-gradient(2px 2px at 1350px 170px, rgba(255,255,255,0.9), transparent);
    background-size: 100% 100%;
    animation: twinkle 4s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #4f46e5, #9333ea);
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Floating Animation */
.float-animation {
    animation: float 6s ease-in-out infinite;
}

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

/* Floating Background Elements */
.floating-element {
    animation: floatElement 8s ease-in-out infinite;
}

@keyframes floatElement {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-30px) rotate(5deg);
    }
    50% {
        transform: translateY(-15px) rotate(-5deg);
    }
    75% {
        transform: translateY(-25px) rotate(3deg);
    }
}

/* Wave Animation */
.wave-animation {
    animation: wave 2.5s ease-in-out infinite;
    transform-origin: 70% 70%;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(14deg); }
    20% { transform: rotate(-8deg); }
    30% { transform: rotate(14deg); }
    40% { transform: rotate(-4deg); }
    50% { transform: rotate(10deg); }
    60% { transform: rotate(0deg); }
}

/* Bounce Animation */
.bounce-animation {
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-15px); }
    60% { transform: translateY(-7px); }
}

/* Wiggle Animation */
.wiggle-animation {
    animation: wiggle 3s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* Tag Animation */
.tag-animation {
    animation: tagPop 0.5s ease-out forwards;
    opacity: 0;
    transform: scale(0.8) translateY(10px);
}

@keyframes tagPop {
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Card Hover Effects */
.card-hover {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

/* Stat Card Animation */
.stat-card {
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: scale(1.05);
}

/* Navigation Button Styles */
.nav-btn {
    position: relative;
    color: #6b7280;
    background: transparent;
}

.nav-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-btn:hover {
    color: #6366f1;
}

.nav-btn:hover::after {
    width: 80%;
}

.nav-btn.active {
    color: #6366f1;
    background: linear-gradient(135deg, #eef2ff, #fae8ff);
}

.nav-btn.active::after {
    width: 80%;
}

/* Year Button Styles */
.year-btn {
    position: relative;
    overflow: hidden;
}

.year-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s ease;
}

.year-btn:hover::before {
    left: 100%;
}

.year-btn.active {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    transform: scale(1.05);
}

/* Category Button Styles */
.category-btn {
    position: relative;
    overflow: hidden;
}

.category-btn.active {
    background: linear-gradient(135deg, #6366f1, #a855f7) !important;
    color: white !important;
    transform: scale(1.05);
}

/* Section Transitions */
.section-content {
    animation: fadeInUp 0.5s ease-out;
}

.hidden-section {
    display: none !important;
}

.active-section {
    display: block;
}

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

/* Photo/Art Card Styles */
.gallery-card {
    position: relative;
    overflow: hidden;
}

.gallery-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.gallery-card:hover::before {
    opacity: 1;
}

.gallery-card img {
    transition: transform 0.5s ease;
}

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

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    animation: modalFadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    z-index: 1001;
    animation: modalSlideUp 0.4s ease;
}

.close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1002;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.close-btn:hover {
    background: #f3f4f6;
    transform: rotate(90deg);
}

/* Modal Navigation Buttons */
.modal-nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1002;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.modal-nav-btn:hover {
    background: #6366f1;
    transform: translateY(-50%) scale(1.1);
}

.modal-nav-btn:hover svg {
    color: white;
}

.modal-nav-btn svg {
    color: #6366f1;
    transition: color 0.3s ease;
}

.modal-prev-btn {
    left: 20px;
}

.modal-next-btn {
    right: 20px;
}

.modal-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.modal-nav-btn:disabled:hover {
    background: white;
    transform: translateY(-50%);
}

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

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Comment Styles */
.comment-item {
    animation: commentSlide 0.3s ease-out;
}

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

/* Game Styles */
.memory-card {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.25rem;
}

.memory-card:hover {
    transform: scale(1.1);
}

.memory-card.flipped {
    background: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.memory-card.matched {
    background: linear-gradient(135deg, #10b981, #34d399);
    animation: matchPulse 0.5s ease;
}

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

/* Reaction Box Animation */
.reaction-waiting {
    animation: pulse 1s ease-in-out infinite;
}

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

/* Slot Machine Animation */
.slot-spin {
    animation: slotSpin 0.5s ease-out;
}

@keyframes slotSpin {
    0% { transform: translateY(-100%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Guess Button Animation */
.guess-btn {
    transition: all 0.2s ease;
}

.guess-btn:hover {
    transform: scale(1.15);
}

.guess-btn:active {
    transform: scale(0.95);
}

/* Confetti Animation */
.confetti {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-bottom: 8px;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .float-animation {
        animation-duration: 4s;
    }

    .card-hover:hover {
        transform: translateY(-4px);
    }

    .floating-element {
        display: none;
    }
}

/* Print Styles */
@media print {
    .nav, .modal, #games {
        display: none !important;
    }

    body {
        background: white !important;
    }
}

/* Favorite Things Hover Animation */
.favorite-item {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
}

.favorite-item:hover {
    transform: translateY(-15px) scale(1.15);
    background: rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.favorite-item:hover .text-4xl {
    animation: favoriteEmojiBounce 0.6s ease-in-out;
    display: inline-block;
}

@keyframes favoriteEmojiBounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.3) rotate(-15deg); }
    50% { transform: scale(1.4) rotate(15deg); }
    75% { transform: scale(1.3) rotate(-10deg); }
}

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