/**
 * Battle Arena Styles
 *
 * Professional styling for Battle Arena mode with animations,
 * responsive design, and unified color scheme.
 *
 * @author LEARNature-ly Team
 * @version 1.0.0
 */

/* ========================================
   Battle Container
   ======================================== */

.battle-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.battle-phase-indicator {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: white;
    backdrop-filter: blur(10px);
}

.phase-label {
    font-weight: 600;
    opacity: 0.9;
}

.phase-value {
    font-weight: 700;
    animation: pulse 2s ease-in-out infinite;
}

.phase-value.phase-change {
    animation: phaseChange 0.5s ease-out;
}

@keyframes phaseChange {
    0%, 100% {
        transform: scale(1);
        color: white;
    }
    50% {
        transform: scale(1.2);
        color: #ffd700;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.battle-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.battle-stats .stat {
    background: rgba(255, 255, 255, 0.15);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.battle-stats .stat-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 5px;
}

.battle-stats .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

/* ========================================
   Battle Area
   ======================================== */

.battle-area {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.question-container {
    text-align: center;
    margin-bottom: 40px;
}

.question-number {
    font-size: 0.9rem;
    font-weight: 600;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.question-text {
    font-size: 3rem;
    font-weight: 700;
    color: #2d3748;
    margin: 20px 0;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    animation: questionAppear 0.4s ease-out;
}

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

/* ========================================
   Answer Options
   ======================================== */

.answer-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.battle-answer-option {
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px;
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d3748;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.battle-answer-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.battle-answer-option:active {
    transform: translateY(-2px);
}

/* ========================================
   Feedback
   ======================================== */

.game-feedback {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

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

.feedback-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    animation: slideUp 0.4s ease-out;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

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

.feedback-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: iconBounce 0.6s ease-out;
}

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

.feedback-text {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: #2d3748;
}

.game-feedback.success .feedback-text {
    color: #48bb78;
}

.game-feedback.error .feedback-text {
    color: #f56565;
}

/* ========================================
   Battle Complete Screen
   ======================================== */

.battle-complete {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.complete-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.6s ease-out;
}

.complete-content h2 {
    font-size: 2.5rem;
    color: #667eea;
    text-align: center;
    margin-bottom: 30px;
    animation: titleAppear 0.8s ease-out;
}

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

/* ========================================
   Battle Results
   ======================================== */

.battle-results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.result-stat {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.result-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #4a5568;
    margin-bottom: 10px;
}

.result-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
}

/* ========================================
   Badges
   ======================================== */

.battle-badges {
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-radius: 12px;
}

.battle-badges h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.badge {
    background: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: badgeAppear 0.5s ease-out;
}

@keyframes badgeAppear {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   Suggestions
   ======================================== */

.battle-suggestions {
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-radius: 12px;
}

.battle-suggestions h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.battle-suggestions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.battle-suggestions li {
    background: white;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    color: #4a5568;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.battle-suggestions li:before {
    content: "💡 ";
    margin-right: 8px;
}

/* ========================================
   Problem Areas
   ======================================== */

.battle-problem-areas {
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    border-radius: 12px;
}

.battle-problem-areas h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.battle-problem-areas ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.battle-problem-areas li {
    background: white;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    color: #4a5568;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.battle-problem-areas li:before {
    content: "📊 ";
    margin-right: 8px;
}

/* ========================================
   Action Buttons
   ======================================== */

.complete-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.complete-actions .btn {
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.complete-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.complete-actions .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.complete-actions .btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.complete-actions .btn-secondary:hover {
    background: #667eea;
    color: white;
    transform: translateY(-3px);
}

/* ========================================
   Streak Effects
   ======================================== */

#battle-streak {
    position: relative;
}

#battle-streak.streak-active {
    animation: streakPulse 1s ease-in-out infinite;
}

@keyframes streakPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        color: #ffd700;
    }
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .battle-header {
        padding: 15px;
    }

    .battle-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .battle-stats .stat {
        padding: 10px;
    }

    .battle-stats .stat-value {
        font-size: 1.2rem;
    }

    .question-text {
        font-size: 2rem;
    }

    .answer-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .battle-answer-option {
        padding: 20px;
        font-size: 1.5rem;
    }

    .complete-content {
        padding: 20px;
    }

    .complete-content h2 {
        font-size: 1.8rem;
    }

    .battle-results-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .result-value {
        font-size: 1.5rem;
    }

    .complete-actions {
        flex-direction: column;
    }

    .complete-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .battle-phase-indicator {
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    .question-text {
        font-size: 1.5rem;
    }

    .battle-answer-option {
        padding: 15px;
        font-size: 1.2rem;
    }

    .battle-results-summary {
        grid-template-columns: 1fr;
    }

    .feedback-icon {
        font-size: 3rem;
    }

    .feedback-text {
        font-size: 1.2rem;
    }
}

/* ========================================
   Accessibility
   ======================================== */

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

/* Focus styles for keyboard navigation */
.battle-answer-option:focus {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

.btn:focus {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .battle-header {
        border: 2px solid white;
    }

    .battle-answer-option {
        border-width: 4px;
    }

    .battle-answer-option:hover {
        border-color: #ffd700;
    }
}

/* ========================================
   Loading States
   ======================================== */

.battle-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.battle-loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .battle-header,
    .complete-actions {
        display: none;
    }

    .battle-complete {
        position: static;
        background: white;
    }

    .complete-content {
        box-shadow: none;
        max-width: 100%;
    }
}
