/**
 * WebBiz Toolkit - 前台共用樣式
 *
 * @version 1.0.0
 */

/* ==========================================================================
   文字強調樣式
   注意：實際樣式由後台設定動態產生，此處僅保留基礎回退
   ========================================================================== */

/* ==========================================================================
   Spoiler 劇透遮罩 - 三種樣式
   ========================================================================== */

/* 共用基礎樣式 */
[class*="webbiz-spoiler--"] {
    display: inline;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

/* 樣式 1：模糊 */
.webbiz-spoiler--blur {
    background: #374151;
    color: transparent;
    padding: 1px 6px;
    border-radius: 3px;
    filter: blur(4px);
}

.webbiz-spoiler--blur:hover {
    filter: blur(2px);
}

.webbiz-spoiler--blur.webbiz-spoiler--revealed {
    color: #fff;
    filter: blur(0);
    user-select: auto;
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
}

/* 樣式 2：塗黑 */
.webbiz-spoiler--blackout {
    background: #1f2937;
    color: #1f2937;
    padding: 2px 6px;
    border-radius: 3px;
}

.webbiz-spoiler--blackout:hover {
    background: #374151;
    color: #374151;
}

.webbiz-spoiler--blackout.webbiz-spoiler--revealed {
    color: #fff;
    user-select: auto;
    background: #1f2937;
}

/* 樣式 3：底線 */
.webbiz-spoiler--underline {
    color: transparent;
    text-decoration: underline;
    text-decoration-color: #dc2626;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
    background: repeating-linear-gradient(
        90deg,
        #dc2626 0px,
        #dc2626 4px,
        transparent 4px,
        transparent 8px
    );
    background-size: 100% 2px;
    background-position: 0 100%;
    background-repeat: no-repeat;
}

.webbiz-spoiler--underline:hover {
    text-decoration-color: #ef4444;
}

.webbiz-spoiler--underline.webbiz-spoiler--revealed {
    color: inherit;
    user-select: auto;
    text-decoration: none;
    background: none;
}

/* ==========================================================================
   Q&A 互動問答 - 兩種樣式
   ========================================================================== */

/* 共用基礎樣式 */
.webbiz-qa {
    margin: 20px 0;
}

.webbiz-qa__question {
    cursor: pointer;
    list-style: none;
    transition: all 0.2s ease;
}

.webbiz-qa__question::-webkit-details-marker {
    display: none;
}

/* 展開動畫 */
@keyframes webbiz-qa-fade-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --------------------------------------
   樣式 1：簡約 (minimal)
   -------------------------------------- */
.webbiz-qa--minimal {
    border-bottom: 1px solid #e5e7eb;
}

.webbiz-qa--minimal .webbiz-qa__question {
    display: flex;
    align-items: center;
    padding: 16px 0;
    font-weight: 600;
    font-size: 16px;
    color: #1e293b;
}

.webbiz-qa--minimal .webbiz-qa__question::before {
    content: 'Q';
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #64748b;
    font-weight: 700;
    font-size: 12px;
    border-radius: 4px;
    margin-right: 12px;
}

.webbiz-qa--minimal .webbiz-qa__question::after {
    content: '+';
    margin-left: auto;
    font-size: 20px;
    color: #94a3b8;
    font-weight: 300;
}

.webbiz-qa--minimal[open] .webbiz-qa__question::after {
    content: '−';
}

.webbiz-qa--minimal .webbiz-qa__answer {
    position: relative;
    padding: 0 0 16px 36px;
    color: #64748b;
    font-size: 15px;
    line-height: 1.7;
    animation: webbiz-qa-fade-in 0.3s ease;
}

.webbiz-qa--minimal .webbiz-qa__answer::before {
    content: 'A';
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #10b981;
    font-weight: 700;
    font-size: 12px;
    border-radius: 4px;
}

/* --------------------------------------
   樣式 2：卡片 (card)
   -------------------------------------- */
.webbiz-qa--card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.webbiz-qa--card .webbiz-qa__question {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    background: #fafafa;
    font-weight: 600;
    font-size: 16px;
    color: #1e293b;
}

.webbiz-qa--card .webbiz-qa__question::before {
    content: 'Q';
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3b82f6;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    border-radius: 50%;
    margin-right: 14px;
}

.webbiz-qa--card .webbiz-qa__question::after {
    content: '';
    margin-left: auto;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #64748b;
    transition: transform 0.2s ease;
}

.webbiz-qa--card[open] .webbiz-qa__question::after {
    transform: rotate(180deg);
}

.webbiz-qa--card .webbiz-qa__question:hover {
    background: #f5f5f5;
}

.webbiz-qa--card .webbiz-qa__answer {
    position: relative;
    padding: 18px 20px 18px 62px;
    color: #475569;
    font-size: 15px;
    line-height: 1.7;
    border-top: 1px solid #e5e7eb;
    animation: webbiz-qa-fade-in 0.3s ease;
}

.webbiz-qa--card .webbiz-qa__answer::before {
    content: 'A';
    position: absolute;
    left: 20px;
    top: 18px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #10b981;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    border-radius: 50%;
}


/* 共用：答案內的連結 */
.webbiz-qa--minimal .webbiz-qa__answer a,
.webbiz-qa--card .webbiz-qa__answer a {
    color: #3b82f6;
    text-decoration: underline;
}

.webbiz-qa--minimal .webbiz-qa__answer a:hover,
.webbiz-qa--card .webbiz-qa__answer a:hover {
    color: #1d4ed8;
}

/* ==========================================================================
   無障礙支援
   ========================================================================== */

/* 鍵盤焦點樣式 */
.webbiz-qa__question:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.webbiz-spoiler:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* 減少動畫 */
@media (prefers-reduced-motion: reduce) {
    .webbiz-emphasis-1,
    .webbiz-emphasis-2,
    .webbiz-emphasis-3,
    .webbiz-spoiler,
    .webbiz-qa__question,
    .webbiz-qa__question::after,
    .webbiz-qa__answer {
        transition: none !important;
        animation: none !important;
    }
}

/* ==========================================================================
   響應式調整
   ========================================================================== */

@media (max-width: 600px) {
    /* Q&A 卡片樣式響應式 */
    .webbiz-qa--card .webbiz-qa__question {
        padding: 14px 16px;
        font-size: 15px;
    }

    .webbiz-qa--card .webbiz-qa__answer {
        padding: 14px 16px 14px 50px;
        font-size: 14px;
    }

    .webbiz-qa--card .webbiz-qa__question::before,
    .webbiz-qa--card .webbiz-qa__answer::before {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .webbiz-qa--card .webbiz-qa__answer::before {
        left: 14px;
        top: 14px;
    }

    /* Q&A 簡約樣式響應式 */
    .webbiz-qa--minimal .webbiz-qa__question {
        padding: 12px 0;
        font-size: 15px;
    }

    .webbiz-qa--minimal .webbiz-qa__answer {
        padding: 0 0 12px 32px;
        font-size: 14px;
    }
}

/* ==========================================================================
   列印樣式
   ========================================================================== */

@media print {
    .webbiz-spoiler {
        color: inherit !important;
        background: none !important;
        filter: none !important;
    }

    .webbiz-qa {
        page-break-inside: avoid;
    }

    .webbiz-qa[open] .webbiz-qa__answer {
        display: block !important;
    }
}
