/* ============================================
   ANKI QUIZ MANAGER - Modulo Teoria (front-end + admin)
   ============================================ */

/* ---------- Botao no card do quiz ---------- */
.anki-question-toolbar .anki-theory-btn {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background .15s, border-color .15s, color .15s;
}

.anki-question-toolbar .anki-theory-btn:hover {
    background: #eef6fb;
    border-color: var(--anki-primary, #13455B);
    color: var(--anki-primary, #13455B);
}

.anki-quiz-container.dark-mode .anki-question-toolbar .anki-theory-btn {
    border-color: #4b5563;
    color: #e5e7eb;
}

.anki-quiz-container.dark-mode .anki-question-toolbar .anki-theory-btn:hover {
    background: #1f2937;
    border-color: #60a5fa;
    color: #60a5fa;
}

/* ---------- Caixa de teoria (shortcode) ---------- */
.anki-theory-box {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px 24px;
    margin: 16px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.anki-theory-head {
    border-bottom: 2px solid var(--anki-primary, #13455B);
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.anki-theory-title {
    font-size: 20px;
    margin: 0 0 4px;
    color: var(--anki-primary, #13455B);
    line-height: 1.3;
}

.anki-theory-meta {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

/* ---------- Tipografia do conteudo teorico ---------- */
.anki-theory-content {
    font-size: 15px;
    line-height: 1.65;
    color: #1f2937;
    word-break: break-word;
}

.anki-theory-content h3 {
    font-size: 16px;
    margin: 18px 0 8px;
    color: var(--anki-primary, #13455B);
    border-left: 4px solid var(--anki-primary, #13455B);
    padding-left: 10px;
}

.anki-theory-content p {
    margin: 0 0 10px;
}

.anki-theory-content ul,
.anki-theory-content ol {
    margin: 0 0 10px;
    padding-left: 22px;
}

.anki-theory-content li {
    margin-bottom: 4px;
}

.anki-theory-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
}

.anki-theory-content th {
    background: var(--anki-primary, #13455B);
    color: #ffffff;
    text-align: left;
}

.anki-theory-content th,
.anki-theory-content td {
    border: 1px solid #d1d5db;
    padding: 6px 10px;
}

.anki-theory-content tr:nth-child(even) td {
    background: #f9fafb;
}

.anki-theory-content blockquote {
    margin: 12px 0;
    padding: 10px 14px;
    background: #f3f6f8;
    border-left: 4px solid var(--anki-primary, #13455B);
    border-radius: 4px;
    font-style: italic;
    color: #374151;
}

.anki-theory-content code {
    background: #eef1f4;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 13px;
}

.anki-theory-content mark {
    background: #fde68a;
    padding: 0 3px;
    border-radius: 2px;
}

/* ---------- Indice / acordeao ---------- */
.anki-theory-index-title {
    font-size: 20px;
    color: var(--anki-primary, #13455B);
    margin-bottom: 12px;
}

.anki-theory-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #ffffff;
    overflow: hidden;
}

.anki-theory-item summary {
    cursor: pointer;
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    list-style: none;
}

.anki-theory-item summary::-webkit-details-marker {
    display: none;
}

.anki-theory-item summary::before {
    content: "\25B8";
    color: var(--anki-primary, #13455B);
    margin-right: 8px;
    transition: transform .15s;
}

.anki-theory-item[open] summary::before {
    transform: rotate(90deg);
}

.anki-theory-item-title {
    font-weight: 600;
    color: #111827;
    font-size: 15px;
}

.anki-theory-item-meta {
    font-size: 12px;
    color: #6b7280;
}

.anki-theory-item-body {
    padding: 4px 16px 16px;
    border-top: 1px solid #f0f1f3;
}

/* ---------- Paginacao (capitulos / paginas) ---------- */
.anki-theory-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.anki-theory-page-btn {
    background: var(--anki-primary, #13455B);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: opacity .12s;
}

.anki-theory-page-btn:hover:not(:disabled) {
    opacity: .85;
}

.anki-theory-page-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.anki-theory-page-info {
    font-size: 13px;
    color: #6b7280;
}

.anki-theory-modal-body .anki-theory-pagination {
    margin-bottom: 4px;
}

.anki-theory-modal-overlay.dark-mode .anki-theory-pagination {
    border-top-color: #374151;
}

.anki-theory-modal-overlay.dark-mode .anki-theory-page-info {
    color: #9ca3af;
}

/* ---------- Modal (ver teoria no quiz) ---------- */
.anki-theory-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: anki-theory-fade .15s ease;
}

.anki-theory-modal {
    background: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 760px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, .25);
    animation: anki-theory-pop .18s ease;
}

.anki-theory-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    background: var(--anki-primary, #13455B);
    color: #ffffff;
}

.anki-theory-modal-title {
    font-size: 17px;
    margin: 0;
    line-height: 1.3;
}

.anki-theory-modal-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    opacity: .85;
}

.anki-theory-modal-close:hover {
    opacity: 1;
}

.anki-theory-modal-body {
    padding: 18px 20px;
    overflow-y: auto;
}

.anki-theory-modal-loading {
    color: #6b7280;
    font-size: 14px;
    text-align: center;
    padding: 30px 0;
}

.anki-theory-modal-error {
    color: #b91c1c;
    font-size: 14px;
    padding: 20px;
}

/* ---------- Modal em modo escuro ---------- */
.anki-theory-modal-overlay.dark-mode .anki-theory-modal {
    background: #111827;
    border: 1px solid #334155;
}

.anki-theory-modal-overlay.dark-mode .anki-theory-modal-body {
    background: #111827;
    color: #e5e7eb;
}

.anki-theory-modal-overlay.dark-mode .anki-theory-content {
    color: #e5e7eb;
}

.anki-theory-modal-overlay.dark-mode .anki-theory-content h3 {
    color: #93c5fd;
    border-left-color: #60a5fa;
}

.anki-theory-modal-overlay.dark-mode .anki-theory-meta {
    color: #9ca3af;
}

.anki-theory-modal-overlay.dark-mode .anki-theory-content table {
    color: #e5e7eb;
}

.anki-theory-modal-overlay.dark-mode .anki-theory-content th,
.anki-theory-modal-overlay.dark-mode .anki-theory-content td {
    border-color: #374151;
}

.anki-theory-modal-overlay.dark-mode .anki-theory-content tr:nth-child(even) td {
    background: #1f2937;
}

.anki-theory-modal-overlay.dark-mode .anki-theory-content blockquote {
    background: #1f2937;
    color: #d1d5db;
    border-left-color: #60a5fa;
}

.anki-theory-modal-overlay.dark-mode .anki-theory-content code {
    background: #1f2937;
}

.anki-theory-modal-overlay.dark-mode .anki-theory-content mark {
    background: #78350f;
    color: #fde68a;
}

.anki-theory-modal-overlay.dark-mode .anki-theory-modal-loading {
    color: #9ca3af;
}

@keyframes anki-theory-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes anki-theory-pop {
    from { transform: scale(.96) translateY(8px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ---------- Admin: badges ---------- */
.anki-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e5e7eb;
    color: #374151;
}

.anki-badge-ok {
    background: #d1fae5;
    color: #065f46;
}

.anki-badge-warn {
    background: #fef3c7;
    color: #92400e;
}

.anki-danger {
    color: #b91c1c !important;
    border-color: #fca5a5 !important;
}