/* ================================================================
   优象 图片反推提示词 v2 — 前台样式
   ================================================================ */

:root {
    --i2p-bg:        #111318;
    --i2p-surface:   #1c1f26;
    --i2p-card:      #22262f;
    --i2p-card2:     #282d38;
    --i2p-border:    #2e3340;
    --i2p-accent:    #22c55e;
    --i2p-accent-hover: #16a34a;
    --i2p-accent-glow:  rgba(34,197,94,0.20);
    --i2p-accent-l:     rgba(34,197,94,0.10);
    --i2p-accent2:   #818cf8;
    --i2p-text:      #eef0f6;
    --i2p-muted:     #a8adc0;
    --i2p-muted2:    #656880;
    --i2p-success:   #22c55e;
    --i2p-danger:    #f87171;
    --i2p-radius:    16px;
    --i2p-radius-sm: 10px;
    --i2p-shadow:    0 4px 24px rgba(0,0,0,0.40);
}

/* ── 隐藏页面标题（由插件头部替代） ── */
.entry-title { display: none !important; }

/* ── 全局 ── */
.i2p-app {
    max-width: 1120px;
    margin: 0 auto;
    padding: 40px 32px 64px;
    background: var(--i2p-bg);
    border-radius: 20px;
    color: var(--i2p-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* ── 标题 ── */
.i2p-header { text-align: center; margin-bottom: 28px; }
.i2p-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: rgba(34,197,94,0.10);
    border: 1px solid rgba(34,197,94,0.25);
    border-radius: 20px;
    color: #22c55e;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 14px;
    letter-spacing: 0.2px;
}
.i2p-title {
    font-size: 36px;
    font-weight: 800;
    color: var(--i2p-text);
    margin: 0 0 8px;
    letter-spacing: -0.5px;
    line-height: 1.15;
}
.i2p-title .i2p-title-accent {
    color: var(--i2p-accent);
}
.i2p-subtitle { color: var(--i2p-muted); margin: 0; font-size: 14px; }

/* ── 主体双列布局 ── */
.i2p-main {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
}

/* ── 左列 ── */
.i2p-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 80px;
}

/* ── Tab 导航栏 ── */
.i2p-tabs {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--i2p-border);
    margin-bottom: 28px;
    gap: 0;
}
.i2p-tab-btn {
    padding: 12px 22px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--i2p-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .2s, border-color .2s;
}
.i2p-tab-btn.active,
.i2p-tab-btn:hover {
    color: var(--i2p-accent);
    border-bottom-color: var(--i2p-accent);
}
.i2p-balance-tab {
    margin-left: auto;
    font-size: 13px;
    color: var(--i2p-muted2);
    padding-right: 4px;
    align-self: center;
}
.i2p-balance-tab strong { color: var(--i2p-accent); }

/* ── Tab 面板 ── */
.i2p-panel { display: none; }
.i2p-panel.active { display: block; }

/* ── 上传区 ── */
.i2p-upload-zone {
    border: 2px dashed var(--i2p-border);
    border-radius: var(--i2p-radius);
    background: var(--i2p-surface);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    overflow: hidden;
}
.i2p-upload-zone:hover,
.i2p-upload-zone.drag-over {
    border-color: var(--i2p-accent);
    background: var(--i2p-accent-l);
}
.i2p-upload-inner { text-align: center; padding: 28px 20px; }
.i2p-upload-icon  { font-size: 40px; margin-bottom: 10px; line-height: 1; }
.i2p-upload-text  { font-size: 15px; font-weight: 600; color: var(--i2p-text); }
.i2p-upload-hint  { font-size: 12px; color: var(--i2p-muted); margin-top: 5px; }

.i2p-preview-wrap { width: 100%; position: relative; }
.i2p-preview-wrap img {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: var(--i2p-radius);
    display: block;
}
.i2p-remove-btn {
    position: absolute;
    top: 8px; right: 8px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px; height: 28px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.i2p-remove-btn:hover { background: var(--i2p-danger); }

/* ── 选项 ── */
.i2p-options {
    background: var(--i2p-surface);
    border: 1px solid var(--i2p-border);
    border-radius: var(--i2p-radius);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.i2p-opt-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.i2p-opt-label { color: var(--i2p-muted); font-size: 12px; width: 28px; flex-shrink: 0; }
.i2p-opt-group { display: flex; gap: 6px; flex-wrap: wrap; }
.i2p-opt-btn, .i2p-lang-btn {
    padding: 4px 13px;
    border: 1px solid var(--i2p-border);
    border-radius: 16px;
    background: var(--i2p-card);
    color: var(--i2p-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.i2p-opt-btn:hover, .i2p-lang-btn:hover { border-color: var(--i2p-accent); color: var(--i2p-text); }
.i2p-opt-btn.active, .i2p-lang-btn.active {
    background: var(--i2p-accent);
    border-color: var(--i2p-accent);
    color: #fff;
    font-weight: 600;
}

/* ── 提交按钮 ── */
.i2p-submit-btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: var(--i2p-radius);
    background: linear-gradient(135deg, var(--i2p-accent), var(--i2p-accent2));
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.i2p-submit-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--i2p-accent-glow);
}
.i2p-submit-btn:disabled {
    background: var(--i2p-border);
    color: var(--i2p-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── 旋转加载 ── */
.i2p-spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: i2p-spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes i2p-spin { to { transform: rotate(360deg); } }

/* ── 登录提示 / 错误 ── */
.i2p-login-notice { text-align: center; font-size: 12px; color: var(--i2p-muted); padding: 6px; }
.i2p-login-notice a { color: var(--i2p-accent2); }
.i2p-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: var(--i2p-radius-sm);
    color: #fca5a5;
    padding: 10px 14px;
    font-size: 13px;
}

/* ── 右列：结果面板 ── */
.i2p-result-panel {
    background: var(--i2p-card);
    border: 1px solid var(--i2p-border);
    border-radius: var(--i2p-radius);
    min-height: 280px;
    display: flex;
    flex-direction: column;
}

/* 占位 */
.i2p-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    gap: 12px;
    color: var(--i2p-muted);
}
.i2p-placeholder-icon { font-size: 40px; opacity: 0.35; }
.i2p-placeholder-text { font-size: 13px; text-align: center; }

/* 加载覆盖 */
.i2p-loading-overlay {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
    color: var(--i2p-muted);
    font-size: 13px;
    flex: 1;
}
.i2p-loading-overlay .i2p-spinner {
    width: 32px; height: 32px;
    border-width: 3px;
    border-color: var(--i2p-border);
    border-top-color: var(--i2p-accent);
}
.i2p-loading-overlay.active { display: flex; }

/* 结果内容 */
.i2p-result-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.i2p-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--i2p-border);
}
.i2p-result-title { font-size: 14px; font-weight: 700; }
.i2p-result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.i2p-copy-all-btn, .i2p-rerun-btn {
    padding: 5px 13px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.i2p-copy-all-btn {
    border: 1px solid var(--i2p-border);
    background: var(--i2p-card2);
    color: var(--i2p-text);
}
.i2p-copy-all-btn:hover { border-color: var(--i2p-accent2); color: var(--i2p-accent2); }
.i2p-rerun-btn {
    border: 1px solid var(--i2p-accent);
    background: transparent;
    color: var(--i2p-accent);
}
.i2p-rerun-btn:hover { background: var(--i2p-accent); color: #fff; }

/* ── 结果块 ── */
.i2p-block {
    background: var(--i2p-card2);
    border: 1px solid var(--i2p-border);
    border-radius: var(--i2p-radius-sm);
    padding: 11px 13px;
}
.i2p-block-main {
    border-color: rgba(34,197,94,0.30);
    background: rgba(34,197,94,0.05);
}
.i2p-block-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 7px;
}
.i2p-label-text {
    font-size: 11px;
    font-weight: 700;
    color: var(--i2p-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.i2p-copy-btn {
    padding: 2px 9px;
    border: 1px solid var(--i2p-border);
    border-radius: 10px;
    background: transparent;
    color: var(--i2p-muted);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.i2p-copy-btn:hover  { border-color: var(--i2p-accent2); color: var(--i2p-accent2); }
.i2p-copy-btn.copied { border-color: var(--i2p-success);  color: var(--i2p-success); }

.i2p-block-tip {
    font-size: 11px;
    color: var(--i2p-muted2);
    margin: 0 0 8px;
    line-height: 1.5;
}

.i2p-textarea {
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    border: none;
    color: var(--i2p-text);
    font-size: 13px;
    font-family: 'Menlo', 'Consolas', 'SFMono-Regular', monospace;
    line-height: 1.65;
    padding: 0;
    resize: none;
    overflow: hidden;
    min-height: 54px;
}
.i2p-textarea:focus { outline: none; }
.i2p-block-main .i2p-textarea { font-size: 14px; min-height: 72px; }

/* ── 标签云 ── */
.i2p-tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.i2p-tag {
    padding: 3px 10px;
    background: rgba(34,197,94,0.10);
    border: 1px solid rgba(34,197,94,0.22);
    border-radius: 12px;
    font-size: 12px;
    color: var(--i2p-accent);
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}
.i2p-tag:hover { background: rgba(34,197,94,0.22); }

/* ── Toast ── */
.i2p-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: rgba(28,31,51,0.96);
    border: 1px solid var(--i2p-border);
    color: var(--i2p-text);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.22s, transform 0.22s;
    backdrop-filter: blur(10px);
    z-index: 99999;
    white-space: nowrap;
    box-shadow: var(--i2p-shadow);
}
.i2p-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 响应式 ── */
@media (max-width: 820px) {
    .i2p-main { grid-template-columns: 1fr; }
    .i2p-left { position: static; }
}
@media (max-width: 480px) {
    .i2p-app { padding: 14px 12px 40px; }
    .i2p-title { font-size: 22px; }
}

/* ── 历史记录表格 ── */
.i2p-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.i2p-history-table th {
    background: var(--i2p-surface);
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid var(--i2p-border);
    font-weight: 600;
    color: var(--i2p-muted);
    white-space: nowrap;
}
.i2p-history-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--i2p-border);
    color: var(--i2p-text);
    vertical-align: middle;
}
.i2p-history-table tr:hover td { background: var(--i2p-surface); }
.i2p-history-loading {
    text-align: center;
    padding: 32px;
    color: var(--i2p-muted2);
}
.i2p-hist-id  { color: var(--i2p-muted2); width: 52px; }
.i2p-hist-thumb { width: 72px; }
.i2p-thumb-img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
    border: 1px solid var(--i2p-border);
}
.i2p-thumb-clickable {
    cursor: zoom-in;
    transition: opacity .15s;
}
.i2p-thumb-clickable:hover { opacity: .72; }
.i2p-thumb-none { color: var(--i2p-muted2); font-size: 13px; }
.i2p-hist-cost {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    color: #f87171;
    font-weight: 600;
    letter-spacing: .3px;
}
.i2p-hist-preview {
    max-width: 320px;
    color: var(--i2p-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.i2p-hist-time {
    white-space: nowrap;
    color: var(--i2p-muted2);
    font-size: 12px;
}
.i2p-lang-badge {
    display: inline-block;
    font-size: 11px;
    background: rgba(34,197,94,0.10);
    border: 1px solid rgba(34,197,94,0.22);
    color: var(--i2p-accent);
    border-radius: 20px;
    padding: 2px 8px;
    white-space: nowrap;
}
.i2p-hist-actions { white-space: nowrap; }
.i2p-hist-restore {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    background: var(--i2p-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background .15s;
    margin-right: 6px;
}
.i2p-hist-restore:hover { background: var(--i2p-accent-hover); }
.i2p-hist-del {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    background: transparent;
    border: 1px solid var(--i2p-danger);
    color: var(--i2p-danger);
    cursor: pointer;
    transition: background .15s;
}
.i2p-hist-del:hover { background: rgba(248,113,113,0.12); }
