/* 
This file contains the styles for the CountryWizz application, including layout, colors, fonts, and responsive design for the quiz game interface.
*/

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #eef2f7;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px 20px 0px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 30, 80, 0.1);
}

header {
    padding-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1,
.page-header p {
    margin: 0;
    text-align: left;
}

.header-controls {
    display: flex;
    flex: 1;
    align-items: stretch;
    justify-content: flex-end;
    gap: 16px;
    flex-wrap: nowrap;
}

.scoreboard {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: stretch;
}

.header-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    align-self: stretch;
}

.pill-button {
    border-radius: 10px;
    border: 1px solid transparent;
    padding: 8px 14px;
    background: #f1f3f5;
    color: #1f2933;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    min-width: 130px;
}

.pill-button:hover {
    background: #e2e6ea;
}

.pill-button--danger {
    background: #fee2e2;
    color: #b42318;
    border-color: #fecaca;
}

.pill-button--danger:hover {
    background: #fecaca;
}

.metric-chip {
    min-width: 80px;
    padding: 8px 12px;
    border-radius: 12px;
    background: #f1f3f5;
    display: flex;
    flex-direction: column;
    text-align: right;
    border: 1px solid #dfe3e8;
    min-height: 50px;
}

.metric-chip span:last-child {
    font-size: 1.4rem;
    font-weight: 700;
    color: #212529;
}

.metric-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: #6c757d;
}

.metric-chip--correct {
    background: #e8f5e9;
    border-color: #c8e6c9;
}

.metric-chip--incorrect {
    background: #fdecea;
    border-color: #f8d7da;
}

.metric-chip--streak {
    background: #e8f0fe;
    border-color: #c5d7fe;
}

h1 {
    color: #343a40;
    font-weight: 700;
}

main {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    align-items: stretch;
}

#quiz-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#map-container {
    flex: 1;
    position: sticky;
    top: 20px;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    border-radius: 12px;
    overflow: hidden;
    /* box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); */
    background: #fff;
}

#world-map {
    width: 100%;
    height: 100%;
    flex: 1;
}

.country {
    fill: #ccc; /* Default color for all countries */
    stroke: #fff; /* White border between countries */
    stroke-width: 0.5px;
    transition: fill 0.3s ease;
}

.country.unlocked {
    fill: #4CAF50; /* Green color for unlocked countries */
}

.country:hover {
    fill: #a9a9a9; /* Darker grey on hover */
}

.flashcard {
    background-color: transparent;
    perspective: 1000px;
    height: 480px; /* Adjusted height */
    margin: 0;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    border-radius: 12px;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 93%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 12px;
    background-color: #fff;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#question-text {
    font-size: 1.125rem;
    text-align: center;
    font-weight: 600;
    color: #0f172a;
}

.prompt-highlight {
    font-weight: 700;
    font-size: 1.15em;
    color: #b28c07;
}

.prompt-highlight--airline {
    color: #b28c07;
}

.flashcard-back {
    transform: rotateY(180deg);
    background-color: #f8f9fa;
}

#options-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    margin-top: 20px;
}

.option-btn {
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

.option-btn:hover {
    background-color: #0056b3;
}

.option-btn.correct {
    background-color: #28a745;
}

.option-btn.correct.answer-flash {
    animation: correctFlash 0.6s ease-in-out infinite alternate;
}

.option-btn.incorrect {
    background-color: #dc3545;
}

.option-btn:disabled {
    cursor: default;
    opacity: 0.9;
}

#next-button {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 18px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#next-button:hover {
    background-color: #218838;
}

.question-media {
    position: relative;
    width: 100%;
}

#question-image {
    /*width: 100%;
    height: 240px;
    background-color: #111;
    object-fit: cover;*/
    width: auto;
    max-width: 100%;
    max-height: 270px;
    height: auto;
    background-color: #11111100;
    object-fit: contain;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 3px solid #eaeaea;
}

#question-image.question-image--capital {
    width: 100%;
    height: 270px;
    background-color: #11111100;
    object-fit: cover;
}

#question-image.question-image--flag {
    width: auto;
    max-width: 100%;
    max-height: 270px;
    height: auto;
    background-color: #11111100;
    object-fit: contain;
}

#question-image.question-image--airline {
    width: auto;
    max-width: 95%;
    height: 270px;
    background-color: #11111100;
    object-fit: contain;
    padding: 10px;
}

.question-flag {
    position: absolute;
    top: 18px;
    right: 8px;
    width: 60px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    object-fit: cover;
}

.hidden {
    display: none !important;
}

.grayed-out {
    filter: grayscale(1);
}

.map {
    width: 100%;
    height: 400px;
    background-color: #e0e0e0;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin: 20px 0;
}

@keyframes correctFlash {
    0% {
        background-color: #28a745;
        box-shadow: 0 0 0 rgba(40, 167, 69, 0);
    }
    50% {
        background-color: #2dd157;
        box-shadow: 0 0 14px rgba(40, 167, 69, 0.45);
    }
    100% {
        background-color: #28a745;
        box-shadow: 0 0 0 rgba(40, 167, 69, 0);
    }
}

#map-container img {
    width: 100%;
    height: auto;
    display: block;
    transition: filter 0.5s ease;
}

button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

button:hover {
    background-color: #218838;
}

.score {
    font-size: 20px;
    text-align: center;
    margin: 20px 0;
}

#score-board {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}

footer {
    text-align: center;
    /*margin-top: 30px;
    padding-top: 20px;*/
    border-top: 1px solid #dee2e6;
    color: #6c757d;
}

.session-summary {
    margin-top: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.session-summary.hidden {
    display: none;
}

.summary-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.session-summary h2 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.4rem;
    color: #212529;
}

.session-summary ol {
    margin: 16px 0 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-metric {
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    text-align: right;
    padding: 10px 16px;
}

.summary-metric-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c757d;
}

.summary-metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
}

.summary-item {
    padding: 10px 14px;
    border-radius: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.summary-item.correct {
    border-color: #28a745;
    background: #e6f5ea;
}

.summary-item.incorrect {
    border-color: #dc3545;
    background: #fdecea;
}

.summary-item strong {
    display: block;
    margin-bottom: 4px;
    color: #212529;
}

.summary-item__header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 6px;
}

.summary-item__status {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(33, 37, 41, 0.08);
    color: #212529;
}

.summary-item.correct .summary-item__status {
    background: rgba(25, 135, 84, 0.15);
    color: #0f5132;
}

.summary-item.incorrect .summary-item__status {
    background: rgba(220, 53, 69, 0.15);
    color: #842029;
}

.summary-item__answers {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
}

.summary-answer {
    font-size: 0.95rem;
    font-weight: 600;
}

.summary-answer--user.summary-answer--correct {
    color: #0f5132;
}

.summary-answer--user.summary-answer--incorrect {
    color: #842029;
}

.summary-answer--correct {
    color: #1d3b53;
}

@media (max-width: 992px) {
    main {
        flex-direction: column;
    }
    #map-container {
        position: static;
        margin-top: 30px;
    }
    .header-controls {
        flex-direction: column;
        align-items: flex-end;
    }
    .scoreboard {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .header-actions {
        flex-direction: row;
    }
}