/* =================================================================
 * Page Specific Styles for Driver's License Quiz
 * Standard Size & Dark Mode Visibility Fix
 * ================================================================= */

/* --- ローディングオーバーレイ --- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1090;
    backdrop-filter: blur(3px);
}

/* --- クイズカード本体 --- */
#quiz-card {
    min-height: 550px;
    position: relative;
    overflow: hidden;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
    border-radius: 1rem;
    transition: background-color 0.3s;
}

/* --- 選択肢ボタン --- */
.option-btn {
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-width: 2px;
    border-radius: 12px;
}

.option-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.option-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* --- モード選択ボタン --- */
.mode-btn {
    transition: all 0.2s ease;
    border-width: 2px;
    background-color: transparent;
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* 各モードの色設定（ダークモード対応） */
/* 1. 一般モード (青) */
.mode-btn[data-mode="general"]:hover {
    background-color: #cfe2ff !important;
    color: #084298 !important;
    border-color: #084298 !important;
}

/* 2. 標識モード (緑) */
.mode-btn[data-mode="sign"]:hover {
    background-color: #d1e7dd !important;
    color: #0f5132 !important;
    border-color: #0f5132 !important;
}

/* 3. 危険予測モード (黄) - 視認性修正 */
.mode-btn[data-mode="danger"] {
    color: #856404;
    border-color: #ffc107;
}

.mode-btn[data-mode="danger"]:hover {
    background-color: #fff3cd !important;
    color: #533f03 !important;
    /* 濃い茶色 */
    border-color: #ffc107 !important;
}

/* ダークモード時の黄色ボタンの視認性確保 */
[data-bs-theme="dark"] .mode-btn[data-mode="danger"] {
    color: #ffc107;
    border-color: #ffc107;
}

[data-bs-theme="dark"] .mode-btn[data-mode="danger"]:hover {
    background-color: #ffc107 !important;
    color: #000000 !important;
    /* 黒文字 */
}

/* 4. 苦手克服モード (赤) */
.mode-btn[data-mode="weakness"]:hover {
    background-color: #f8d7da !important;
    color: #842029 !important;
    border-color: #842029 !important;
}


/* --- 標識・イラスト画像スタイル --- */
img.sign-image {
    /* 画像サイズ調整：大きすぎず、小さすぎず */
    height: auto;
    max-height: 280px;
    /* バランスの良い高さに制限 */
    width: auto;
    max-width: 100%;
    object-fit: contain;

    /* どんな背景色でも視認できるように「白背景カード」化 */
    background-color: #ffffff !important;
    border-radius: 12px;
    padding: 10px;

    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #dee2e6 !important;

    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

[data-bs-theme="dark"] img.sign-image {
    background-color: #ffffff !important;
    border-color: #495057 !important;
}

img.sign-image:hover {
    transform: scale(1.02);
}


/* --- ダークモード時の視認性修正（重要） --- */

/* 1. 白背景カードの文字が見えない問題の修正 */
/* ダークモード時はカード背景を暗くし、文字を白にする */
[data-bs-theme="dark"] .bg-white {
    background-color: #2b3035 !important;
    color: #e9ecef !important;
    border: 1px solid #495057;
}

/* カード内の見出しやテキスト */
[data-bs-theme="dark"] .bg-white .fw-bold,
[data-bs-theme="dark"] .bg-white .small,
[data-bs-theme="dark"] .bg-white i {
    color: #e9ecef !important;
}

/* 2. 黄色バッジの文字が見えない問題の修正 */
.badge.bg-warning {
    color: #000000 !important;
    /* 強制的に黒文字 */
}

/* 3. 問題文の視認性（黄色文字） */
[data-bs-theme="dark"] #question-text {
    color: #ffc107;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    /* 軽い影で読みやすく */
}


/* --- フィードバックオーバーレイ --- */
.feedback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.98);
    display: none;
    z-index: 10;
    animation: fadeIn 0.2s ease-out;
}

[data-bs-theme="dark"] .feedback-overlay {
    background-color: rgba(33, 37, 41, 0.98) !important;
}

.scrollable-feedback {
    max-height: 200px;
    overflow-y: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.text-correct {
    color: #198754 !important;
}

.text-incorrect {
    color: #dc3545 !important;
}

/* スタンプ */
.pass-stamp,
.fail-stamp {
    display: inline-block;
    padding: 10px 40px;
    font-size: 2.5rem;
    font-family: "Impact", sans-serif;
    font-weight: 800;
    border-radius: 8px;
    transform: rotate(-8deg);
    opacity: 0.9;
    letter-spacing: 0.1em;
}

.pass-stamp {
    color: #198754;
    border: 4px solid #198754;
    background-color: rgba(25, 135, 84, 0.1);
}

.fail-stamp {
    color: #dc3545;
    border: 4px solid #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

/* 記事エリア */
.prose {
    line-height: 1.8;
}

.prose h3 {
    border-left: 4px solid var(--bs-primary);
    padding-left: 1rem;
}

/* ダークモード基本文字色 */
[data-bs-theme="dark"] #quiz-card {
    background-color: #2b3035;
}

[data-bs-theme="dark"] .text-secondary,
[data-bs-theme="dark"] .text-dark,
[data-bs-theme="dark"] .text-muted {
    color: #e9ecef !important;
}

[data-bs-theme="dark"] .card.bg-light {
    background-color: #343a40 !important;
}

[data-bs-theme="dark"] #feedback-text {
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .list-group-item {
    color: #e9ecef;
    border-color: #495057;
    background-color: transparent;
}