/**
 * WebBiz Toolkit - 後台樣式
 */

/* 容器 */
.webbiz-toolkit-wrap {
    max-width: 1180px;
}

/* 卡片 */
.webbiz-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.webbiz-card h2 {
    margin-top: 0;
    padding-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
    font-size: 16px;
}

.webbiz-card .form-table th {
    width: 180px;
    padding: 15px 10px 15px 0;
}

.webbiz-card .form-table td {
    padding: 15px 10px;
}

.webbiz-card .form-table td label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.webbiz-card .form-table input[type="checkbox"] {
    margin-top: 3px;
}

/* 版本資訊 */
.webbiz-info-card {
    background: #f8f9fa;
    border-color: #e2e4e7;
}

.webbiz-info-card p {
    margin: 0;
    color: #646970;
    font-size: 13px;
}

.webbiz-info-card a {
    color: #2271b1;
    text-decoration: none;
}

.webbiz-info-card a:hover {
    color: #135e96;
    text-decoration: underline;
}

/* 強調樣式設定 */
#emphasis-settings .description {
    margin-bottom: 20px;
    color: #646970;
}

.webbiz-emphasis-styles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .webbiz-emphasis-styles {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 782px) {
    .webbiz-emphasis-styles {
        grid-template-columns: 1fr;
    }
}

.webbiz-emphasis-style-item {
    background: #f8f9fa;
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    padding: 16px;
}

.webbiz-emphasis-style-item h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #1e1e1e;
}

.webbiz-emphasis-preview {
    background: #fff;
    padding: 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    text-align: center;
    border: 1px solid #e2e4e7;
    font-size: 15px;
    line-height: 1.6;
}

.webbiz-emphasis-preview-span {
    /* 預設樣式，會被 JS inline style 覆蓋 */
    display: inline;
    border-radius: 2px;
    transition: all 0.15s ease;
}

.webbiz-emphasis-table {
    margin: 0;
}

.webbiz-emphasis-table th {
    width: 80px !important;
    padding: 8px 8px 8px 0 !important;
    font-size: 12px;
    font-weight: 500;
    vertical-align: top;
}

.webbiz-emphasis-table td {
    padding: 8px 0 !important;
}

.webbiz-emphasis-table input[type="text"].regular-text {
    width: 100%;
}

.webbiz-emphasis-table .small-text {
    width: 60px;
}

.webbiz-emphasis-table select {
    width: 100%;
}

.webbiz-emphasis-table .description {
    margin-top: 4px;
    font-size: 11px;
}

/* 顏色選擇器調整 */
.webbiz-emphasis-table .wp-picker-container {
    display: block;
}

.webbiz-emphasis-table .wp-picker-container .wp-color-result {
    margin: 0;
}

/* Q&A 樣式設定 */
#qa-style-settings .description {
    margin: 0 0 16px;
    color: #646970;
}

.webbiz-qa-builder {
    border: 1px solid #dcdcde;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.webbiz-qa-tabs {
    display: flex;
    gap: 0;
    padding: 0 14px;
    border-bottom: 1px solid #dcdcde;
    background: #f6f7f7;
}

.webbiz-qa-tab {
    appearance: none;
    margin: 0;
    padding: 12px 16px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: #50575e;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.webbiz-qa-tab:hover,
.webbiz-qa-tab:focus {
    color: #1d2327;
}

.webbiz-qa-tab:focus {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
}

.webbiz-qa-tab.is-active {
    border-bottom-color: #2271b1;
    color: #1d2327;
    background: #fff;
}

.webbiz-qa-style-item {
    display: none;
    grid-template-columns: minmax(320px, 0.82fr) minmax(420px, 1.18fr);
    min-height: 430px;
}

.webbiz-qa-style-item.is-active {
    display: grid;
}

.webbiz-qa-preview-pane {
    position: sticky;
    top: 32px;
    align-self: start;
    padding: 18px;
    border-right: 1px solid #e2e4e7;
    background: #f8f9fa;
}

.webbiz-qa-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.webbiz-qa-preview-head h3 {
    margin: 0;
    font-size: 15px;
    line-height: 1.3;
    color: #1e1e1e;
}

.webbiz-qa-preview-head .button {
    min-height: 30px;
    line-height: 28px;
}

.webbiz-qa-preview {
    display: block;
    margin: 0;
    padding: 16px;
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    background: #fff;
}

.webbiz-qa-preview-box {
    width: 100%;
    margin: 0;
    overflow: hidden;
}

.webbiz-qa-preview-question {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    line-height: 1.5;
}

.webbiz-qa-preview-question::after {
    content: '+';
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: auto;
    border-radius: 999px;
    background: #f0f0f1;
    color: #50575e;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
}

.webbiz-qa-preview-box[open] .webbiz-qa-preview-question::after {
    content: '-';
}

.webbiz-qa-preview-question span:last-child,
.webbiz-qa-preview-answer span:last-child {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.webbiz-qa-preview-question::-webkit-details-marker {
    display: none;
}

.webbiz-qa-preview-answer {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.6;
}

.webbiz-qa-preview-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.webbiz-qa-preview-box--minimal {
    border-bottom: 1px solid #e5e7eb;
}

.webbiz-qa-preview-box--minimal .webbiz-qa-preview-question {
    padding: 12px 0;
}

.webbiz-qa-preview-box--minimal .webbiz-qa-preview-answer {
    padding: 0 0 12px 0;
}

.webbiz-qa-preview-box--minimal .webbiz-qa-preview-badge {
    width: 24px;
    height: 24px;
    font-size: 12px;
    border-radius: 4px;
}

.webbiz-qa-preview-box--card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
}

.webbiz-qa-preview-box--card .webbiz-qa-preview-question {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.webbiz-qa-preview-box--card .webbiz-qa-preview-answer {
    padding: 14px 16px;
}

.webbiz-qa-preview-box--card .webbiz-qa-preview-badge {
    width: 28px;
    height: 28px;
    font-size: 13px;
    border-radius: 50%;
}

.webbiz-qa-controls {
    display: grid;
    gap: 0;
    padding: 0;
    align-content: start;
}

.webbiz-qa-control-section {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    column-gap: 24px;
    padding: 16px 18px;
    border-bottom: 1px solid #e2e4e7;
    background: #fff;
}

.webbiz-qa-control-section:last-child {
    border-bottom: 0;
}

.webbiz-qa-control-section h4 {
    margin: 5px 0 0;
    font-size: 13px;
    line-height: 1.4;
    color: #1d2327;
    letter-spacing: 0;
}

.webbiz-qa-control-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    max-width: 520px;
}

.webbiz-qa-control {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.webbiz-qa-control-label {
    color: #1d2327;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

.webbiz-qa-control-input {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.webbiz-qa-controls .wp-picker-container {
    display: inline-grid;
    grid-template-columns: 36px 112px;
    align-items: center;
    gap: 8px;
    width: 156px;
    max-width: 156px;
}

.webbiz-qa-controls .wp-picker-container .wp-color-result.button {
    width: 36px;
    min-width: 36px;
    height: 28px;
    min-height: 28px;
    margin: 0;
    padding: 0;
    border-radius: 4px;
    overflow: hidden;
}

.webbiz-qa-controls .wp-picker-container .wp-color-result.button:hover,
.webbiz-qa-controls .wp-picker-container .wp-color-result.button:focus {
    border-color: #2271b1;
}

.webbiz-qa-controls .wp-color-result-text {
    display: none;
}

.webbiz-qa-controls .wp-picker-input-wrap {
    display: inline-flex !important;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
}

.webbiz-qa-controls .wp-picker-input-wrap input[type="text"].wp-color-picker {
    width: 112px;
    min-height: 30px;
}

.webbiz-qa-controls .wp-picker-default {
    display: none !important;
}

.webbiz-qa-controls .wp-picker-holder {
    grid-column: 1 / -1;
    width: max-content;
    max-width: 100%;
}

.webbiz-qa-background-tools {
    display: grid;
    grid-template-columns: 156px auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.webbiz-qa-control--background.is-transparent .wp-picker-container {
    opacity: 0.45;
}

.webbiz-qa-number-wrap {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.webbiz-qa-number-wrap input.small-text {
    width: 72px;
    min-height: 30px;
}

.webbiz-qa-number-wrap em {
    color: #646970;
    font-style: normal;
    font-size: 12px;
}

.webbiz-qa-transparent-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #50575e;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.webbiz-qa-transparent-toggle-label input {
    margin: 0;
}

@media (max-width: 1100px) {
    .webbiz-qa-style-item {
        grid-template-columns: 1fr;
    }

    .webbiz-qa-preview-pane {
        position: static;
        border-right: 0;
        border-bottom: 1px solid #e2e4e7;
    }
}

@media (max-width: 782px) {
    .webbiz-qa-tabs {
        padding: 0 10px;
    }

    .webbiz-qa-tab {
        flex: 1;
        padding: 12px 10px;
    }

    .webbiz-qa-control-section {
        grid-template-columns: 1fr;
        row-gap: 12px;
    }

    .webbiz-qa-control-section h4 {
        margin-top: 0;
    }

    .webbiz-qa-control-list {
        grid-template-columns: 1fr;
    }

    .webbiz-qa-control {
        grid-template-columns: 90px minmax(0, 1fr);
    }

    .webbiz-qa-background-tools {
        grid-template-columns: 1fr;
    }
}
