/**
 * Tamil Letter Tap Challenge - Stylesheet
 * Version: 1.0.0
 * Description: Styles for fast-paced letter recognition game
 */

/* ==========================================
   MAIN WRAPPER
   ========================================== */
.tamil-letter-tap-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Error Message */
.tlt-error {
    background: #fee;
    border: 2px solid #f88;
    border-radius: 10px;
    padding: 15px;
    color: #c33;
    font-weight: 600;
}

/* ==========================================
   INSTRUCTIONS ACCORDION SECTION
   ========================================== */
.tlt-instructions-container {
    max-width: 900px;
    margin: 20px auto 30px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background: white;
    padding: 20px;
}

.tlt-instruction-accordion {
    margin-bottom: 15px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.tlt-accordion-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.tlt-instruction-accordion[data-lang="tamil"] .tlt-accordion-header {
    background: linear-gradient(135deg, #FF6B9D 0%, #FF8E53 100%);
}

.tlt-accordion-icon {
    font-size: 28px;
    font-weight: bold;
    color: white;
    margin-right: 15px;
    transition: transform 0.3s ease;
    min-width: 30px;
    text-align: center;
}

.tlt-accordion-header.active .tlt-accordion-icon {
    transform: rotate(45deg);
}

.tlt-accordion-title {
    color: white;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.tlt-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    background: #F7F9FC;
}

.tlt-accordion-content.active {
    max-height: 800px;
    padding: 25px;
}

.tlt-instruction-text {
    color: #2D3748;
    line-height: 1.8;
    font-size: 17px;
}

.tlt-instruction-text strong {
    color: #667eea;
    font-size: 18px;
}

.tlt-instruction-text ol {
    padding-left: 25px;
    margin: 15px 0;
}

.tlt-instruction-text li {
    margin-bottom: 15px;
    font-size: 16px;
    color: #4A5568;
}

/* ==========================================
   GAME AREA
   ========================================== */
.tlt-game-area {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px 20px;
    min-height: 500px;
    position: relative;
    overflow: hidden;
}

/* ==========================================
   GAME HEADER
   ========================================== */
.tlt-game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.2);
    padding: 15px 20px;
    border-radius: 15px;
}

.tlt-round-display,
.tlt-timer-display,
.tlt-score-display {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 18px;
    font-weight: 700;
}

.tlt-current-round,
.tlt-timer-value,
.tlt-score-value {
    font-size: 28px;
    font-weight: 900;
}

.tlt-round-label,
.tlt-score-label {
    font-size: 16px;
    opacity: 0.9;
}

.tlt-timer-icon {
    font-size: 24px;
}

/* ==========================================
   AUDIO CONTROL
   ========================================== */
.tlt-audio-control {
    text-align: center;
    margin-bottom: 30px;
}

.tlt-replay-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50px;
    padding: 12px 25px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.tlt-replay-btn:hover {
    transform: scale(1.05);
    background: white;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.tlt-replay-btn svg {
    width: 24px;
    height: 24px;
}

.tlt-replay-btn svg path {
    fill: #667eea;
}

.tlt-replay-text {
    color: #667eea;
    font-size: 18px;
    font-weight: 700;
}

/* ==========================================
   LETTERS CONTAINER
   ========================================== */
.tlt-letters-container {
    position: relative;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
}

/* Letter Bubble */
.tlt-letter-bubble {
    background: white;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    animation: tltFloat 3s ease-in-out infinite;
    font-size: 56px;
    font-weight: 900;
    color: #2D3748;
    user-select: none;
    
    /* Hardware acceleration for smooth mobile animations */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}

.tlt-letter-bubble:hover {
    transform: scale(1.15);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}

.tlt-letter-bubble:active {
    transform: scale(0.95);
}

/* Float Animation - Optimized for mobile with 3D transforms */
@keyframes tltFloat {
    0%, 100% {
        -webkit-transform: translate3d(0, 0, 0) rotate(0deg);
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
    25% {
        -webkit-transform: translate3d(0, -15px, 0) rotate(2deg);
        transform: translate3d(0, -15px, 0) rotate(2deg);
    }
    50% {
        -webkit-transform: translate3d(0, -8px, 0) rotate(0deg);
        transform: translate3d(0, -8px, 0) rotate(0deg);
    }
    75% {
        -webkit-transform: translate3d(0, -10px, 0) rotate(-2deg);
        transform: translate3d(0, -10px, 0) rotate(-2deg);
    }
}

/* Stagger animation delays for multiple letters */
.tlt-letter-bubble:nth-child(1) {
    animation-delay: 0s;
}

.tlt-letter-bubble:nth-child(2) {
    animation-delay: 0.2s;
}

.tlt-letter-bubble:nth-child(3) {
    animation-delay: 0.4s;
}

.tlt-letter-bubble:nth-child(4) {
    animation-delay: 0.6s;
}

.tlt-letter-bubble:nth-child(5) {
    animation-delay: 0.8s;
}

.tlt-letter-bubble:nth-child(6) {
    animation-delay: 1s;
}

/* Correct State */
.tlt-letter-bubble.correct {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    animation: tltCorrectPulse 0.6s ease;
    pointer-events: none;
}

@keyframes tltCorrectPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3) rotate(10deg);
    }
}

/* Incorrect State */
.tlt-letter-bubble.incorrect {
    background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
    color: white;
    animation: tltShake 0.5s ease;
    pointer-events: none;
}

@keyframes tltShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-15px) rotate(-5deg);
    }
    75% {
        transform: translateX(15px) rotate(5deg);
    }
}

/* Disabled State */
.tlt-letter-bubble.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ==========================================
   FEEDBACK FLASH
   ========================================== */
.tlt-feedback-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px 50px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: none;
    align-items: center;
    gap: 20px;
    z-index: 10;
}

.tlt-feedback-flash.show {
    display: flex;
    animation: tltFeedbackPop 0.5s ease;
}

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

.tlt-feedback-icon {
    font-size: 60px;
}

.tlt-feedback-text {
    font-size: 32px;
    font-weight: 900;
    color: #2D3748;
}

.tlt-feedback-flash.correct {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.tlt-feedback-flash.correct .tlt-feedback-text {
    color: white;
}

.tlt-feedback-flash.incorrect {
    background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
}

.tlt-feedback-flash.incorrect .tlt-feedback-text {
    color: white;
}

/* ==========================================
   SUCCESS MESSAGE
   ========================================== */
.tlt-success-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.tlt-success-message.show {
    display: flex;
    animation: tltFadeIn 0.5s ease;
}

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

.tlt-success-content {
    background: white;
    padding: 50px;
    border-radius: 30px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: tltSuccessPop 0.5s ease;
}

@keyframes tltSuccessPop {
    0% {
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.tlt-success-icon {
    font-size: 100px;
    display: block;
    margin-bottom: 20px;
    animation: tltSuccessSpin 0.8s ease;
}

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

.tlt-success-content h3 {
    color: #667eea;
    font-size: 36px;
    margin-bottom: 15px;
}

.tlt-success-content p {
    font-size: 20px;
    color: #4A5568;
    margin-bottom: 20px;
}

.tlt-final-score-value {
    color: #4CAF50;
    font-size: 48px;
}

.tlt-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 25px 0;
    flex-wrap: wrap;
}

.tlt-stat {
    text-align: center;
}

.tlt-stat-label {
    display: block;
    font-size: 14px;
    color: #94A3B8;
    margin-bottom: 5px;
}

.tlt-stat-value {
    display: block;
    font-size: 32px;
    font-weight: 900;
    color: #667eea;
}

.tlt-restart-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    margin-top: 20px;
}

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

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 768px) {
    .tlt-letter-bubble {
        width: 100px;
        height: 100px;
        font-size: 48px;
        /* Ensure animation continues on mobile */
        -webkit-animation: tltFloat 3s ease-in-out infinite;
        animation: tltFloat 3s ease-in-out infinite;
    }
    
    .tlt-game-header {
        font-size: 16px;
    }
    
    .tlt-current-round,
    .tlt-timer-value,
    .tlt-score-value {
        font-size: 24px;
    }
    
    .tlt-feedback-text {
        font-size: 24px;
    }
    
    .tlt-feedback-icon {
        font-size: 48px;
    }
}

@media (max-width: 480px) {
    .tlt-game-area {
        padding: 20px 15px;
        min-height: 400px;
    }
    
    .tlt-letter-bubble {
        width: 80px;
        height: 80px;
        font-size: 40px;
        /* Ensure animation continues on small mobile */
        -webkit-animation: tltFloat 3s ease-in-out infinite;
        animation: tltFloat 3s ease-in-out infinite;
    }
    
    .tlt-letters-container {
        gap: 15px;
        min-height: 300px;
    }
    
    .tlt-success-content {
        padding: 30px;
        margin: 20px;
    }
    
    .tlt-stats {
        gap: 15px;
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */
.tlt-letter-bubble:focus,
.tlt-replay-btn:focus,
.tlt-restart-btn:focus {
    outline: 3px solid white;
    outline-offset: 3px;
}
