/**
 * Chuck Games CSS
 * 
 * Styles for LWOS Games - Chuckles
 * Works alongside Tailwind CSS CDN
 *
 * @package LWOS_Games_Chuckles
 */

/* ============================================================================
   Game Container
   ============================================================================ */

.chuck-game-container {
    --chuck-orange: rgb(255, 136, 0);
    --chuck-black: rgb(36, 36, 36);
    --chuck-gray-900: rgb(17, 24, 39);
    --chuck-gray-800: rgb(31, 41, 55);
    --chuck-gray-700: rgb(55, 65, 81);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    max-width: 900px;
    margin: 0 auto;
}

/* ============================================================================
   Loading State
   ============================================================================ */

.chuck-game-loading {
    text-align: center;
    padding: 60px 20px;
    background: var(--chuck-gray-900);
    border-radius: 8px;
}

.chuck-spinner {
    display: inline-block;
    width: 48px;
    height: 48px;
    border: 4px solid var(--chuck-orange);
    border-top-color: transparent;
    border-radius: 50%;
    animation: chuck-spin 1s linear infinite;
}

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

.chuck-game-loading p {
    color: #fff;
    margin-top: 16px;
    font-size: 18px;
}

/* ============================================================================
   Error State
   ============================================================================ */

.chuck-game-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #fecaca;
}

/* ============================================================================
   Game Animations
   ============================================================================ */

@keyframes chuck-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: chuck-pulse 1s ease-in-out infinite;
}

@keyframes chuck-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* ============================================================================
   Widget Styles
   ============================================================================ */

.chuck-games-list,
.chuck-leaderboard-list {
    margin: 0;
    padding: 0;
}

.chuck-game-item {
    background: var(--chuck-gray-800, #1f2937);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chuck-game-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 136, 0, 0.2);
}

.chuck-game-item:last-child {
    margin-bottom: 0;
}

.chuck-game-type {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    color: #fff;
    margin-bottom: 6px;
}

.chuck-type-first10 {
    background: #2563eb;
}

.chuck-type-lastout {
    background: #7c3aed;
}

.chuck-game-title {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.chuck-game-notes {
    color: #9ca3af;
    font-size: 12px;
}

/* ============================================================================
   Leaderboard Widget
   ============================================================================ */

.chuck-leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.chuck-leaderboard-table th {
    color: var(--chuck-orange, #ff8800);
    font-weight: 600;
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid #374151;
}

.chuck-leaderboard-table td {
    color: #fff;
    padding: 8px;
    border-bottom: 1px solid #374151;
}

.chuck-leaderboard-table tr:last-child td {
    border-bottom: none;
}

.chuck-rank {
    font-weight: 700;
    color: var(--chuck-orange, #ff8800);
    min-width: 30px;
}

.chuck-player {
    font-weight: 500;
}

.chuck-score {
    text-align: right;
    font-weight: 600;
}

.chuck-no-games,
.chuck-no-entries {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* ============================================================================
   Admin Styles
   ============================================================================ */

.chuck-shortcode-widget select,
.chuck-shortcode-widget button {
    margin-bottom: 8px;
}

/* ============================================================================
   Responsive Adjustments
   ============================================================================ */

@media (max-width: 640px) {
    .chuck-game-container {
        font-size: 14px;
    }
    
    .chuck-1st10-game .text-2xl,
    .chuck-lastout-game .text-2xl {
        font-size: 1.25rem;
    }
    
    .chuck-complete .text-6xl {
        font-size: 3rem;
    }
}

/* ============================================================================
   WordPress Theme Integration
   ============================================================================ */

/* Ensure game container inherits proper box-sizing */
.chuck-game-container *,
.chuck-game-container *::before,
.chuck-game-container *::after {
    box-sizing: border-box;
}

/* Fix potential theme conflicts with inputs */
.chuck-game-container input[type="text"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
}

.chuck-game-container input[type="text"]:focus {
    box-shadow: none;
}

/* Fix button styles */
.chuck-game-container button {
    cursor: pointer;
    border: none;
    outline: none;
}

.chuck-game-container button:disabled {
    cursor: not-allowed;
}

/* Tailwind custom colors for our theme */
.text-orange-500 {
    color: rgb(255, 136, 0) !important;
}

.bg-orange-500 {
    background-color: rgb(255, 136, 0) !important;
}

.hover\:bg-orange-600:hover {
    background-color: rgb(234, 118, 0) !important;
}

.focus\:border-orange-500:focus {
    border-color: rgb(255, 136, 0) !important;
}

.peer-checked\:bg-orange-500:checked ~ .peer-checked\:bg-orange-500 {
    background-color: rgb(255, 136, 0) !important;
}

/* ============================================================================
   Dark Theme Widget Compatibility
   ============================================================================ */

.widget.chuck-latest-games-widget,
.widget.chuck-leaderboard-widget {
    background: var(--chuck-gray-900, #111827);
    border-radius: 8px;
    padding: 16px;
}

.widget.chuck-latest-games-widget .widget-title,
.widget.chuck-leaderboard-widget .widget-title {
    color: #fff;
    border-bottom: 2px solid var(--chuck-orange, #ff8800);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

/* ============================================================================
   UI/UX Fixes - Phase 1
   ============================================================================ */

/* Fix: Top and bottom bars fully opaque */
.chuck-game-container .bg-gray-800 {
    background-color: rgb(31, 41, 55) !important;
    opacity: 1 !important;
}

.chuck-game-container .bg-gray-900 {
    background-color: rgb(17, 24, 39) !important;
    opacity: 1 !important;
}

/* Fix: "No Results Found" visibility - Chuck Green */
.chuck-game-container .chuck-no-results,
.chuck-game-container [class*="no-results"],
.chuck-no-results-message {
    color: #13bc13 !important; /* Chuck Green */
    font-weight: 600;
    font-size: 1.1rem;
}

.chuck-game-container .chuck-no-results p,
.chuck-game-container .chuck-no-results span {
    color: #ffffff !important;
}

/* Powered By Chuck branding */
.chuck-powered-by {
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chuck-powered-by span {
    color: #13bc13; /* Chuck Green */
    font-weight: 700;
}

/* ============================================================================
   Phase 3 - Answer Feedback
   ============================================================================ */

/* Correct answer flash animation */
@keyframes chuck-correct-flash {
    0% { 
        background-color: rgb(55, 65, 81);
        border-color: rgb(75, 85, 99);
    }
    30% { 
        background-color: #13bc13;
        border-color: #13bc13;
        transform: scale(1.02);
    }
    100% { 
        background-color: rgb(55, 65, 81);
        border-color: rgb(75, 85, 99);
        transform: scale(1);
    }
}

.chuck-input-correct {
    animation: chuck-correct-flash 0.5s ease-out;
}

/* Correct answer checkmark indicator */
.chuck-correct-indicator {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #13bc13;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.chuck-correct-indicator.show {
    opacity: 1;
}

/* Input wrapper for positioning */
.chuck-input-wrapper {
    position: relative;
}
