/* Training Exercises Stylesheet for LA9M */

body {
    font-family: Arial, sans-serif;
    line-height: 1.5;
    max-width: 800px;
    margin: 15px auto;
    padding: 0 15px;
    background-color: #f5f5f5;
    font-size: 14px;
}

/* Header styling */
.header {
    background-color: #003366;
    color: white;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.header h1 {
    margin: 0 0 8px 0;
    font-size: 20px;
}

.header p {
    margin: 0 0 4px 0;
    font-size: 13px;
}

.header .pdf-download {
    margin-top: 12px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.header .pdf-link {
    color: #ffffff;
    text-decoration: underline;
    font-weight: bold;
    padding-left: 18px;
    position: relative;
    display: inline-block;
    margin: 0 1px;
}

.header .pdf-link::before {
    content: "📄";
    position: absolute;
    left: 0;
    font-size: 13px;
}

.header .pdf-link:hover {
    color: #ffdd88;
}

.header .file-size {
    font-weight: normal;
    font-size: 12px;
    opacity: 0.9;
}

.back-link {
    color: white;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin-top: 8px;
    padding: 4px 8px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    font-size: 13px;
}

.back-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Exercise container */
.exercises-container {
    background-color: white;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Individual exercise */
.exercise {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    background-color: #ffffff;
    scroll-margin-top: 15px;
}

.exercise:target {
    border-color: #003366;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.exercise:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #003366;
}

/* Exercise number */
.exercise-number {
    font-weight: bold;
    font-size: 16px;
    color: #003366;
    margin-bottom: 10px;
    display: block;
}

/* Question text */
.question {
    font-weight: bold;
    margin-bottom: 12px;
    color: #333;
    font-size: 14px;
}

/* Answer alternatives */
.alternatives {
    margin: 12px 0;
    padding-left: 0;
    list-style: none;
    counter-reset: alternative-counter;
}

.alternatives li {
    display: block;
    margin: 6px 0;
    padding: 6px 10px 6px 32px;
    background-color: #f9f9f9;
    border-left: 3px solid #003366;
    border-radius: 3px;
    position: relative;
    counter-increment: alternative-counter;
    font-size: 14px;
}

.alternatives li:before {
    content: counter(alternative-counter) ".";
    position: absolute;
    left: 10px;
    font-weight: bold;
    color: #003366;
}

.alternatives li:hover {
    background-color: #e8f4f8;
}

/* Answer link */
.answer-link {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    background-color: #003366;
    color: white;
    text-decoration: none;
    border-radius: 3px;
    font-weight: bold;
    font-size: 13px;
}

.answer-link:hover {
    background-color: #004080;
}

/* Information boxes (Ohms lov, etc) */
.info-box {
    border: 2px solid #4CAF50;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    background-color: #f1f8f4;
}

.info-box .info-title {
    font-weight: bold;
    font-size: 16px;
    color: #2e7d32;
    margin-bottom: 8px;
    display: block;
}

.info-box .info-content {
    font-weight: bold;
    margin: 8px 0;
    color: #333;
    font-size: 14px;
}

.info-box img {
    display: block;
    margin: 12px auto;
    max-width: 100%;
    height: auto;
}

/* Formula table in info boxes */
.formula-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    border: 2px solid #4CAF50;
    font-size: 14px;
}

.formula-table th,
.formula-table td {
    border: 1px solid #4CAF50;
    padding: 8px;
    text-align: left;
}

.formula-table th {
    background-color: #e8f5e9;
    font-weight: bold;
    color: #2e7d32;
    border: 1px solid #4CAF50;
}

.formula-table td:first-child {
    font-weight: bold;
    background-color: #e8f5e9;
    border-right: 2px solid #4CAF50;
}

.formula-table tr:hover td {
    background-color: #dcedc8;
}

/* Image in exercises */
.exercise img {
    display: block;
    margin: 12px auto;
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 4px;
    background-color: white;
}

/* Utility classes */
.center {
    text-align: center;
}

/* Answers page styling */
.answers-container {
    background-color: white;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.answer {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    background-color: #ffffff;
    scroll-margin-top: 15px;
}

.answer:target {
    border-color: #003366;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.answer h2 {
    color: #003366;
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 17px;
    border-bottom: 2px solid #003366;
    padding-bottom: 8px;
}

.answer p {
    margin: 8px 0;
    font-size: 14px;
}

.back-to-question {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.back-to-question a {
    color: #003366;
    text-decoration: none;
    font-size: 13px;
}

.back-to-question a:hover {
    text-decoration: underline;
}

/* Correct alternative indicator */
.correct-alternative {
    background-color: #e8f5e9;
    border-left: 4px solid #4CAF50;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-weight: bold;
    color: #2e7d32;
    border-radius: 3px;
    font-size: 14px;
}

/* MathML styling */
.unit {
  font-variant-numeric: lining-nums;
  font-weight: normal;
}
.unit-space {
  width: 0.2em;      /* default SI-like spacing */
  min-width: 0;      /* ensure it doesn’t collapse in some renderers */
  display: inline-block; /* required for CSS to affect MathML */
}
/* Print styles */
@media print {
    @page {
        margin: 2cm 1.5cm;
        size: A4;
        
        @top-center {
            content: "LA9M - Øvingsoppgaver for radioamatørlisens";
            font-family: Arial, sans-serif;
            font-size: 9pt;
            color: #666;
        }
        
        @bottom-left {
            content: "© LA9M - Moldegruppen av NRRL";
            font-family: Arial, sans-serif;
            font-size: 8pt;
            color: #666;
        }
        
        @bottom-right {
            content: "Side " counter(page) " av " counter(pages);
            font-family: Arial, sans-serif;
            font-size: 8pt;
            color: #666;
        }
    }

    body {
        font-size: 10pt;
        line-height: 1.4;
        max-width: 100%;
        margin: 0;
        padding: 10px;
        background-color: white;
    }

    .header {
        background-color: white;
        color: black;
        border: 2px solid #003366;
        padding: 10px;
        margin-bottom: 15px;
        page-break-after: avoid;
    }

    .header h1 {
        font-size: 16pt;
    }

    .header p {
        font-size: 10pt;
    }

    /* Hide links when printing */
    .back-link,
    .answer-link,
    .back-to-question,
    .pdf-download {
        display: none;
    }

    /* Container adjustments */
    .exercises-container,
    .answers-container {
        padding: 0;
        box-shadow: none;
        background-color: white;
    }

    /* Prevent page breaks inside questions and answers */
    .exercise,
    .answer {
        page-break-inside: avoid;
        break-inside: avoid;
        border: 1px solid #ccc;
        padding: 10px;
        margin-bottom: 12px;
        box-shadow: none;
    }

    .exercise:hover,
    .answer:target {
        border-color: #ccc;
        box-shadow: none;
    }

    .exercise-number {
        font-size: 11pt;
    }

    .question {
        font-size: 10pt;
        margin-bottom: 8px;
    }

    .alternatives {
        margin: 8px 0;
    }

    .alternatives li {
        font-size: 10pt;
        padding: 4px 8px 4px 33px;
        margin: 4px 0;
        background-color: #f9f9f9;
        page-break-inside: avoid;
    }

    .alternatives li:hover {
        background-color: #f9f9f9;
    }

    /* Info boxes */
    .info-box {
        page-break-inside: avoid;
        break-inside: avoid;
        padding: 10px;
        margin-bottom: 12px;
        border: 2px solid #4CAF50;
    }

    .info-box .info-title {
        font-size: 11pt;
    }

    .info-box .info-content {
        font-size: 10pt;
    }

    /* Answer page specific */
    .answer h2 {
        font-size: 12pt;
        page-break-after: avoid;
    }

    .answer p {
        font-size: 10pt;
    }

    .correct-alternative {
        font-size: 10pt;
        padding: 8px 10px;
        page-break-inside: avoid;
    }

    /* Images */
    .exercise img,
    .info-box img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    /* Formula table */
    .formula-table {
        font-size: 9pt;
        page-break-inside: avoid;
    }

    .formula-table th,
    .formula-table td {
        padding: 5px;
    }

    .formula-table tr:hover td {
        background-color: transparent;
    }
}

/* External link indicator */
a[href^="http://"]:not([href*="qsl.net/la9m"]):not([href*="la9m."]):after,
a[href^="https://"]:not([href*="qsl.net/la9m"]):not([href*="la9m."]):after {
    content: "";
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    margin-left: 0.2em;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="%230563C1" d="M14 2H9.5l1.8 1.8-4.6 4.6 1.4 1.4 4.6-4.6L14 6.5V2zM12 12H4V4h4l-2-2H2v12h12V9l-2-2v5z"/></svg>');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    vertical-align: middle;
}

/* Screen reader text for external links */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}