/* public/jimaku/style.css — Jimaku 工具样式（作用域隔离） */

.jimaku-app,
.jimaku-app * ,
.jimaku-app *::before,
.jimaku-app *::after {
    box-sizing: border-box;
}

.jimaku-app {
    color: #e5e7eb;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

/* 让工具容器融入 Playground 的右侧内容区（不要 body 背景） */
.jimaku-app .app-container {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* header */
.jimaku-app .app-header {
    margin-bottom: 14px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.jimaku-app .app-header h1 {
    margin: 0 0 4px;
    font-size: 20px;
    color: #f9fafb;
}

.jimaku-app .app-subtitle {
    margin: 0;
    font-size: 13px;
    color: #9ca3af;
}

/* 顶部额度条 */
.jimaku-app .quota-bar {
    margin: 0 0 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.jimaku-app .quota-item {
    padding: 6px 10px;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(55, 65, 81, 0.55);
    font-size: 12px;
    color: #e5e7eb;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.jimaku-app .quota-text { white-space: nowrap; }

/* 两栏 */
.jimaku-app .app-main {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.jimaku-app .left-panel,
.jimaku-app .right-panel {
    background: rgba(2, 6, 23, 0.35);
    border-radius: 14px;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.jimaku-app .left-panel { flex: 3; min-width: 0; }
.jimaku-app .right-panel { flex: 2; min-width: 0; }

.jimaku-app .panel-block { margin-bottom: 14px; }

.jimaku-app .block-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #d1d5db;
}

/* 剧本文本框 */
.jimaku-app .script-input {
    width: 100%;
    min-height: 150px;
    resize: vertical;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(2, 6, 23, 0.35);
    color: #e5e7eb;
    font-size: 13px;
    line-height: 1.5;
}

.jimaku-app .script-input:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 0.65);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18);
}

/* 隐藏 file input */
.jimaku-app .file-input-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* 拖拽上传 */
.jimaku-app .file-drop {
    border: 1px dashed rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.25);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease,
    transform 0.1s ease, box-shadow 0.15s ease;
    user-select: none;
}

.jimaku-app .file-drop:hover {
    border-color: rgba(56, 189, 248, 0.8);
    background: rgba(56, 189, 248, 0.06);
    transform: translateY(-1px);
}

.jimaku-app .file-drop:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 1);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.20);
}

.jimaku-app .file-drop.dragover {
    border-color: rgba(34, 197, 94, 0.9);
    background: rgba(34, 197, 94, 0.08);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.18);
}

.jimaku-app .file-drop-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(148, 163, 184, 0.15);
    color: #e5e7eb;
    font-weight: 800;
    flex: 0 0 auto;
}

.jimaku-app .file-drop-main { min-width: 0; flex: 1; }

.jimaku-app .file-drop-title {
    font-size: 13px;
    font-weight: 800;
    color: #e5e7eb;
    line-height: 1.2;
}

.jimaku-app .file-drop-sub {
    margin-top: 2px;
    font-size: 12px;
    color: #9ca3af;
}

.jimaku-app .file-drop-meta {
    margin-top: 6px;
    font-size: 12px;
    color: #cbd5e1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jimaku-app .file-clear-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 9999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(2,6,23,0.55);
    color: #e5e7eb;
    flex: 0 0 auto;
}

.jimaku-app .file-clear-btn:hover:not(:disabled) {
    background: rgba(2,6,23,0.75);
    transform: translateY(-1px);
}

/* 按钮行 */
.jimaku-app .button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.jimaku-app button {
    cursor: pointer;
    border: none;
    border-radius: 9999px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.jimaku-app button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.jimaku-app .primary-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #f9fafb;
    box-shadow: 0 10px 20px rgba(34, 197, 94, 0.28);
}

.jimaku-app .primary-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-1px);
}

.jimaku-app .secondary-btn {
    background: rgba(2, 6, 23, 0.55);
    color: #e5e7eb;
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.jimaku-app .secondary-btn:hover:not(:disabled) {
    background: rgba(2, 6, 23, 0.75);
    transform: translateY(-1px);
}

/* 视频 */
.jimaku-app .video-player {
    width: 100%;
    max-height: 360px;
    background: rgba(2, 6, 23, 0.35);
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.12);
}

/* 状态栏 */
.jimaku-app .status-area {
    margin-top: 4px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    min-height: 30px;
    display: flex;
    align-items: center;
}

.jimaku-app .status-area:empty { padding: 0; min-height: 0; }

.jimaku-app .status-info { background: rgba(55, 65, 81, 0.35); color: #e5e7eb; }
.jimaku-app .status-success { background: rgba(22, 163, 74, 0.12); color: #bbf7d0; }
.jimaku-app .status-error { background: rgba(220, 38, 38, 0.16); color: #fecaca; }
.jimaku-app .status-loading { background: rgba(59, 130, 246, 0.16); color: #bfdbfe; }

/* 右侧字幕列表 */
.jimaku-app .subtitle-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.jimaku-app .subtitle-hint { font-size: 11px; color: #9ca3af; }

.jimaku-app .subtitle-list {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(2, 6, 23, 0.35);
    padding: 6px;
    max-height: 62vh; /* 避免嵌套滚动太怪 */
    overflow-y: auto;
    font-size: 12px;
}

.jimaku-app .subtitle-empty {
    padding: 12px;
    text-align: center;
    color: #9ca3af;
}

/* 单条字幕 */
.jimaku-app .subtitle-item {
    padding: 8px 10px;
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.12s ease, transform 0.08s ease, box-shadow 0.12s ease;
}

.jimaku-app .subtitle-item:hover {
    background: rgba(56, 189, 248, 0.06);
    transform: translateY(-1px);
}

.jimaku-app .subtitle-item.active {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.55);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.14);
}

.jimaku-app .subtitle-time {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 2px;
}

.jimaku-app .subtitle-text {
    white-space: pre-wrap;
    word-break: break-all;
    color: #e5e7eb;
    line-height: 1.4;
}

/* 编辑按钮 */
.jimaku-app .subtitle-edit-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.jimaku-app .subtitle-edit-btn {
    padding: 3px 10px;
    font-size: 11px;
    border-radius: 9999px;
    border: 1px dashed rgba(148, 163, 184, 0.25);
    background: rgba(2, 6, 23, 0.35);
    color: #9ca3af;
}

.jimaku-app .subtitle-edit-btn:hover {
    background: rgba(2, 6, 23, 0.65);
    color: #e5e7eb;
    border-style: solid;
}

.jimaku-app .subtitle-ai-btn { margin-left: auto; border-color: rgba(56, 189, 248, 0.55); }

/* 模态遮罩 */
.jimaku-app .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.jimaku-app .modal-overlay.show { display: flex; }

.jimaku-app .modal-box {
    width: 220px;
    min-height: 180px;
    border-radius: 18px;
    background: radial-gradient(circle at top left, #1d283a, rgba(2, 6, 23, 0.95) 60%);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.9);
    padding: 20px 18px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.jimaku-app .modal-spinner {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 3px solid rgba(148, 163, 184, 0.35);
    border-top-color: rgba(56, 189, 248, 1);
    border-right-color: rgba(34, 197, 94, 1);
    animation: spinnerRotate 0.9s linear infinite;
    margin-bottom: 14px;
}

.jimaku-app .modal-title {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 800;
    color: #e5e7eb;
}

.jimaku-app .modal-text {
    margin: 0;
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.5;
}

.jimaku-app .ai-modal-box {
    width: 380px;
    max-width: 92vw;
    min-height: 260px;
    align-items: stretch;
    text-align: left;
}

.jimaku-app .ai-subtitle-info { margin: 0 0 6px; font-size: 12px; color: #9ca3af; }
.jimaku-app .ai-hint-text { margin: 0 0 8px; font-size: 11px; color: #9ca3af; line-height: 1.5; }

.jimaku-app .ai-instruction-input {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(2, 6, 23, 0.35);
    color: #e5e7eb;
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.jimaku-app .ai-instruction-input:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 0.65);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18);
}

.jimaku-app .ai-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@keyframes spinnerRotate { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
    .jimaku-app .app-main { flex-direction: column; }
    .jimaku-app .subtitle-list { max-height: 260px; }
    .jimaku-app .ai-modal-box { width: 92vw; }
}
