/* ====================================
   FINDIT 電子報產生器 - 新版 UI/UX 樣式
   ==================================== */

/* 基礎重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", sans-serif;
    background: #f5f6f8;
    color: #333;
    font-size: 14px;
}

/* ==================== 頂部工具列 ==================== */
.top-bar {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-bar h1 {
    font-size: 16px;
    font-weight: 600;
}

.top-bar-r {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tpl-sel {
    padding: 6px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
}

.btn-g {
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.btn-out {
    background: #fff;
    border: 1px solid;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.btn-w {
    background: #fff;
    color: #666;
    border: 1px solid #d0d0d0;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
}

.btn-w:hover {
    background: #f5f5f5;
}

.btn-w.active {
    border-color: #0d9488;
    color: #0d9488;
    font-weight: 600;
}

/* ==================== 主容器 ==================== */
.container {
    display: flex;
    height: calc(100vh - 53px);
}

/* ==================== 預覽面板 ==================== */
.pv-panel {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f5f5f5;
}

.pv-frame {
    max-width: 680px;
    margin: 0 auto;
    background: #fff;
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
}

.pv-code {
    max-width: 920px;
    margin: 0 auto;
    background: #0f172a;
    color: #dbeafe;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .12);
    overflow: hidden;
}

.pv-code-hd {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    font-size: 12px;
    color: #93c5fd;
    background: #111827;
}

.pv-code pre {
    margin: 0;
    padding: 20px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.7;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ==================== 預覽內容樣式 ==================== */
.pv-hdr-placeholder {
    width: 100%;
    aspect-ratio: 680/260;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #fff;
    font-weight: 700;
    letter-spacing: 1px;
    gap: 6px;
}

.pv-hdr-placeholder small {
    font-size: 13px;
    font-weight: 400;
    opacity: .8;
}

.pv-hdr-placeholder.t1 {
    background: linear-gradient(135deg, #1a365d, #2b6cb0 50%, #0d9488);
    font-size: 22px;
}

.pv-hdr-placeholder.t2 {
    background: linear-gradient(135deg, #c05621, #ed8936 50%, #0d9488);
    font-size: 22px;
}

.pv-hdr-placeholder.t3 {
    background: linear-gradient(135deg, #1a365d, #2b6cb0 50%, #4c51bf);
    font-size: 20px;
}

.pv-nav {
    background: #f8f8f8;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #eee;
}

.pv-nav-logo {
    font-size: 11px;
    color: #555;
    font-weight: 600;
}

.pv-nav-links {
    margin-left: auto;
    font-size: 12px;
    color: #0d9488;
}

.pv-date {
    text-align: right;
    padding: 8px 20px;
    color: #888;
    font-size: 13px;
}

.pv-sec {
    padding: 20px;
    border-top: 1px solid #eee;
}

.pv-sec-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pv-sec-title.c1 {
    color: #2b6cb0;
}

.pv-sec-title.c2 {
    color: #c05621;
}

.pv-sec-title.c3 {
    color: #4c51bf;
}

.pv-sec.hl {
    background: #f0fdfa;
    outline: 2px dashed #0d9488;
    outline-offset: -2px;
    position: relative;
}

.pv-sec.hl::before {
    content: attr(data-hl-label);
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 11px;
    color: #0d9488;
    font-weight: 600;
    background: #ccfbf1;
    padding: 2px 8px;
    border-radius: 4px;
}

/* ==================== 槽位樣式 ==================== */
.slot {
    border: 2px dashed #d0d0d0;
    border-radius: 8px;
    padding: 28px 20px;
    text-align: center;
    color: #aaa;
    font-size: 13px;
    background: #fafafa;
}

.slot.filled {
    border-style: solid;
    border-color: #bfdbfe;
    background: #ffffff;
    color: #1f2937;
    text-align: left;
}

.slot-group {
    display: grid;
    gap: 12px;
}

.slot-note {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    line-height: 1.6;
}

.slot-card {
    border: 1px solid #dbe7f5;
    border-radius: 10px;
    background: #fbfdff;
    overflow: hidden;
}

.slot-card-title {
    padding: 10px 14px;
    background: #f4f8fc;
    color: #2b6cb0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .3px;
}

.slot-card-body {
    padding: 16px;
}

.slot-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #2563eb;
    font-weight: 700;
}

.slot-summary-count {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}

.slot-list {
    padding-left: 18px;
    margin: 0;
    color: #334155;
    line-height: 1.7;
}

.slot-list li+li {
    margin-top: 4px;
}

.slot-more {
    margin-top: 8px;
    font-size: 11px;
    color: #64748b;
}

/* ==================== 生態概覽 ==================== */
.eco-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.eco-card {
    background: #f8f8f8;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
}

.eco-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 2px;
}

.eco-count {
    font-size: 26px;
    font-weight: 700;
}

.eco-count.c1 {
    color: #2b6cb0;
}

.eco-count.c2 {
    color: #c05621;
}

.eco-count.c3 {
    color: #4c51bf;
}

.eco-items {
    margin-top: 6px;
    font-size: 12px;
    color: #555;
    line-height: 1.8;
}

.ldot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e0e0e0;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
}

/* ==================== 頁尾 ==================== */
.pv-footer-img {
    width: 100%;
    aspect-ratio: 680/180;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #fff;
    font-size: 13px;
    gap: 4px;
}

.pv-footer-img.t1 {
    background: linear-gradient(135deg, #2b6cb0, #1a365d);
}

.pv-footer-img.t2 {
    background: linear-gradient(135deg, #ed8936, #c05621);
}

.pv-footer-img.t3 {
    background: linear-gradient(135deg, #4c51bf, #1a365d);
}

.pv-footer {
    text-align: center;
    padding: 24px 20px;
    background: #f8f8f8;
    color: #888;
    font-size: 12px;
    line-height: 2;
}

.pv-footer a {
    color: #0d9488;
}

/* ==================== 圖示樣式 ==================== */
.sec-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-size: 14px;
}

.sec-icon.c1 {
    background: #dbeafe;
}

.sec-icon.c2 {
    background: #feebc8;
}

.sec-icon.c3 {
    background: #e8e0fe;
}

/* ==================== 步驟面板 ==================== */
.sp {
    width: 400px;
    background: #fff;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==================== 進度指示器 ==================== */
.prog {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.prog-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

.prog-track {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.prog-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .4s;
}

.prog-fill.c1 {
    background: #2b6cb0;
}

.prog-fill.c2 {
    background: #c05621;
}

.prog-fill.c3 {
    background: #4c51bf;
}

.prog-text {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
}

/* ==================== 步驟列表 ==================== */
.slist {
    flex: 1;
    overflow-y: auto;
}

.si {
    border-bottom: 1px solid #f0f0f0;
}

.sh {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.sh:hover {
    background: #fafafa;
}

.sn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.sn.p {
    background: #e5e7eb;
    color: #999;
}

.sn.a {
    color: #fff;
}

.sn.a.c1 {
    background: #2b6cb0;
}

.sn.a.c2 {
    background: #c05621;
}

.sn.a.c3 {
    background: #4c51bf;
}

.sn.d {
    background: #d1fae5;
    color: #059669;
}

.st {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.st.dn {
    color: #888;
}

.sb {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.sb.d {
    background: #d1fae5;
    color: #059669;
}

.sb.a.c1 {
    background: #dbeafe;
    color: #2b6cb0;
}

.sb.a.c2 {
    background: #feebc8;
    color: #c05621;
}

.sb.a.c3 {
    background: #e8e0fe;
    color: #4c51bf;
}

.sc {
    color: #ccc;
    font-size: 12px;
    transition: transform .2s;
}

.sc.o {
    transform: rotate(90deg);
}

/* ==================== 步驟內容 ==================== */
.sbody {
    padding: 0 20px 16px 58px;
    display: none;
}

.sbody.o {
    display: block;
}

.sdesc {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.6;
}

.sfield {
    margin-bottom: 12px;
}

.sfield label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}

.sfield input[type="text"],
.sfield select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 13px;
}

.sfield input:focus,
.sfield select:focus {
    outline: none;
    border-color: #0d9488;
    box-shadow: 0 0 0 2px rgba(13, 148, 136, .15);
}

.sact {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.bp {
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    flex: 1;
    color: #fff;
}

.bp.c1 {
    background: #2b6cb0;
}

.bp.c1:hover {
    background: #2c5282;
}

.bp.c2 {
    background: #c05621;
}

.bp.c2:hover {
    background: #9c4221;
}

.bp.c3 {
    background: #4c51bf;
}

.bp.c3:hover {
    background: #434190;
}

.bs {
    background: #fff;
    color: #666;
    border: 1px solid #d0d0d0;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.bs:hover {
    background: #f5f5f5;
}

.bp:disabled {
    background: #ccc !important;
    cursor: not-allowed;
}

.ssum {
    font-size: 12px;
    color: #059669;
    background: #ecfdf5;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 4px;
}

/* ==================== 文章列表 ==================== */
.alist {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 8px;
}

.ai {
    padding: 9px 12px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.ai:last-child {
    border-bottom: none;
}

.ai input[type="checkbox"] {
    margin-top: 2px;
    accent-color: #0d9488;
}

.ai-title {
    font-weight: 500;
}

.ai-date {
    font-size: 11px;
    color: #999;
}

.subgroup {
    font-size: 12px;
    color: #888;
    margin: 10px 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #f0f0f0;
}

/* ==================== 版面配置選擇器 ==================== */
.lo {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.lo-item {
    flex: 1;
    padding: 10px 8px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    font-size: 11px;
    line-height: 1.4;
}

.lo-item.sel {
    border-color: #0d9488;
    background: #f0fdfa;
}

.lo-icon {
    font-size: 18px;
    margin-bottom: 2px;
}

/* ==================== 底部操作列 ==================== */
.bbar {
    padding: 12px 20px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==================== 通用工具類 ==================== */
.hidden {
    display: none !important;
}
