/* ===================================================
   email-signature.css — 邮件签名生成器
   =================================================== */

:root {
    --sig-primary:      #007aff;
    --sig-primary-soft: rgba(0,122,255,0.10);
    --sig-text:         #1d1d1f;
    --sig-muted:        #6e6e73;
    --sig-border:       #d1d1d6;
    --sig-surface:      #ffffff;
    --sig-bg:           #f5f5f7;
}

body.sig-page {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    color: var(--sig-text);
    background: var(--sig-bg);
}

/* ── Layout ────────────────────────────────────── */
.sig-main { padding: 28px 0 80px; }

.sig-workspace {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

/* ── Left Panel ─────────────────────────────────── */
.sig-panel {
    position: sticky;
    top: 88px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding-right: 4px;
    /* Slim scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #d1d1d6 transparent;
}
.sig-panel::-webkit-scrollbar { width: 4px; }
.sig-panel::-webkit-scrollbar-track { background: transparent; }
.sig-panel::-webkit-scrollbar-thumb { background: #d1d1d6; border-radius: 4px; }

/* Intro card */
.sig-intro {
    background: linear-gradient(135deg, #0066cc 0%, #5856d6 100%);
    border-radius: 16px;
    padding: 22px 22px 20px;
    color: white;
    flex-shrink: 0;
}
.sig-badge {
    display: inline-block;
    background: rgba(255,255,255,0.18);
    color: white;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 999px;
    margin-bottom: 12px;
}
.sig-intro h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}
.sig-intro p {
    font-size: 13px;
    margin: 0;
    opacity: 0.85;
    line-height: 1.55;
}

/* Section blocks */
.sig-section {
    background: var(--sig-surface);
    border: 1px solid #e5e5ea;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    flex-shrink: 0;
}
.sig-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #8e8e93;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin: 0 0 13px;
}

/* ── Template Picker ────────────────────────────── */
.tpl-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.tpl-item {
    border: 2px solid #e5e5ea;
    border-radius: 10px;
    padding: 6px 5px 7px;
    cursor: pointer;
    transition: border-color 0.14s, background 0.14s;
    background: #fafafa;
    text-align: center;
    user-select: none;
}
.tpl-item:hover  { border-color: var(--sig-primary); background: #f0f6ff; }
.tpl-item.active { border-color: var(--sig-primary); background: #f0f6ff; }

.tpl-thumb {
    width: 100%;
    height: 44px;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 5px;
    background: white;
    border: 1px solid #eee;
    box-sizing: border-box;
    padding: 4px;
}
.tpl-name { font-size: 10px; font-weight: 600; color: #222; line-height: 1.2; }
.tpl-desc { font-size: 9px;  color: #999; margin-top: 1px; }

/* ── Form Fields ────────────────────────────────── */
.sig-field { margin-bottom: 10px; }
.sig-field:last-child { margin-bottom: 0; }
.sig-field > label { display: block; font-size: 12px; font-weight: 500; color: #555; margin-bottom: 4px; }

.sig-field input[type="text"],
.sig-field input[type="email"],
.sig-field input[type="tel"],
.sig-field input[type="url"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--sig-border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--sig-text);
    background: white;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
    transition: border-color 0.14s, box-shadow 0.14s;
}
.sig-field input:focus {
    border-color: var(--sig-primary);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.12);
}

.sig-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Upload */
.sig-upload-wrap { display: flex; gap: 10px; align-items: flex-start; }
.sig-upload-btn {
    flex: 1;
    border: 1.5px dashed var(--sig-border);
    border-radius: 9px;
    padding: 10px 8px;
    text-align: center;
    cursor: pointer;
    background: #fafafa;
    position: relative;
    transition: border-color 0.14s, background 0.14s;
}
.sig-upload-btn:hover { border-color: var(--sig-primary); background: #f0f6ff; }
.sig-upload-btn.has-file { border-color: #34c759; background: #f0fff4; }
.sig-upload-btn input[type="file"] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.sig-upload-icon { font-size: 18px; color: var(--sig-primary); margin-bottom: 3px; display: block; }
.sig-upload-btn.has-file .sig-upload-icon { color: #34c759; }
.sig-upload-text { font-size: 10px; color: #777; line-height: 1.3; display: block; pointer-events: none; }

.sig-upload-preview {
    width: 52px; height: 52px; border-radius: 8px; overflow: hidden;
    border: 1px solid #e5e5ea; background: #f0f0f5;
    flex-shrink: 0; display: none; align-items: center; justify-content: center;
}
.sig-upload-preview.show { display: flex; }
.sig-upload-preview img { width: 100%; height: 100%; object-fit: cover; }

/* Color */
.sig-color-row { display: flex; align-items: center; gap: 10px; }
.sig-color-row > label { font-size: 12px; font-weight: 500; color: #555; flex: 1; }
.sig-color-row input[type="color"] {
    width: 38px; height: 30px; border: 1px solid var(--sig-border);
    border-radius: 7px; cursor: pointer; padding: 2px; background: white;
}
.sig-swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.sig-swatch {
    width: 20px; height: 20px; border-radius: 50%; cursor: pointer;
    border: 2px solid transparent; transition: transform 0.12s, box-shadow 0.12s;
    flex-shrink: 0;
}
.sig-swatch:hover { transform: scale(1.18); }
.sig-swatch.active, .sig-swatch:hover {
    box-shadow: 0 0 0 2px white, 0 0 0 3.5px var(--swatch-c, #007aff);
}

/* ── Right Column ───────────────────────────────── */
.sig-preview-col { display: flex; flex-direction: column; gap: 16px; }

/* Tabs */
.sig-tabs {
    display: flex;
    background: #ebebf0;
    border-radius: 11px;
    padding: 3px;
    gap: 3px;
}
.sig-tab {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    color: #8e8e93;
    cursor: pointer;
    transition: all 0.14s;
    font-family: inherit;
}
.sig-tab.active {
    background: white;
    color: var(--sig-primary);
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
.sig-tab-panel { display: none; }
.sig-tab-panel.active { display: block; }

/* Email preview chrome */
.sig-email-chrome {
    background: white;
    border: 1px solid #d1d1d6;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
}
.sig-email-topbar {
    display: flex; gap: 6px; align-items: center;
    padding: 10px 14px; background: #f4f4f8;
    border-bottom: 1px solid #e8e8ed;
}
.sig-email-dot { width: 11px; height: 11px; border-radius: 50%; }
.sig-email-meta { padding: 14px 22px 12px; border-bottom: 1px solid #f0f0f5; }
.sig-email-meta-row { font-size: 12px; color: #888; margin-bottom: 3px; }
.sig-email-meta-row strong { color: #333; font-weight: 600; }
.sig-email-subject { font-size: 18px; font-weight: 600; color: #1a1a1a; margin-top: 8px; }
.sig-email-body { padding: 24px 24px 28px; }
.sig-email-body > p {
    font-size: 14px; color: #333; margin: 0 0 10px;
    font-family: Arial, sans-serif; line-height: 1.6;
}
.sig-email-sep { border: none; border-top: 1px solid #ebebeb; margin: 18px 0; }

/* Action buttons */
.sig-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.sig-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 20px; border-radius: 10px;
    font-size: 14px; font-weight: 500;
    cursor: pointer; border: none;
    transition: all 0.14s; font-family: inherit;
}
.sig-btn-primary { background: var(--sig-primary); color: white; }
.sig-btn-primary:hover { background: #005ecc; transform: translateY(-1px); }
.sig-btn-secondary { background: #f0f0f5; color: #333; border: 1px solid #e5e5ea; }
.sig-btn-secondary:hover { background: #e5e5ea; }

/* Code view */
.sig-code-box {
    background: #1c1c1e; border-radius: 12px;
    padding: 16px 18px; overflow: auto; max-height: 500px;
}
.sig-code-box pre {
    margin: 0;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 11.5px; line-height: 1.65;
    color: #d4d4d8; white-space: pre-wrap; word-break: break-all;
}

/* How-to */
.sig-howto {
    background: #eef5ff; border: 1px solid #bdd4f5;
    border-radius: 12px; padding: 16px 20px;
}
.sig-howto h4 { font-size: 13px; font-weight: 700; color: #0055b3; margin: 0 0 10px; }
.sig-howto ol { margin: 0; padding-left: 18px; }
.sig-howto li { font-size: 13px; color: #333; margin-bottom: 5px; line-height: 1.5; }
.sig-howto li:last-child { margin-bottom: 0; }
.sig-howto code {
    background: rgba(0,85,179,0.08); color: #0055b3;
    padding: 1px 5px; border-radius: 4px; font-family: inherit; font-size: 12px;
}

/* Toast */
.sig-toast {
    position: fixed; bottom: 32px; left: 50%;
    transform: translateX(-50%) translateY(14px);
    background: rgba(0,0,0,0.82); color: white;
    padding: 10px 22px; border-radius: 22px;
    font-size: 14px; font-weight: 500;
    opacity: 0; transition: opacity 0.25s, transform 0.25s;
    z-index: 9999; pointer-events: none; white-space: nowrap;
}
.sig-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 940px) {
    .sig-workspace { grid-template-columns: 1fr; }
    .sig-panel { position: static; max-height: none; overflow-y: visible; }
}
@media (max-width: 600px) {
    .sig-row-2 { grid-template-columns: 1fr; }
    .tpl-grid  { grid-template-columns: repeat(3, 1fr); }
}
