/* ================================
   CCNA Practice Exam Simulator
   style.css
================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

body {
    background: #eef3f8;
    color: #222;
}

.container {
    width: 90%;
    max-width: 1000px;
    margin: 40px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .15);
    padding: 30px;
}

header {
    margin-bottom: 30px;
}

header h1 {
    color: #005073;
    margin-bottom: 20px;
}

/* Domain Tag Badge */
.domain-badge {
    display: inline-block;
    background: #e1f0f7;
    color: #005073;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

#timer {
    background: #005073;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
}

.timer-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.utility-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    margin: 0 0 22px;
    padding: 14px;
    background: #f4f8fb;
    border: 1px solid #d7e3eb;
    border-radius: 10px;
}

.accessibility-tools,
.question-bank-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.utility-bar button,
.import-label,
.utility-bar select {
    padding: 8px 11px;
    font-size: 0.85rem;
}

.import-label {
    color: #005073;
    border: 1px solid #005073;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.utility-bar select {
    margin-left: 6px;
}

.utility-status {
    flex-basis: 100%;
    min-height: 1.2em;
    color: #255d32;
    font-size: 0.85rem;
}

.utility-status.error { color: #a51414; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#time {
    display: block;
    margin-top: 5px;
    font-size: 24px;
}

#progressText {
    font-size: 18px;
    font-weight: bold;
}

.progress {
    width: 100%;
    height: 16px;
    background: #d8d8d8;
    border-radius: 20px;
    overflow: hidden;
}

#progressBar {
    width: 0%;
    height: 100%;
    background: #0d9be1;
    transition: .3s;
}

.exam {
    margin-top: 30px;
}

#question {
    margin-bottom: 25px;
    line-height: 1.5;
    font-size: 18px;
    color: #1e293b;
}

/* CLI Output & Code Snippets */
pre, code {
    background: #1e293b;
    color: #38bdf8;
    font-family: 'Courier New', Courier, monospace;
    padding: 14px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 20px;
    display: block;
    font-size: 14px;
    line-height: 1.4;
}

/* Fix: Answer Choices Styling & Visible Text Color */
.answer {
    display: block;
    width: 100%;
    text-align: left;
    padding: 16px;
    margin-bottom: 15px;
    border: 2px solid #d5d5d5;
    border-radius: 8px;
    background: #ffffff !important;
    color: #222222 !important; /* Explicit high-contrast text color */
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-size: 16px;
    line-height: 1.4;
}

.answer:hover {
    border-color: #0d9be1;
    background: #f0f9ff !important;
    color: #005073 !important;
}

.answer.selected {
    background: #d7f0ff !important;
    border-color: #007acc !important;
    color: #003853 !important;
    font-weight: bold;
}

/* Navigation Buttons Container */
.buttons {
    margin-top: 35px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

/* Default Action Buttons */
button {
    background: #005073;
    color: #ffffff;
    border: none;
    padding: 14px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: .2s;
}

button:hover {
    background: #0077aa;
}

button:disabled {
    opacity: .4;
    cursor: not-allowed;
}

/* Secondary & Flag Button Styles */
.btn-flag {
    background: transparent;
    border: 2px solid #f39c12;
    color: #d35400;
}

.btn-flag:hover {
    background: #f39c12;
    color: white;
}

.btn-flag.active {
    background: #f39c12;
    color: white;
}

.navigator {
    margin-top: 40px;
}

.navigator h3 {
    margin-bottom: 20px;
}

#navButtons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.navBtn {
    height: 50px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: #d9d9d9;
    font-weight: bold;
    transition: .2s;
    color: #333333 !important;
}

.navBtn.answered {
    background: #27ae60;
    color: #ffffff !important;
}

.navBtn.review {
    background: #f39c12;
    color: #ffffff !important;
}

/* Priority outline for current active question */
.navBtn.current {
    outline: 3px solid #005073;
    outline-offset: 2px;
}

.hidden {
    display: none !important;
}

/* Result Screen */
#resultScreen {
    max-width: 900px;
    margin: 50px auto;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .15);
}

#resultScreen h1 {
    color: #005073;
    margin-bottom: 20px;
}

#finalScore {
    margin-bottom: 30px;
    font-size: 36px;
    font-weight: bold;
}

.results {
    background: #f7f7f7;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.results ul {
    list-style: none;
}

.results li {
    padding: 8px 0;
    font-size: 18px;
}

#feedback {
    margin: 30px 0;
    background: #eef9ff;
    border-left: 5px solid #0d9be1;
    padding: 20px;
    line-height: 1.7;
}

.reviewCard {
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.reviewCard.correct {
    border-left: 8px solid #27ae60;
}

.reviewCard.wrong {
    border-left: 8px solid #e74c3c;
}

.reviewQuestion {
    font-weight: bold;
    margin-bottom: 15px;
}

.reviewAnswer {
    margin-top: 8px;
}

.correctText {
    color: #27ae60;
    font-weight: bold;
}

.wrongText {
    color: #e74c3c;
    font-weight: bold;
}

.explanation {
    margin-top: 12px;
    background: #f9f9f9;
    padding: 12px;
    border-radius: 6px;
}

/* Responsive adjustments */
@media(max-width: 768px) {
    .container {
        width: 95%;
        padding: 20px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .buttons {
        flex-direction: column;
        gap: 15px;
    }

    button {
        width: 100%;
    }

    #navButtons {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media(max-width: 500px) {
    #navButtons {
        grid-template-columns: repeat(3, 1fr);
    }

    header h1 {
        font-size: 24px;
    }

    #question {
        font-size: 18px;
    }

    .answer {
        font-size: 15px;
    }
}

/* Drag and Drop UI */
.dragdrop-container {
    display: flex;
    gap: 20px;
    margin-top: 15px;
}

.drag-column, .drop-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.draggable-card {
    padding: 12px 16px;
    background-color: #0056b3;
    color: #ffffff;
    border-radius: 6px;
    cursor: grab;
    font-weight: 600;
    user-select: none;
    transition: background-color 0.2s ease;
}

.draggable-card.placed {
    opacity: 0.3;
    cursor: not-allowed;
}

.draggable-card.in-slot {
    background-color: #28a745;
    margin: 0;
    width: 100%;
    cursor: pointer;
}

.dropzone {
    border: 2px dashed #ccc;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: #f9f9f9;
}

.zone-label {
    display: block;
    font-size: 0.85rem;
    font-weight: bold;
    color: #444;
    margin-bottom: 6px;
}

.drop-slot {
    min-height: 45px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    padding: 4px;
}

/* Display preferences saved by the accessibility toolbar. */
body.theme-dark {
    background: #121a22;
    color: #e8edf2;
}

body.theme-dark .container,
body.theme-dark #resultScreen,
body.theme-dark .results-container,
body.theme-dark .review-card {
    background: #1c2732 !important;
    color: #e8edf2;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .45);
}

body.theme-dark header h1,
body.theme-dark #question,
body.theme-dark .navigator h3,
body.theme-dark .zone-label {
    color: #d7efff;
}

body.theme-dark .domain-badge {
    background: rgba(27, 61, 88, 0.95);
    color: #cce8ff;
    border: 1px solid #63b5ff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

body.theme-dark #progressText {
    color: #eef6ff;
}

body.theme-dark .utility-bar,
body.theme-dark .results,
body.theme-dark .domain-summary,
body.theme-dark .dropzone,
body.theme-dark .drop-slot {
    background: #243340 !important;
    border-color: #476275 !important;
    color: #f4f8fb !important;
}

body.theme-dark .domain-summary h3,
body.theme-dark .domain-summary span,
body.theme-dark .domain-summary strong {
    color: #f4f8fb !important;
}

body.theme-dark .domain-summary hr {
    border-top-color: #60798c !important;
}

body.theme-dark .answer,
body.theme-dark .navBtn {
    background: #283845 !important;
    color: #f4f8fb !important;
    border-color: #587084;
}

body.theme-dark .navBtn.answered {
    background: #27ae60 !important;
    color: #ffffff !important;
}

body.theme-dark .navBtn.review {
    background: #f39c12 !important;
    color: #ffffff !important;
}

.review-card .explanation-block {
    margin-top: 10px;
    padding: 14px;
    border-radius: 8px;
    background: #eef3ff;
    color: #1c1c1c;
    border-left: 4px solid #0056b3;
    line-height: 1.6;
}

body.theme-dark .review-card .explanation-block {
    background: #17212a;
    color: #e8f2ff;
    border-color: #5bb0ff;
}
body.theme-dark .answer:hover,
body.theme-dark .answer.selected {
    background: #164c69 !important;
    color: #fff !important;
}

body.theme-dark .import-label { color: #bce9ff; border-color: #bce9ff; }
body.theme-dark .utility-status { color: #a8e6b1; }
body.theme-dark .utility-status.error { color: #ffb4b4; }

body.high-contrast {
    background: #000;
    color: #fff;
}

body.high-contrast .container,
body.high-contrast #resultScreen,
body.high-contrast .results-container,
body.high-contrast .utility-bar,
body.high-contrast .results,
body.high-contrast .dropzone,
body.high-contrast .drop-slot {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
    box-shadow: none !important;
}

body.high-contrast .domain-summary,
body.high-contrast .domain-summary span,
body.high-contrast .domain-summary strong {
    background: #000 !important;
    color: #fff !important;
}

body.high-contrast h1,
body.high-contrast h2,
body.high-contrast h3,
body.high-contrast #question,
body.high-contrast .zone-label,
body.high-contrast .domain-badge,
body.high-contrast p,
body.high-contrast span {
    color: #fff !important;
}

body.high-contrast .answer,
body.high-contrast .navBtn,
body.high-contrast button,
body.high-contrast .import-label {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

body.high-contrast .answer.selected,
body.high-contrast .navBtn.current,
body.high-contrast button:focus-visible,
body.high-contrast .import-label:focus-within {
    outline: 4px solid #ffeb00 !important;
    outline-offset: 2px;
}

body.font-large #question { font-size: 22px; }
body.font-large .answer, body.font-large button, body.font-large #progressText { font-size: 18px; }
body.font-xlarge #question { font-size: 26px; }
body.font-xlarge .answer, body.font-xlarge button, body.font-xlarge #progressText { font-size: 20px; }

.diagram {
    margin: 0 0 24px;
    padding: 12px;
    background: #f8fbfd;
    border: 1px solid #cfe0ea;
    border-radius: 10px;
}

.diagram img {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: contain;
}

.diagram figcaption {
    margin-top: 10px;
    color: #496174;
    font-size: 0.9rem;
    text-align: center;
}
