/**
 * Common Styles for Math Games
 *
 * This file contains reusable CSS classes and styles that can be shared
 * across multiple games to maintain consistency.
 */

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.hidden {
    display: none !important;
}

.visible {
    display: flex !important;
}

/* ============================================================================
   BUTTON STYLES
   ============================================================================ */

/* Primary action button (Play Now, Submit, etc.) */
.btn-primary {
    display: inline-block;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

/* Secondary action button (Back, Cancel, etc.) */
.btn-secondary {
    display: inline-block;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    color: #667eea;
    background: white;
    border: 2px solid #667eea;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Danger/Reset button */
.btn-danger {
    display: inline-block;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
    transform: translateY(-2px);
}

/* Small button variant */
.btn-small {
    padding: 8px 20px;
    font-size: 0.9rem;
}

/* ============================================================================
   DIFFICULTY BADGES
   ============================================================================ */

.difficulty-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.difficulty-badge.easy {
    background: linear-gradient(135deg, #38ef7d 0%, #11998e 100%);
    color: white;
}

.difficulty-badge.medium {
    background: linear-gradient(135deg, #F9C74F 0%, #FF6B6B 100%);
    color: #333;
}

.difficulty-badge.hard {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

/* ============================================================================
   CARD STYLES
   ============================================================================ */

.card {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Pulse animation for feedback */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 0.5s ease-in-out;
}

/* Shake animation for wrong answers */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

/* ============================================================================
   FEEDBACK MESSAGES
   ============================================================================ */

.feedback-message {
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    margin: 20px 0;
}

.feedback-message.correct {
    background: linear-gradient(135deg, #38ef7d 0%, #11998e 100%);
    color: white;
}

.feedback-message.incorrect {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    color: white;
}

/* ============================================================================
   FOOTER STYLES (Alpine Component)
   ============================================================================ */

.game-footer {
    padding: 40px 20px;
    text-align: center;
    color: white;
    margin-top: 60px;
}

.game-footer .footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.game-footer .footer-tagline {
    font-size: 1.3rem;
    margin-bottom: 20px;
    font-weight: 600;
    opacity: 0.95;
}

.game-footer .footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.game-footer .footer-separator {
    color: white;
    opacity: 0.6;
    font-size: 1.2rem;
}

.game-footer .footer-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    font-size: 1rem;
    padding: 10px 25px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 25px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
}

.game-footer .footer-link:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Ko-fi footer button styled like footer pills */
.game-footer .footer-kofi {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    font-size: 1rem;
    padding: 10px 20px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 25px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.12);
}

.game-footer .footer-kofi:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.game-footer .footer-kofi .kofi-logo {
    width: 22px;
    height: 22px;
    border-radius: 4px;
}

/* Mobile responsive footer */
@media (max-width: 768px) {
    .game-footer {
        padding: 30px 15px 180px; /* Extra bottom padding for floating buttons */
        margin-top: 40px;
    }

    .game-footer .footer-tagline {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .game-footer .footer-links {
        gap: 8px;
    }

    .game-footer .footer-link {
        font-size: 0.85rem;
        padding: 8px 16px;
        border-width: 1.5px;
    }

    .game-footer .footer-kofi {
        font-size: 0.85rem;
        padding: 8px 14px;
        border-width: 1.5px;
    }

    .game-footer .footer-kofi .kofi-logo {
        width: 20px;
        height: 20px;
    }

    .game-footer .footer-separator {
        font-size: 0.9rem;
        display: none; /* Hide separator on very small screens */
    }
}

@media (max-width: 480px) {
    .game-footer {
        padding-bottom: 200px; /* Even more padding on small phones */
    }

    .game-footer .footer-tagline {
        font-size: 0.9rem;
    }

    .game-footer .footer-link {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .game-footer .footer-links {
        gap: 6px;
    }
}

/* ============================================================================
   PROGRESS BAR STYLES (Alpine Component - Themeable)
   ============================================================================ */

/* CSS Variables for theming - games can override these */
:root {
    --progress-bar-bg: rgba(0, 0, 0, 0.2);
    --progress-bar-border: rgba(255, 255, 255, 0.3);
    --progress-fill-bg: linear-gradient(90deg, #667eea, #764ba2);
    --progress-text-color: white;
}

.progress-bar {
    background: var(--progress-bar-bg);
    border: 2px solid var(--progress-bar-border);
    border-radius: 25px;
    height: 50px;
    position: relative;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-fill {
    background: var(--progress-fill-bg);
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 25px;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--progress-text-color);
    font-weight: bold;
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* ============================================================================
   BACK BUTTON STYLES (Alpine Component)
   ============================================================================ */

.back-button {
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}

.back-button:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* When back button is in a header with flexbox */
.header .back-button {
    align-self: flex-start;
}

.back-button-compact {
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.back-button-compact:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.7);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* ============================================================================
   RESPONSIVE UTILITIES
   ============================================================================ */

@media (max-width: 768px) {
    .btn-primary, .btn-secondary, .btn-danger {
        padding: 12px 30px;
        font-size: 1rem;
    }

    .card {
        padding: 30px 20px;
    }

    .game-footer .footer-tagline {
        font-size: 1.1rem;
    }

    .game-footer .footer-link {
        font-size: 0.9rem;
        padding: 8px 20px;
    }

    .back-button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .progress-bar {
        height: 40px;
    }

    .progress-text {
        font-size: 0.9rem;
    }

    /* Ko-fi Widget Mobile Positioning - Move to top-right on mobile */
    iframe[src*="ko-fi.com"],
    iframe[title*="ko-fi"],
    div[class*="floatingchat"] {
        bottom: auto !important;
        top: 10px !important;
        right: 10px !important;
        transform: scale(0.85) !important;
        transform-origin: top right !important;
    }
}

/* ============================================================================
   ACCESSIBILITY - REDUCED MOTION
   ============================================================================ */

/* Respect user's motion preferences (WCAG 2.1 AAA) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Disable specific animations */
    .fade-in,
    .pulse,
    .shake {
        animation: none !important;
    }

    /* Reduce transform effects */
    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-danger:hover,
    .back-button:hover,
    .back-button-compact:hover,
    .card:hover {
        transform: none !important;
    }
}
