/* ===== app.css — 补充组件样式（继承 style.css 变量）===== */

/* ---- Search Input ---- */
.search-wrap {
    position: relative;
    margin-bottom: 8px;
}

.search-input {
    width: 100%;
    padding: 10px 36px 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.search-input:focus {
    border-color: var(--gold-accent);
    box-shadow: 0 0 0 2px rgba(197, 160, 89, 0.25);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.1rem;
    pointer-events: none;
}

/* ---- Reset Button ---- */
.btn-reset {
    margin-top: 4px;
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* ---- DB Stats ---- */
.db-stats {
    margin-top: 8px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.db-stats-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
}

.stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gold-accent);
    font-family: var(--font-heading);
}

.stat-row.clickable {
    cursor: pointer;
    transition: background 0.2s;
}

.stat-row.clickable:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #fff;
    width: 90%;
    max-width: 600px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: all 0.3s ease;
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--royal-blue);
    color: #fff;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-dark);
    white-space: pre-wrap;
}

.stat-sources {
    margin-top: 10px;
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.35);
    line-height: 1.6;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding-top: 8px;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 16px 0;
    align-items: center;
}

.pagination:empty {
    margin: 0;
}

.page-btn {
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: #fff;
    color: var(--text-dark);
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 38px;
    text-align: center;
}

.page-btn:hover {
    border-color: var(--gold-accent);
    color: var(--gold-accent);
}

.page-btn.active {
    background: var(--royal-blue);
    color: #fff;
    border-color: var(--royal-blue);
    font-weight: 700;
}

.page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.83rem;
    color: var(--text-grey);
    margin-left: 4px;
}

/* ---- Question Card enhancements ---- */
.card-number {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(0, 33, 71, 0.35);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.card-source {
    font-size: 0.74rem;
    color: var(--text-grey);
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-source .source-name {
    color: var(--text-grey);
}

.card-source .source-page {
    font-weight: 600;
    color: rgba(0, 33, 71, 0.4);
}

/* ---- Five-dim difficulty bar ---- */
.dim-bar-wrapper {
    background: rgba(0, 33, 71, 0.03);
    border-radius: 10px;
    padding: 12px 16px;
    margin-top: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.dim-bar-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(0, 33, 71, 0.4);
    min-width: 26px;
    text-align: center;
}

.dim-pip-row {
    display: flex;
    gap: 3px;
}

.dim-pip {
    width: 8px;
    height: 8px;
    border-radius: 3px;
    background: rgba(0, 33, 71, 0.1);
    transition: background 0.2s;
}

.dim-pip.active {
    background: var(--royal-blue);
}

/* cognitive = blue */
.dim-cognitive .dim-pip.active {
    background: #3f51b5;
}

/* knowledge = teal */
.dim-knowledge .dim-pip.active {
    background: #009688;
}

/* calculation = gold */
.dim-calculation .dim-pip.active {
    background: var(--gold-accent);
}

/* abstract = sienna */
.dim-abstract .dim-pip.active {
    background: #A0522D;
}

/* context = grey */
.dim-context .dim-pip.active {
    background: #78909c;
}

.dim-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.dim-badge {
    font-size: 0.68rem;
    color: rgba(0, 33, 71, 0.5);
    font-weight: 500;
}

/* ---- Overall difficulty badge ---- */
.overall-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.diff-D1 {
    background: rgba(0, 150, 136, 0.1);
    color: #009688;
}

.diff-D2 {
    background: rgba(63, 81, 181, 0.1);
    color: #3f51b5;
}

.diff-D3 {
    background: rgba(197, 160, 89, 0.12);
    color: #b8861a;
}

.diff-D4 {
    background: rgba(229, 57, 53, 0.1);
    color: #c62828;
}

.diff-D5 {
    background: rgba(106, 27, 154, 0.1);
    color: #6a1b9a;
}

/* ---- MathJax rendering area ---- */
.question-stem mjx-container,
.options-list mjx-container {
    overflow-x: auto;
    max-width: 100%;
}

/* ---- Empty state ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 80px 24px;
    color: var(--text-grey);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
}

.empty-state p {
    font-size: 1rem;
}
/* ---- Answer Section ---- */
.question-card {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.question-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 33, 71, 0.08);
}

.answer-toggle-hint {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 0.72rem;
    color: var(--text-grey);
    opacity: 0.5;
    transition: opacity 0.2s;
}

.question-card:hover .answer-toggle-hint {
    opacity: 1;
}

.answer-section {
    display: none;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--border-light);
    animation: fadeIn 0.3s ease-out;
}

.answer-section.visible {
    display: block;
}

.answer-label {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--royal-blue);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.answer-content {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--royal-blue);
    margin-bottom: 16px;
}

.explanation-label {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--gold-accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.explanation-content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-dark);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
