/* Mobile Utilities CSS - Kid-friendly Learning App */
/* ملف الأدوات المساعدة للجوال - تطبيق التعلم الصديق للأطفال */

/* Mobile-first approach utilities */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none !important;
    }
}

/* Touch-friendly button enhancements */
.touch-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-yellow) 100%);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 159, 67, 0.4);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.touch-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(255, 159, 67, 0.3);
}

.touch-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.touch-btn:active::before {
    width: 200px;
    height: 200px;
}

/* Kid-friendly card animations */
.kid-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 3px solid var(--primary-yellow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kid-card::before {
    content: '✨';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.2rem;
    opacity: 0.7;
    animation: sparkle 2s infinite;
}

.kid-card:hover,
.kid-card:focus {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-orange);
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.7; }
    50% { transform: scale(1.2) rotate(180deg); opacity: 1; }
}

/* Mobile navigation menu */
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-yellow) 100%);
    padding: 80px 20px 20px;
    transition: right 0.3s ease;
    z-index: 999;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
}

.mobile-nav.active {
    right: 0;
}

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-item {
    display: block;
    padding: 15px 20px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 15px;
    transition: all 0.3s ease;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.mobile-nav-item:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-5px);
}

/* Fun loading spinner for mobile */
.mobile-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 20px;
}

.mobile-loading-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: mobileBounce 1.4s ease-in-out infinite both;
}

.mobile-loading-dot:nth-child(1) { 
    background: var(--primary-pink); 
    animation-delay: -0.32s; 
}
.mobile-loading-dot:nth-child(2) { 
    background: var(--primary-yellow); 
    animation-delay: -0.16s; 
}
.mobile-loading-dot:nth-child(3) { 
    background: var(--primary-green); 
}

@keyframes mobileBounce {
    0%, 80%, 100% { 
        transform: scale(0.8); 
        opacity: 0.5; 
    }
    40% { 
        transform: scale(1.3); 
        opacity: 1; 
    }
}

/* Mobile success celebration */
.mobile-success {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-teal) 100%);
    color: white;
    padding: 30px;
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    animation: mobileSuccessPopIn 0.6s ease-out;
}

.mobile-success i {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
    animation: mobileSuccessBounce 1s ease-in-out infinite alternate;
}

@keyframes mobileSuccessPopIn {
    0% { 
        transform: translate(-50%, -50%) scale(0.5) rotate(-180deg);
        opacity: 0;
    }
    100% { 
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes mobileSuccessBounce {
    0% { transform: scale(1) rotate(-5deg); }
    100% { transform: scale(1.1) rotate(5deg); }
}

/* Mobile-friendly form controls */
.mobile-input {
    width: 100%;
    padding: 15px;
    font-size: 16px; /* Prevents zoom on iOS */
    border: 2px solid var(--primary-yellow);
    border-radius: 15px;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mobile-input:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 6px 20px rgba(255, 159, 67, 0.3);
    transform: translateY(-2px);
}

/* Mobile game controls */
.mobile-game-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100;
}

@media (max-width: 480px) {
    .mobile-game-controls {
        width: calc(100% - 40px);
        flex-direction: column;
        gap: 10px;
    }
}

/* Pull to refresh indicator */
.pull-refresh-indicator {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-green);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transition: top 0.3s ease;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pull-refresh-indicator i {
    animation: spin 1s linear infinite;
}

/* Mobile notification toast */
.mobile-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-yellow) 100%);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    z-index: 1002;
    animation: toastSlideUp 0.4s ease-out;
    max-width: calc(100% - 40px);
    text-align: center;
}

@keyframes toastSlideUp {
    0% {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Mobile-specific utilities */
@media (max-width: 768px) {
    .mobile-full-width { width: 100% !important; }
    .mobile-text-center { text-align: center !important; }
    .mobile-hidden { display: none !important; }
    .mobile-visible { display: block !important; }
    .mobile-stack { flex-direction: column !important; }
    .mobile-no-gap { gap: 0 !important; }
    .mobile-small-gap { gap: 10px !important; }
    .mobile-padding { padding: 15px !important; }
    .mobile-margin { margin: 10px !important; }
    .mobile-border-radius { border-radius: 15px !important; }
    
    /* Mobile text sizes */
    .mobile-text-sm { font-size: 0.875rem !important; }
    .mobile-text-base { font-size: 1rem !important; }
    .mobile-text-lg { font-size: 1.125rem !important; }
    .mobile-text-xl { font-size: 1.25rem !important; }
    
    /* Mobile spacing */
    .mobile-mt-2 { margin-top: 0.5rem !important; }
    .mobile-mb-2 { margin-bottom: 0.5rem !important; }
    .mobile-py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
    .mobile-px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
}

/* High contrast mode for accessibility */
@media (prefers-contrast: high) {
    .kid-card,
    .touch-btn,
    .mobile-nav-item {
        border: 3px solid currentColor !important;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .sparkle,
    .mobile-success i,
    .mobile-loading-dot {
        animation: none !important;
    }
    
    .kid-card,
    .touch-btn {
        transition: none !important;
    }
}