/* ThaiMap - Thailand Geography Quiz Styles */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Sarabun', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.logo {
    text-align: left;
}

.logo h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}

.header-stats {
    display: flex;
    gap: 30px;
}

.stat {
    text-align: center;
    color: white;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Main Content */
.main {
    padding: 30px 0;
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

/* Controls Panel */
.controls-panel {
    background: #2c3e50;
    color: white;
    padding: 25px 30px;
}

.game-info h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: #ecf0f1;
}

.difficulty-selector {
    margin-bottom: 20px;
}

.difficulty-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.difficulty-selector select {
    padding: 8px 15px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    background: #34495e;
    color: white;
    cursor: pointer;
}

.game-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #27ae60;
    color: white;
}

.btn-primary:hover {
    background: #229954;
}

.btn-secondary {
    background: #3498db;
    color: white;
}

.btn-secondary:hover {
    background: #2980b9;
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9rem;
}

/* Map Container */
.map-container {
    padding: 30px;
    background: #ecf0f1;
}

.map-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.thailand-map {
    width: 600px;
    height: 750px;
    background: #e8f4f8;
    border-radius: 15px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
    cursor: crosshair;
}

.map-legend {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.map-legend h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #2c3e50;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.legend-item span:first-child {
    margin-right: 10px;
    border-radius: 50%;
    width: 16px;
    height: 16px;
}

.dot-inactive { background: #ff4444; border: 2px solid #cc0000; }
.dot-active { background: #ffff00; border: 2px solid #cccc00; }
.dot-correct { background: #00ff00; border: 2px solid #00aa00; }
.dot-wrong { background: #ff0000; border: 2px solid #aa0000; }

/* Province Dots */
.province-dot {
    cursor: pointer;
    transition: all 0.3s ease;
}

.province-dot:hover {
    r: 12;
    stroke-width: 3;
}

.province-dot.active {
    fill: #ffff00;
    stroke: #cccc00;
    stroke-width: 3;
}

.province-dot.correct {
    fill: #00ff00;
    stroke: #00aa00;
    stroke-width: 3;
}

.province-dot.wrong {
    fill: #ff0000;
    stroke: #aa0000;
    stroke-width: 3;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Pronunciation Display */
.pronunciation-display {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.pronunciation-display h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

.pronunciation-display p {
    font-size: 1.5rem;
    color: #34495e;
    margin-bottom: 15px;
    font-weight: 600;
}

.pronunciation-display #playSoundBtn {
    margin-top: 10px;
}

/* Message Display */
.message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 40px;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    z-index: 2000;
    animation: fadeInOut 3s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.message.success {
    background: #27ae60;
    color: white;
}

.message.error {
    background: #e74c3c;
    color: white;
}

.message.hidden {
    display: none;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* Progress Bar */
.progress-container {
    padding: 20px 30px;
    background: #34495e;
    display: flex;
    align-items: center;
    gap: 20px;
}

.progress-bar {
    flex: 1;
    height: 25px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    transition: width 0.5s ease;
    border-radius: 12px;
}

.progress-text {
    color: white;
    font-weight: bold;
    min-width: 80px;
    text-align: center;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 30px;
    background: #2c3e50;
    color: white;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 30px;
}

/* High Scores Table */
.high-scores-table {
    width: 100%;
    border-collapse: collapse;
}

.high-scores-table th,
.high-scores-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.high-scores-table th {
    background: #34495e;
    color: white;
    font-weight: 600;
}

.high-scores-table tr:nth-child(even) {
    background: #f8f9fa;
}

.high-scores-table tr:hover {
    background: #ecf0f1;
}

/* Name Input */
.final-score {
    text-align: center;
    margin-bottom: 30px;
}

.final-score h3 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin: 10px 0;
}

.name-input {
    text-align: center;
}

.name-input label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
}

.name-input input {
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    width: 250px;
    margin-bottom: 20px;
    text-align: center;
}

.name-input input:focus {
    outline: none;
    border-color: #3498db;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .map-wrapper {
        flex-direction: column;
    }

    .thailand-map {
        width: 100%;
        height: 500px;
    }

    .map-legend {
        width: 100%;
        order: 2;
    }

    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .header-stats {
        justify-content: center;
    }

    .game-controls {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .game-info h2 {
        font-size: 1.4rem;
    }

    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .modal-content {
        margin: 20px;
    }

    .high-scores-table {
        font-size: 0.9rem;
    }

    .high-scores-table th,
    .high-scores-table td {
        padding: 8px 10px;
    }
}