/* =============================================
   YMIS 前台样式 - 适配 A站 暗色主题 (bg-slate-800)
   ============================================= */

/* 搜索框相机按钮 — absolute 定位，紧靠"搜索"提交按钮左侧 */
.ymis-camera-btn {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    z-index: 1;
}
.ymis-camera-btn:hover {
    background: rgba(99, 102, 241, 0.35);
    border-color: rgba(99, 102, 241, 0.8);
}
/* A站搜索框：扩展右内边距，为搜索+相机两个按钮留空间 */
.uxsearch-form input[name="s"],
.uxsearch-form input[type="search"] {
    padding-right: 100px !important;
}
.ymis-camera-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #a5b4fc;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── 遮罩层 ── */
.ymis-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.ymis-overlay.ymis-open {
    opacity: 1;
    pointer-events: auto;
}

/* ── 弹窗主体 ── */
.ymis-modal {
    background: #1e293b;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    width: 680px;
    max-width: 95vw;
    max-height: 88vh;
    overflow-y: auto;
    padding: 28px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.25s;
    color: #e2e8f0;
    font-family: inherit;
}
.ymis-overlay.ymis-open .ymis-modal {
    transform: translateY(0);
}

/* ── 关闭按钮 ── */
.ymis-close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
    padding: 0;
}
.ymis-close:hover { color: #e2e8f0; }

/* ── 标题 ── */
.ymis-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0 0 20px;
}

/* ── 上传区域 ── */
.ymis-upload-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}
.ymis-upload-tab {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid rgba(100, 116, 139, 0.4);
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.ymis-upload-tab.active {
    background: rgba(99, 102, 241, 0.25);
    border-color: #6366f1;
    color: #a5b4fc;
}

.ymis-drop-zone {
    border: 2px dashed rgba(99, 102, 241, 0.35);
    border-radius: 10px;
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: rgba(15, 23, 42, 0.4);
}
.ymis-drop-zone:hover,
.ymis-drop-zone.ymis-drag-over {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
}
.ymis-drop-zone p { margin: 8px 0 0; color: #64748b; font-size: 13px; }
.ymis-drop-zone-icon { width: 40px; height: 40px; color: #6366f1; margin: 0 auto 6px; display: block; }

.ymis-url-input-wrap {
    display: none;
}
.ymis-url-input-wrap.active {
    display: flex;
    gap: 8px;
}
.ymis-url-input {
    flex: 1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(100, 116, 139, 0.4);
    border-radius: 8px;
    color: #e2e8f0;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
}
.ymis-url-input:focus { border-color: #6366f1; }
.ymis-btn-search-url {
    padding: 8px 18px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}
.ymis-btn-search-url:hover { background: #4f46e5; }

/* ── 预览区 ── */
.ymis-preview-wrap {
    display: none;
    align-items: flex-start;
    gap: 16px;
    margin-top: 16px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 8px;
}
.ymis-preview-wrap.active { display: flex; }
.ymis-preview-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.ymis-preview-info { flex: 1; font-size: 13px; color: #94a3b8; }
.ymis-preview-info p { margin: 3px 0; }
.ymis-btn-do-search {
    padding: 8px 20px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    transition: background 0.15s;
    align-self: center;
}
.ymis-btn-do-search:hover { background: #4f46e5; }
.ymis-btn-do-search:disabled { background: #374151; color: #6b7280; cursor: not-allowed; }

/* ── 状态提示 ── */
.ymis-status-bar {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 12px;
    min-height: 20px;
}
.ymis-status-bar.ymis-loading::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #6366f1;
    border-top-color: transparent;
    border-radius: 50%;
    animation: ymis-spin 0.7s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}
@keyframes ymis-spin { to { transform: rotate(360deg); } }

.ymis-quota-info { font-size: 12px; color: #64748b; margin-top: 6px; }

/* ── 结果区 ── */
.ymis-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0 12px;
    padding-top: 16px;
    border-top: 1px solid rgba(100, 116, 139, 0.25);
}
.ymis-results-header h3 { margin: 0; font-size: 15px; color: #f1f5f9; }
.ymis-results-count { font-size: 13px; color: #64748b; }

.ymis-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.ymis-result-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(100, 116, 139, 0.2);
    border-radius: 8px;
    overflow: hidden;
    color: inherit;
    transition: border-color 0.15s, transform 0.15s;
    display: flex;
    flex-direction: column;
}
.ymis-result-card:hover {
    border-color: rgba(99, 102, 241, 0.6);
    transform: translateY(-2px);
}
.ymis-result-view {
    color: inherit;
    text-decoration: none;
}
.ymis-result-view:hover {
    color: inherit;
    text-decoration: none;
}
.ymis-result-thumb {
    display: block;
    background: #0f172a;
}
.ymis-result-thumb img,
.ymis-result-placeholder {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: #0f172a;
}
.ymis-result-info {
    padding: 8px 10px;
    flex: 1;
}
.ymis-result-title {
    font-size: 12px;
    color: #e2e8f0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}
.ymis-result-meta {
    font-size: 11px;
    color: #64748b;
    display: flex;
    justify-content: space-between;
}
.ymis-result-score {
    color: #6366f1;
    font-size: 11px;
}
.ymis-result-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 0 8px 8px;
}
.ymis-result-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 28px;
    padding: 0 6px;
    border: 1px solid rgba(100, 116, 139, 0.32);
    border-radius: 6px;
    background: rgba(30, 41, 59, 0.82);
    color: #cbd5e1;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}
.ymis-result-action:hover {
    background: rgba(51, 65, 85, 0.95);
    color: #fff;
    text-decoration: none;
}
.ymis-result-action-primary {
    border-color: rgba(99, 102, 241, 0.55);
    background: rgba(79, 70, 229, 0.86);
    color: #fff;
}
.ymis-result-action:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.ymis-no-result {
    text-align: center;
    padding: 32px 0;
    color: #64748b;
    font-size: 14px;
}

/* ── 详情页返回识图结果 ── */
.ymis-back-results {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 99990;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid rgba(129, 140, 248, 0.5);
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.95);
    color: #e0e7ff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.ymis-back-results::before {
    content: '←';
    font-size: 16px;
    line-height: 1;
}
.ymis-back-results:hover {
    background: rgba(79, 70, 229, 0.95);
    border-color: rgba(165, 180, 252, 0.8);
    transform: translateY(-1px);
}

/* ── 详情页找相似模型 ── */
.ymis-find-similar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid rgba(129, 140, 248, 0.6);
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.2);
    color: #c7d2fe;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
}
.ymis-find-similar:hover {
    background: rgba(79, 70, 229, 0.72);
    border-color: rgba(165, 180, 252, 0.9);
    color: #fff;
}

/* ── 响应式 ── */
@media (max-width: 600px) {
    .ymis-modal { padding: 20px 16px; }
    .ymis-result-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .ymis-back-results { left: 16px; right: 16px; bottom: 16px; width: auto; }
}
