﻿/* AllaRätt.nu – isolerad frågekomponent.
   Alla väljare ligger under .hp-diagnos. Ingen global CSS ändras eller krävs.
   Visuell grund hämtad från design-dark.css och test.css (2026-11-14). */
.hp-diagnos{box-sizing:border-box;max-width:800px;margin:20px auto;padding:0 12px;color:#fff;font-family:'Source Sans Pro',system-ui,-apple-system,sans-serif;line-height:1.55}
.hp-diagnos *, .hp-diagnos *::before,.hp-diagnos *::after{box-sizing:border-box}
.hp-diagnos .hpq-intro{color:#cfd3dc;margin:0 0 18px}
.hp-diagnos .hpq-switch{display:flex;gap:8px;flex-wrap:wrap;margin:16px 0}
.hp-diagnos .hpq-switch button{background:#242935;color:#fff;border:1px solid #444b59;border-radius:8px;padding:10px 18px;cursor:pointer}
.hp-diagnos .hpq-switch button[aria-pressed="true"]{border-color:#1ed760}
.hp-diagnos .box{display:block;width:100%;min-width:0;min-height:0;height:auto;background:rgba(26,29,37,.96);border-radius:18px;border:1px solid rgba(255,255,255,.08);padding:16px}
.hp-diagnos .box-header{margin:0 0 12px;padding:0;display:flex;align-items:center;gap:8px}
.hp-diagnos .box-title{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0;font-size:23px;font-weight:700;letter-spacing:.3px;color:#fff}
.hp-diagnos .badge{display:inline-block;width:40px;padding:3px 7px;font-size:13px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:999px;letter-spacing:.05em;text-shadow:0 1px 2px rgba(0,0,0,.35);text-transform:uppercase}
.hp-diagnos .badge.xyz{background:linear-gradient(135deg,#7a5f00,#c49b00,#7a5f00);border:1.5px solid rgb(168,136,0);box-shadow:0 0 0 1px rgba(168,136,0,.25),0 2px 8px rgba(168,136,0,.3),inset 0 1px rgba(255,220,80,.2)}
.hp-diagnos .badge.ord{background:linear-gradient(135deg,#bb1511,#f59391);border:1.5px solid #bb1511;box-shadow:0 0 0 1px rgba(187,21,17,.3),0 2px 6px rgba(187,21,17,.35)}
.hp-diagnos .badge.kva{background:linear-gradient(135deg,#2d6e1a,#4aaa28,#2d6e1a);border:1.5px solid rgb(50,120,20)}
.hp-diagnos .badge.nog{background:linear-gradient(135deg,#0a3f88,#1162c7,#0a3f88);border:1.5px solid #4ca3ff}
.hp-diagnos .badge.dtk{background:linear-gradient(135deg,#004a4d,#00c5ca);border:1.5px solid #00292a}
.hp-diagnos .badge.las{background:linear-gradient(135deg,#4a4a4a,#a8a8a8,#4a4a4a);border:1.5px solid #787878}
.hp-diagnos .badge.mek{background:linear-gradient(135deg,#5e47d8,#8b73ff,#5e47d8);border:1.5px solid #c1b4ff}
.hp-diagnos .badge.elf{background:linear-gradient(135deg,#8a3005,#d45a0a,#8a3005);border:1.5px solid #a03c08}
.hp-diagnos .box-body{width:100%;margin:0;background:rgba(15,17,23,.9);border-radius:14px;padding:14px}
.hp-diagnos .question{margin:12px 0 18px;padding:14px 16px;background:linear-gradient(90deg,rgba(255,255,255,.06),rgba(255,255,255,.02));border-radius:14px;border:1px solid rgba(255,255,255,.08);font-size:1.05rem;font-weight:500;line-height:1.55;color:#f3f4f6;text-align:left}
.hp-diagnos .question mjx-container{font-size:1em!important;line-height:normal}
.hp-diagnos .answer-row{color:#fff;display:flex;width:100%;align-items:center;gap:12px;padding:14px 16px;margin:0 0 10px;border-radius:14px;background:transparent;border:2px solid rgba(255,255,255,.08);cursor:pointer;transition:background-color .2s,border-color .2s;position:relative;text-align:left;font:inherit;min-height:62px}
.hp-diagnos .answer-row:hover:not(:disabled){background:rgba(255,255,255,.07)}
.hp-diagnos .answer-label{flex:0 0 36px;height:36px;display:grid;place-items:center;border-radius:50%;font-weight:700;font-size:15px;background:transparent;border:2px solid rgba(255,255,255,.18);color:white}
.hp-diagnos .answer-text{font-size:16px;line-height:1.35;min-width:0;overflow-wrap:anywhere}
.hp-diagnos .answer-row.answered{background:rgba(46,102,255,.85);border-color:#2e66ff}
.hp-diagnos .answer-row.correct-selected,.hp-diagnos .answer-row.correct-answer{background:rgba(76,189,89,.85);border-color:#4cbd59}
.hp-diagnos .answer-row.wrong-selected{background:rgba(244,67,54,.9);border-color:#f44336}
.hp-diagnos .answer-row.answered .answer-label,.hp-diagnos .answer-row.correct-selected .answer-label,.hp-diagnos .answer-row.correct-answer .answer-label,.hp-diagnos .answer-row.wrong-selected .answer-label{border-color:#fff}
.hp-diagnos button:focus-visible{outline:2px solid #1ed760;outline-offset:3px}
.hp-diagnos .box-end{margin-top:12px}
.hp-diagnos .box-end .source,.hp-diagnos .box-end .subsource{display:flex;align-items:center;gap:8px;color:#fff;font-size:14px;font-weight:400;padding:6px;margin:0}
.hp-diagnos .box-end .subsource{font-size:13px;font-style:italic;color:#cfd3dc}
.hp-diagnos .hpq-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:18px 0}
.hp-diagnos .hpq-button{border:0;border-radius:9px;background:#1ed760;color:#08110a;padding:11px 18px;font:700 15px 'Source Sans Pro',sans-serif;cursor:pointer}
.hp-diagnos .hpq-button:disabled{opacity:.45;cursor:not-allowed}
.hp-diagnos .hpq-info{color:#cfd3dc;font-size:14px}
.hp-diagnos .hpq-feedback{
  border-radius:12px;
  border:1px solid rgba(59,99,69,.45);
  background:#14161a; /* samma som svarsalternativen */
  padding:14px;
  margin:12px 0;
}
.hp-diagnos .hpq-feedback[hidden]{display:none}
.hp-diagnos .question img,.hp-diagnos .answer-text img{max-width:100%;height:auto}
.hp-diagnos .question table{max-width:100%;display:block;overflow-x:auto}
@media(max-width:768px){.hp-diagnos{padding:0 10px}.hp-diagnos .box{padding:12px}.hp-diagnos .box-body{padding:10px}.hp-diagnos .box-title{font-size:19px}.hp-diagnos .hpq-actions{flex-wrap:wrap}.hp-diagnos .answer-row{padding:12px 14px}.hp-diagnos .answer-text{font-size:15px}}

/* ========================================
   DIAGNOS – BREDD OCH KOMPAKT LAYOUT
   ======================================== */

/* Samma bredd för alla frågetyper */
.hp-diagnos {
    width: 100%;
    max-width: 560px;
    margin: 0;
}

/* Frågepanelen */
.hp-diagnos .box {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    border-radius: 14px;
}

/* Rubrik */
.hp-diagnos .box-title {
    font-size: 20px;
    gap: 8px;
}

.hp-diagnos .box-header {
    margin-bottom: 8px;
}

/* Innehåll */
.hp-diagnos .box-body {
    padding: 10px;
    border-radius: 12px;
}

/* Frågetext */
.hp-diagnos .question {
    margin: 6px 0 10px;
    padding: 12px;
    font-size: 15px;
    line-height: 1.4;
    border-radius: 10px;
}

/* Svarsalternativ */
.hp-diagnos .answer-row {
    min-height: 44px;
    padding: 9px 12px;
    margin-bottom: 6px;
    gap: 10px;
    border-radius: 10px;
}

/* A, B, C, D, E */
.hp-diagnos .answer-label {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    font-size: 13px;
}

/* Svarstext */
.hp-diagnos .answer-text {
    font-size: 15px;
    line-height: 1.3;
}

/* Källa och ämnesinformation */
.hp-diagnos .box-end .source,
.hp-diagnos .box-end .subsource {
    font-size: 12px;
    padding: 4px;
    margin: 0;
}

/* Mobil */
@media (max-width: 600px) {
    .hp-diagnos {
        max-width: 100%;
    }

    .hp-diagnos .box {
        padding: 10px;
    }

    .hp-diagnos .question {
        padding: 10px;
    }
}

/* Yttre container */
.hp-diagnos {
    width: 560px;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    box-sizing: border-box;
}

/* Samma bredd oavsett frågetyp */
.hp-diagnos .box,
.hp-diagnos .box-body,
.hp-diagnos .question {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* MathJax ska inte bestämma containerns bredd */
.hp-diagnos .question {
    overflow-x: auto;
    overflow-y: hidden;
}

/* Behåll matematiska uttryck på samma rad */
.hp-diagnos mjx-container {
    max-width: none;
}


/* Kompakt statusrad */
.hp-diagnos .diagnos-status {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
    margin-bottom: 8px;
}

/* Statusfält */
.hp-diagnos .diagnos-status-item {
    min-width: 0;
}

/* Rubriker */
.hp-diagnos .diagnos-status .bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 11px;
    line-height: 1.2;
    color: #cfd3dc;
}

/* Staplar */
.hp-diagnos .diagnos-status .bar-track {
    height: 5px;
    background: rgba(255,255,255,.12);
    border-radius: 6px;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

/* Progress */
.hp-diagnos .diagnos-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg,#1565C0,#2196F3);
    transition: width .25s ease;
}

/* Timer */
.hp-diagnos .diagnos-timer-fill {
    height: 100%;
    width: 100%;
    background: #4CAF50;
    transition: width 1s linear;
}

@media (max-width: 480px) {
    .hp-diagnos .diagnos-status {
        gap: 12px;
    }
}
