/* =========================================================
   Dr. Market FAQ 区块样式
   ========================================================= */

.dm-faq {
    margin: 32px auto 40px;
    max-width: 100%;
    color: #374151;
    line-height: 1.7;
    box-sizing: border-box;
}

.dm-faq *,
.dm-faq *::before,
.dm-faq *::after {
    box-sizing: border-box;
}

/* —— 标题(蓝色胶囊) —— */
.dm-faq__title {
    display: block;
    width: max-content;
    max-width: 100%;
    margin: 0 auto -20px;
    padding: 8px 28px;
    background: #0099B1;
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    border-radius: 999px;
    text-align: center;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 999;
}

/* —— 列表 —— */
.dm-faq__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #F5F5F5;
    padding: 36px 24px;
    border-radius: 15px;
}

/* —— 单条 —— */
.dm-faq__item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.dm-faq__item:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
    border-color: #d1d5db;
}

/* —— 问题行 —— */
.dm-faq__q {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    margin: 0;
    cursor: pointer;
    user-select: none;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
}

.dm-faq__q::-webkit-details-marker { display: none; }
.dm-faq__q:focus { outline: none; }
.dm-faq__q:focus-visible {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

/* —— Q / A 圆形徽章 —— */
.dm-faq__badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
}

.dm-faq__badge--q { color: #44B1C2; }
.dm-faq__badge--a { color: #F2B753; }

/* —— 问题文字 —— */
.dm-faq__question {
    flex: 1;
    min-width: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    line-height: 1.5;
    word-break: break-word;
}

/* —— + / − 切换图标 —— */
.is-open .dm-faq__toggle {
    background: #F2B753;
}

.dm-faq__toggle {
    flex-shrink: 0;
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #44B1C2;
    transition: background 0.2s ease;
    color: #ffffff !important;
}

.dm-faq__q:hover .dm-faq__toggle { background: #e5e7eb; }

.dm-faq__toggle::before,
.dm-faq__toggle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    background: #6b7280;
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.dm-faq__toggle::before {
    width: 14px;
    height: 2px;
    transform: translate(-50%, -50%);
    background: #ffffff !important;
}

.dm-faq__toggle::after {
    width: 2px;
    height: 14px;
    transform: translate(-50%, -50%);
     background: #ffffff !important;
}

.dm-faq__item.is-open .dm-faq__toggle::after {
    transform: translate(-50%, -50%) scaleY(0);
    opacity: 0;
}

/* —— 答案区域 —— */
.dm-faq__body {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 0 22px;
    max-height: 1200px;
    overflow: hidden;
    transition: max-height 0.32s ease, padding 0.32s ease, opacity 0.25s ease;
    opacity: 1;
}

.dm-faq__body.is-collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    pointer-events: none;
}

.dm-faq__answer {
    flex: 1;
    min-width: 0;
    padding: 4px 0 20px;
    font-size: 14px;
    line-height: 1.75;
    color: #4b5563;
}

.dm-faq__answer p {
    margin: 0;
}

.dm-faq__answer p + p { margin-top: 10px; }

.dm-faq__answer a { color: #1d4ed8; text-decoration: none; }
.dm-faq__answer a:hover { text-decoration: underline; }
.dm-faq__answer strong { color: #111827; }

/* ===== 响应式 ===== */
@media (max-width: 640px) {
    .dm-faq__title {
        font-size: 16px;
        padding: 7px 20px;
    }
    .dm-faq__q {
        padding: 14px 16px;
        gap: 10px;
    }
    .dm-faq__body {
        padding: 0 16px;
        gap: 10px;
    }
    .dm-faq__question {
        font-size: 14px;
    }
    .dm-faq__answer {
        font-size: 13px;
        padding-bottom: 16px;
    }
    .dm-faq__badge {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* ===== 暗色模式 ===== */
@media (prefers-color-scheme: dark) {
    .dm-faq__item {
        background: #1f2937;
        border-color: #374151;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }
    .dm-faq__item:hover {
        border-color: #4b5563;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    }
    .dm-faq__question { color: #f3f4f6; }
    .dm-faq__answer   { color: #d1d5db; }
    .dm-faq__answer strong { color: #f9fafb; }
    .dm-faq__toggle   { background: #374151; }
    .dm-faq__toggle::before,
    .dm-faq__toggle::after { background: #d1d5db; }
    .dm-faq__q:hover .dm-faq__toggle { background: #4b5563; }
}
