/**
 * Wordle Game - Main Stylesheet
 * 
 * Comprehensive styling for the Wordle game with Bootstrap dark theme.
 * Includes responsive design, animations, and mobile-friendly layouts.
 * 
 * @author  Andy
 * @version 1.0.0
 */

:root {
    --color-correct: #538d4e;
    --color-present: #b59f3b;
    --color-absent: #3a3a3c;
    --color-empty: #121213;
    --color-border: #3a3a3c;
    --color-text: #ffffff;
    --gradient-start: #6366f1;
    --gradient-end: #8b5cf6;
}

/* Global Styles */
body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: var(--color-text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Text Gradient */
.text-gradient {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.letter-icon {
    display: inline-block;
    width: 60px;
    height: 60px;
    line-height: 60px;
    text-align: center;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    border-radius: 12px;
    margin-right: 10px;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: white;
    font-size: 2rem;
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.3);
}

/* Card Styles */
.game-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.game-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    border-color: rgba(99, 102, 241, 0.3);
}

/* Word Length Selection Buttons */
.word-length-btn {
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-width: 2px;
    transition: all 0.3s ease;
}

.word-length-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

.btn-check:checked + .word-length-btn {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    border-color: var(--gradient-start);
    transform: scale(1.05);
}

/* Game Board */
.game-board {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 auto;
    max-width: 500px;
}

.guess-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.letter-box {
    width: 60px;
    height: 60px;
    border: 2px solid var(--color-border);
    background: var(--color-empty);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 4px;
    transition: all 0.3s ease;
}

/* Letter States */
.letter-correct {
    background-color: var(--color-correct);
    border-color: var(--color-correct);
    color: white;
}

.letter-present {
    background-color: var(--color-present);
    border-color: var(--color-present);
    color: white;
}

.letter-absent {
    background-color: var(--color-absent);
    border-color: var(--color-absent);
    color: white;
}

/* Animation for revealing letters */
.letter-box.animate {
    animation: flipIn 0.5s ease;
}

@keyframes flipIn {
    0% {
        transform: rotateX(0);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0);
    }
}

/* Virtual Keyboard */
.keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 auto;
    max-width: 600px;
}

.keyboard-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.keyboard-spacer {
    flex: 0.5;
}

.keyboard-key {
    min-width: 40px;
    height: 58px;
    padding: 0 12px;
    background: #818384;
    border: none;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keyboard-key:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.keyboard-key:active {
    transform: scale(0.95);
}

.keyboard-key-lg {
    min-width: 65px;
    font-size: 0.75rem;
}

/* Keyboard letter states */
.keyboard-key.key-correct {
    background: var(--color-correct);
}

.keyboard-key.key-present {
    background: var(--color-present);
}

.keyboard-key.key-absent {
    background: var(--color-absent);
}

/* Input Styles */
#guessInput {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: bold;
    letter-spacing: 0.1em;
}

#guessInput:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--gradient-start);
    color: white;
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
}

#guessInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Error Message */
#errorMessage {
    color: #dc3545;
    font-weight: 500;
}

/* Game Over Section */
.game-over-section {
    padding: 2rem 1rem;
}

/* Responsive Design */
@media (max-width: 576px) {
    .letter-box {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .guess-row {
        gap: 6px;
    }

    .game-board {
        gap: 6px;
    }

    .letter-icon {
        width: 45px;
        height: 45px;
        line-height: 45px;
        font-size: 1.5rem;
    }

    .display-3 {
        font-size: 2.5rem;
    }

    .keyboard-key {
        min-width: 32px;
        height: 48px;
        padding: 0 8px;
        font-size: 0.75rem;
    }

    .keyboard-key-lg {
        min-width: 55px;
        font-size: 0.7rem;
    }

    .keyboard-row {
        gap: 4px;
    }

    .word-length-btn {
        height: 80px;
    }
}

@media (max-width: 380px) {
    .letter-box {
        width: 42px;
        height: 42px;
        font-size: 1.25rem;
    }

    .keyboard-key {
        min-width: 28px;
        height: 44px;
        padding: 0 6px;
        font-size: 0.7rem;
    }

    .keyboard-key-lg {
        min-width: 50px;
    }
}

/* Smooth transitions */
* {
    transition: background-color 0.3s ease, transform 0.2s ease;
}

/* Button hover effects */
.btn {
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

/* Stats cards */
.card-body .h3 {
    font-weight: 700;
}

/* Loading animation for guess submission */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1s infinite;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.5);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.7);
}

/* Focus states for accessibility */
.keyboard-key:focus,
.btn:focus,
#guessInput:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.5);
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .keyboard,
    #guessForm,
    .btn {
        display: none;
    }
}
