/* Quiz Game Styles - Mobile First Design */

/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: #333;
}

/* Team Setup Styles */
.setup-container {
    max-width: 600px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.setup-container h1 {
    color: #2d3436;
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.setup-container p {
    color: #636e72;
    font-size: 16px;
    margin-bottom: 30px;
}

.team-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.team-inputs input {
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fff;
}

.team-inputs input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.start-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.start-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.start-button:active {
    transform: translateY(0);
}

/* Responsive design for team setup */
@media (min-width: 768px) {
    .team-inputs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
}

/* Game Title and Section Headers */
.game-title {
    text-align: center;
    color: #2d3436;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.teams-title {
    color: #2d3436;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Container for the entire game */
.game-container {
    max-width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Question Table Styles */
#question_table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    table-layout: fixed;
}

/* Card base styles */
.card {
    padding: 12px;
    text-align: center;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    height: 80px;
    width: 100%;
    display: table-cell;
    vertical-align: middle;
    word-wrap: break-word;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Topic header cards */
.topic-card {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    font-weight: bold;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: default;
    height: 65px;
}

.topic-card:hover {
    transform: none;
}

/* Question card states */
.question-card {
    background: white;
    border: 2px solid #ddd;
    transition: all 0.3s ease;
}

.question-card:hover {
    border-color: #4facfe;
}

/* Idle state - shows points */
.idle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.idle:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.points-span {
    display: block;
    font-size: 22px;
    font-weight: bold;
}

/* Active state - shows question */
.active {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    color: #2d3436;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Used state - shows question and answer */
.used {
    background: linear-gradient(135deg, #a8e6cf 0%, #88d8a3 100%);
    color: #2d3436;
    cursor: default;
}

.used:hover {
    transform: none;
}

/* Check state - shows question, answer, and buttons */
.check {
    background: linear-gradient(135deg, #ffb3ba 0%, #ff9999 100%);
    color: #2d3436;
    padding: 4px 2px;
}

/* Question and answer text */
.question-span {
    display: block;
    font-weight: bold;
    font-size: 11px;
    margin-bottom: 3px;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.answer-span {
    display: block;
    font-style: italic;
    font-size: 10px;
    margin-bottom: 4px;
    color: #2d3436;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Check buttons */
.check-button {
    padding: 4px 8px;
    margin: 2px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s ease;
    min-width: 25px;
}

.check-button-right {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: white;
}

.check-button-right:hover {
    background: linear-gradient(135deg, #00a085 0%, #009975 100%);
    transform: scale(1.1);
}

.check-button-wrong {
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
    color: white;
}

.check-button-wrong:hover {
    background: linear-gradient(135deg, #d63031 0%, #c72c2c 100%);
    transform: scale(1.1);
}

/* Teams List Styles */
#teams {
    list-style: none;
    padding: 0;
    margin: 0;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.team {
    padding: 12px 15px;
    margin: 0;
    border-bottom: 1px solid #eee;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team:last-child {
    border-bottom: none;
}

/* Team colors */
.team-red {
    background: linear-gradient(135deg, #ff7675 0%, #e84393 100%);
    color: white;
}

.team-blue {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

.team-green {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: white;
}

.team-yellow {
    background: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%);
    color: white;
}

/* Team score display */
.team-score {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: normal;
}

/* Active team highlight */
.team-active {
    transform: scale(1.02);
    position: relative;
    border-left: 5px solid #fff;
}

.active-dot {
    color: #fff;
    font-size: 16px;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    font-weight: bold;
}

/* Responsive Design - Tablet */
@media (min-width: 768px) {
    body {
        padding: 20px;
    }
    
    .game-title {
        font-size: 28px;
        margin-bottom: 25px;
    }
    
    .teams-title {
        font-size: 20px;
        margin-bottom: 18px;
    }
    
    .game-container {
        padding: 25px;
    }
    
    #question_table {
        font-size: 14px;
    }
    
    .card {
        padding: 12px;
        height: 80px;
    }
    
    .topic-card {
        font-size: 13px;
        height: 60px;
    }
    
    .points-span {
        font-size: 22px;
    }
    
    .question-span {
        font-size: 11px;
        margin-bottom: 3px;
    }
    
    .answer-span {
        font-size: 10px;
        margin-bottom: 4px;
    }
    
    .check-button {
        padding: 4px 8px;
        font-size: 12px;
        min-width: 25px;
        border-radius: 12px;
    }
    
    .team {
        padding: 15px 20px;
        font-size: 16px;
    }
    
    .team-score {
        font-size: 14px;
        padding: 5px 10px;
    }
}

/* Responsive Design - Desktop */
@media (min-width: 1024px) {
    body {
        padding: 30px;
    }
    
    .game-title {
        font-size: 32px;
        margin-bottom: 30px;
    }
    
    .teams-title {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    .game-container {
        max-width: 1200px;
        padding: 40px;
    }
    
    #question_table {
        font-size: 16px;
    }
    
    .card {
        padding: 20px;
        height: 100px;
    }
    
    .topic-card {
        font-size: 16px;
        height: 80px;
    }
    
    .points-span {
        font-size: 28px;
    }
    
    .question-span {
        font-size: 14px;
        margin-bottom: 4px;
    }
    
    .answer-span {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .check-button {
        padding: 6px 12px;
        font-size: 14px;
        min-width: 35px;
        border-radius: 15px;
    }
    
    .team {
        padding: 20px 25px;
        font-size: 18px;
    }
    
    .team-score {
        font-size: 16px;
        padding: 6px 12px;
    }
}

/* Special effects for game interactions */
.card.clicked {
    animation: cardClick 0.3s ease;
}

@keyframes cardClick {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Loading animation for when questions are being processed */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Accessibility improvements */
.check-button:focus,
.card:focus {
    outline: 3px solid #4facfe;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border-width: 3px;
    }
    
    .idle {
        background: #000;
        color: #fff;
    }
    
    .active {
        background: #ff0;
        color: #000;
    }
    
    .used {
        background: #0f0;
        color: #000;
    }
    
    .check {
        background: #f00;
        color: #fff;
    }
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
