/* =========================================
 * /translate/css/style.css
 * 个性化翻译工具 · 样式
 * 2026-08-14 P0
 * 2026-08-14 v2：补充角色预设/高级折叠/计数样式
 * ========================================= */

:root {
    --t-primary: #5b6cff;
    --t-primary-dark: #4554d4;
    --t-accent: #ff6b6b;
    --t-bg: #f5f6fb;
    --t-card: #ffffff;
    --t-text: #1f2330;
    --t-muted: #6b7280;
    --t-border: #e6e8f0;
    --t-success: #1abc9c;
    --t-warn: #f39c12;
    --t-danger: #e74c3c;
    --t-radius: 12px;
    --t-radius-sm: 8px;
    --t-shadow: 0 4px 18px rgba(36, 41, 71, 0.08);
}

.t-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px 48px;
    color: var(--t-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* 头部 */
.t-header {
    position: relative;
    margin: 16px 0 24px;
    border-radius: var(--t-radius);
    overflow: hidden;
    background: linear-gradient(135deg, #5b6cff 0%, #8a5bff 50%, #ff6b6b 100%);
    color: #fff;
    box-shadow: var(--t-shadow);
}
.t-header__bg {
    position: absolute; inset: 0;
    background: radial-gradient(800px 200px at 30% 20%, rgba(255,255,255,0.18), transparent 60%),
                radial-gradient(600px 200px at 80% 80%, rgba(255,255,255,0.12), transparent 60%);
    pointer-events: none;
}
.t-header__inner {
    position: relative;
    padding: 36px 28px 32px;
    text-align: center;
}
.t-header__icon {
    font-size: 42px;
    line-height: 1;
    display: block;
    margin-bottom: 8px;
}
.t-header__title {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.t-header__tagline {
    margin: 0 0 10px;
    font-size: 14px;
    opacity: 0.92;
}
.t-header__login-tip {
    margin: 12px 0 0;
    font-size: 12px;
    opacity: 0.88;
}
.t-header__login-tip a {
    color: #fff;
    text-decoration: underline;
}

/* 卡片 */
.t-card {
    background: var(--t-card);
    border-radius: var(--t-radius);
    box-shadow: var(--t-shadow);
    padding: 20px 22px 22px;
    margin-bottom: 20px;
}
.t-card__head {
    margin-bottom: 14px;
    border-bottom: 1px solid var(--t-border);
    padding-bottom: 12px;
}
.t-card__title {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 600;
    color: var(--t-text);
}
.t-card__sub {
    margin: 0;
    color: var(--t-muted);
    font-size: 13px;
}

/* 网格 */
.t-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}
.t-field--full { grid-column: 1 / -1; }

/* 字段 */
.t-field { display: flex; flex-direction: column; }
.t-label {
    font-size: 13px;
    color: var(--t-text);
    font-weight: 500;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.t-hint {
    color: var(--t-muted);
    font-size: 12px;
    font-weight: 400;
}
.t-input,
.t-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-sm);
    padding: 9px 11px;
    font-size: 14px;
    background: #fafbff;
    color: var(--t-text);
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
}
.t-input:focus,
.t-textarea:focus {
    outline: none;
    border-color: var(--t-primary);
    background: #fff;
}
.t-textarea {
    resize: vertical;
    min-height: 60px;
    line-height: 1.6;
}
.t-textarea--lg { min-height: 220px; }
.t-textarea--prompt { min-height: 280px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }

/* 按钮 */
.t-actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.t-btn {
    cursor: pointer;
    border: 1px solid var(--t-border);
    background: #fff;
    color: var(--t-text);
    padding: 9px 18px;
    border-radius: var(--t-radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    font-family: inherit;
}
.t-btn:hover { background: #f0f2fa; }
.t-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.t-btn--primary {
    background: linear-gradient(135deg, var(--t-primary), #8a5bff);
    color: #fff;
    border-color: transparent;
}
.t-btn--primary:hover { background: linear-gradient(135deg, var(--t-primary-dark), #7244e8); }
.t-btn--ghost { background: #fff; }

/* 状态 */
.t-status {
    margin: 10px 0 0;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 6px;
    background: #f0f2fa;
    color: var(--t-muted);
}
.t-status--ok    { background: #e7faf3; color: var(--t-success); }
.t-status--err   { background: #fde8e6; color: var(--t-danger); }
.t-status--warn  { background: #fff5e1; color: var(--t-warn); }

/* 翻译区 */
.t-translate {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.t-translate__col { display: flex; flex-direction: column; }
.t-translate__bar {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.t-counter { font-size: 12px; color: var(--t-muted); }

.t-reply {
    flex: 1;
    min-height: 220px;
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-sm);
    padding: 12px 14px;
    background: #fafbff;
    font-size: 14px;
    line-height: 1.7;
    color: var(--t-text);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-y: auto;
    max-height: 480px;
}
.t-reply[data-empty="1"] { color: var(--t-muted); font-style: italic; }
.t-reply__placeholder { color: var(--t-muted); }
.t-reply h1, .t-reply h2, .t-reply h3 { margin: 12px 0 8px; }
.t-reply p  { margin: 6px 0; }
.t-reply code { background: #eef0fa; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.t-reply pre { background: #1f2330; color: #f5f6fb; padding: 10px 12px; border-radius: 6px; overflow-x: auto; }
.t-reply pre code { background: transparent; color: inherit; padding: 0; }
.t-reply blockquote { border-left: 3px solid var(--t-primary); padding-left: 10px; color: var(--t-muted); margin: 6px 0; }
.t-reply ul, .t-reply ol { padding-left: 20px; }
.t-reply.is-loading::after {
    content: "翻译中…";
    display: inline-block;
    margin-left: 6px;
    color: var(--t-primary);
    font-style: normal;
    animation: t-blink 1.2s infinite;
}
@keyframes t-blink { 50% { opacity: 0.4; } }

/* 弹层 */
.t-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.t-modal__mask { position: absolute; inset: 0; background: rgba(20, 22, 40, 0.5); }
.t-modal__box {
    position: relative;
    width: min(720px, 92vw);
    max-height: 86vh;
    background: #fff;
    border-radius: var(--t-radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
}
.t-modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.t-modal__head h3 { margin: 0; font-size: 17px; }
.t-modal__close {
    background: none; border: none; cursor: pointer;
    font-size: 24px; line-height: 1; color: var(--t-muted);
    padding: 0 4px;
}
.t-modal__sub { color: var(--t-muted); font-size: 13px; margin: 0 0 12px; }
.t-modal__actions { margin-top: 12px; display: flex; justify-content: flex-end; gap: 10px; }
.t-modal__box .t-textarea { flex: 1; max-height: 60vh; }

/* 响应式 */
@media (max-width: 720px) {
    .t-grid { grid-template-columns: 1fr; }
    .t-translate { grid-template-columns: 1fr; }
    .t-header__title { font-size: 22px; }
    .t-header__inner { padding: 28px 18px 24px; }
    .t-row { flex-direction: column; align-items: stretch; }
    .t-actions--inline { justify-content: flex-end; }
    .t-presets { gap: 6px; }
    .t-preset { padding: 6px 10px; font-size: 12px; }
}

/* ========== v2 简化版 样式（2026-08-14） ========== */

/* 角色预设按钮组 */
.t-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 4px 0 16px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f5f7ff 0%, #fbf4ff 100%);
    border: 1px dashed #c8cfff;
    border-radius: var(--t-radius-sm);
}
.t-presets__label {
    font-size: 13px;
    color: var(--t-muted);
    margin-right: 4px;
    font-weight: 500;
}
.t-preset {
    cursor: pointer;
    border: 1px solid var(--t-border);
    background: #fff;
    color: var(--t-text);
    padding: 7px 13px;
    border-radius: 999px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
    font-family: inherit;
    user-select: none;
}
.t-preset:hover {
    border-color: var(--t-primary);
    background: #f0f3ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(91, 108, 255, 0.15);
}
.t-preset:active { transform: translateY(0); }
.t-preset__icon { font-size: 15px; line-height: 1; }
.t-preset__name { font-weight: 500; }

/* 激活态（点中的预设） */
.t-preset.is-active {
    background: linear-gradient(135deg, var(--t-primary), #8a5bff);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(91, 108, 255, 0.3);
}
.t-preset.is-active .t-preset__name { color: #fff; }

/* 点击脉冲 */
.t-preset.is-pulse {
    animation: t-preset-pulse 0.4s ease;
}
@keyframes t-preset-pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* 字段栏：标签 + 提示 同行 */
.t-field__bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    gap: 8px;
}
.t-counter {
    font-size: 12px;
    color: var(--t-muted);
    font-variant-numeric: tabular-nums;
    transition: color 0.15s;
}
.t-counter.is-warn { color: var(--t-warn); font-weight: 600; }

/* 画像文本框高度 */
.t-textarea--persona {
    min-height: 100px;
    line-height: 1.65;
    font-size: 14px;
}

/* 行布局：左 select / 右 buttons */
.t-row {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.t-row .t-field { flex: 1 1 180px; min-width: 160px; }
.t-actions--inline {
    margin-top: 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 高级选项折叠区 */
.t-advanced {
    margin-top: 16px;
    border-top: 1px dashed var(--t-border);
    padding-top: 12px;
}
.t-advanced > summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--t-muted);
    padding: 6px 4px;
    list-style: none;
    user-select: none;
    transition: color 0.15s;
}
.t-advanced > summary::-webkit-details-marker { display: none; }
.t-advanced > summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.2s;
}
.t-advanced[open] > summary::before { transform: rotate(90deg); }
.t-advanced > summary:hover { color: var(--t-primary); }
.t-advanced__tip {
    margin: 12px 0 0;
    color: var(--t-muted);
    font-size: 12px;
}
.t-grid--advanced {
    margin-top: 12px;
    padding: 12px;
    background: #fafbff;
    border-radius: var(--t-radius-sm);
    border: 1px solid var(--t-border);
}

/* 翻译区按钮悬浮 */
#t-btn-go { white-space: nowrap; }

/* ========== v4 极简版 样式（2026-08-14） ========== */

/* 当前画像摘要卡 */
.t-card--summary { padding: 0; overflow: hidden; }
.t-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    background: linear-gradient(135deg, #f5f7ff 0%, #fbf4ff 100%);
    border: 1px solid #d8def9;
    border-radius: var(--t-radius);
}
.t-summary__left {
    flex: 1 1 auto;
    min-width: 0;
}
.t-summary__label {
    font-size: 12px;
    color: var(--t-muted);
    margin-bottom: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.t-summary__value {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: var(--t-text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.t-summary__icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}
.t-summary__text {
    overflow: hidden;
    text-overflow: ellipsis;
}
.t-summary__text.is-empty { color: var(--t-muted); font-weight: 400; }
.t-summary__right {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* 弹层宽体（v4 画像设置弹层用） */
.t-modal__box--lg {
    max-width: 720px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
}

/* 行内 select（输入栏里嵌目标语言下拉） */
.t-input--inline {
    width: auto;
    display: inline-block;
    padding: 6px 30px 6px 12px;
    font-size: 13px;
    height: auto;
    line-height: 1.4;
    background-color: #fff;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23666' d='M6 8L0 0h12z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 1px solid var(--t-border);
    border-radius: 6px;
    cursor: pointer;
}
.t-input--inline:hover { border-color: var(--t-primary); }

/* 弹层内 select（角色下拉）走通用 .t-input 样式，但高度高一些 */
#t-preset-select {
    font-size: 15px;
    padding: 10px 12px;
    height: auto;
    line-height: 1.5;
    background-color: #fff;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23666' d='M6 8L0 0h12z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 1px solid var(--t-border);
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
}
#t-preset-select:focus { border-color: var(--t-primary); outline: none; }
