@import "../../theme.css";

input, select, button { font-family: inherit; }
body { margin: 0; padding: 16px; background-color: var(--bg-main); -webkit-font-smoothing: antialiased; color: var(--text-primary); height: 100vh; height: 100dvh; box-sizing: border-box; overflow: hidden; }

*:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
input:focus, select:focus, button:focus { outline: none !important; }

.tool-wrapper { display: flex; flex-direction: column; height: 100%; gap: 12px; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }

.tool-header { display: flex; justify-content: space-between; align-items: center; }
.header-main h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px 0; display: flex; align-items: center; gap: 8px;}
.header-main p { margin: 0; font-size: 12px; color: var(--text-secondary); }

.workspace-grid { flex: 1; display: grid; grid-template-columns: 360px 1fr; gap: 14px; min-height: 0; }

.pane { background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; position: relative; transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth); min-height: 0; }
.pane:focus-within { border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-tint); }
.pane-header { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.pane-title { font-size: 13px; font-weight: 600; color: var(--text-primary); flex: 1; }

.config-pane { overflow-y: auto; padding-right: 4px; background-color: #F8FAFC; }
.config-pane::-webkit-scrollbar { width: 6px; }
.config-pane::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.1); border-radius: 3px; }

.config-form { display: flex; flex-direction: column; gap: 12px; flex: 1; }

.config-block { background-color: #FFF; border: 1px solid var(--border-color); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.01); }
.block-title { font-size: 12px; font-weight: 600; color: var(--text-primary); }

.form-row { display: flex; gap: 10px; width: 100%; }
.form-group { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.form-group label { font-size: 11px; font-weight: 500; color: var(--text-secondary); }

/* 拖拽上传框 */
.file-drop-zone { border: 2px dashed var(--border-color); border-radius: 8px; background-color: #FFF; height: 120px; display: flex; justify-content: center; align-items: center; position: relative; cursor: pointer; transition: all var(--transition-smooth); }
.file-drop-zone:hover, .file-drop-zone.drag-over { border-color: var(--accent-color); background-color: var(--accent-tint); }
.file-drop-zone.active { border-style: solid; border-color: #10B981; background-color: rgba(16, 185, 129, 0.03); }

.drop-zone-hint { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-secondary); pointer-events: none; }
.drop-zone-hint span { font-size: 12px; font-weight: 500; }
.drop-zone-hint .size-limit-hint { font-size: 10px; color: var(--text-muted); }
.upload-icon { width: 24px; height: 24px; color: var(--text-muted); }

.file-loaded-info { display: flex; align-items: center; gap: 12px; width: 100%; padding: 0 16px; pointer-events: auto; }
.file-icon-box { font-size: 32px; flex-shrink: 0; }
.file-meta-details { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.loaded-file-name { font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loaded-file-size { font-size: 10px; color: var(--text-secondary); }

.custom-input { background-color: #F8FAFC; border: 1px solid var(--border-color); border-radius: 6px; padding: 0 10px; font-size: 12px; color: var(--text-primary); height: 32px; transition: all var(--transition-smooth); width: 100%; box-sizing: border-box; }
.custom-input:focus { background-color: #FFF; border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-tint); }
select.custom-input { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 5 6 8 9 5'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

.btn { box-sizing: border-box; border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; font-weight: 500; transition: all var(--transition-smooth); background-color: #FFF; color: var(--text-primary); display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 11px; }
.btn-muted { border-color: var(--border-color); color: var(--text-secondary); }
.btn-muted:hover { background-color: var(--bg-active-hover); color: var(--text-primary); }
.btn-primary { background-color: var(--accent-color); color: #FFF; border-color: var(--accent-color); }
.btn-primary:hover { opacity: 0.95; box-shadow: 0 2px 6px rgba(79, 70, 229, 0.15); }
.btn:active { transform: scale(0.97); }

.btn-generate-action {
    width: 100% !important;
    height: 46px !important; 
    font-size: 14px !important; 
    font-weight: 600 !important;
    letter-spacing: 0.8px !important;
    border-radius: 8px !important;
    border: none !important;
    background-color: var(--accent-color) !important;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.18) !important;
    transition: all var(--transition-smooth) !important;
    margin-top: 12px !important;
    margin-bottom: 4px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; 
}
.btn-generate-action:hover {
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3) !important;
    transform: translateY(-1px);
    background-color: #4338CA !important;
}
.btn-generate-action:disabled { background-color: var(--text-muted) !important; box-shadow: none !important; cursor: not-allowed; opacity: 0.6; transform: none; }

.badge { font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 4px; letter-spacing: 0.05em; }
.badge-slate { background-color: var(--bg-active); color: var(--text-secondary); }
.badge-indigo { background-color: var(--accent-tint); color: var(--accent-color); }

/* 右侧预览结果区 */
.preview-pane { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow-y: auto; padding: 16px; box-sizing: border-box; }
.result-placeholder { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 20px; color: var(--text-secondary); }
.placeholder-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.8; }
.result-placeholder h3 { margin: 0 0 6px 0; font-size: 14px; color: var(--text-primary); font-weight: 600; }
.result-placeholder p { margin: 0; font-size: 12px; max-width: 280px; line-height: 1.6; color: var(--text-muted); }

.result-area { flex: 1; display: flex; flex-direction: column; gap: 14px; justify-content: center; align-items: center; animation: slideUp 0.3s cubic-bezier(0.25, 1, 0.5, 1); width: 100%; }
@keyframes slideUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.short-link-box { display: flex; align-items: center; justify-content: space-between; background-color: #F0FDF4; border: 1px solid #BBF7D0; border-radius: 8px; padding: 10px 14px; width: 100%; max-width: 480px; box-sizing: border-box; gap: 10px; }
.short-link-details { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.short-link-text { font-size: 13px; font-weight: 700; color: #166534; user-select: all; word-break: break-all; }

.qr-section { display: flex; flex-direction: column; align-items: center; gap: 10px; background-color: #F8FAFC; padding: 16px; border-radius: 12px; border: 1px dashed var(--border-color); width: 100%; max-width: 480px; box-sizing: border-box; }
.qr-label { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.qrcode-border-wrap { background: #FFF; padding: 12px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); display: flex; justify-content: center; align-items: center; }

/* 遮罩及提示 */
.processing-overlay { position: absolute; inset: 0; background-color: rgba(255,255,255,0.85); backdrop-filter: blur(2px); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 200; gap: 12px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border-color); border-top-color: var(--accent-color); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-text { font-size: 13px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* 💡 Toast 提示修复溢出问题，适应移动端长文本显示 */
.toast-notification { 
    position: fixed; 
    top: -50px; 
    left: 50%; 
    transform: translateX(-50%); 
    background-color: rgba(15, 23, 42, 0.95); 
    color: #FFF; 
    padding: 10px 20px; 
    border-radius: 8px; 
    font-size: 13px; 
    font-weight: 500; 
    box-shadow: 0 6px 20px rgba(0,0,0,0.15); 
    z-index: 9999; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    opacity: 0; 
    transition: top 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease; 
    pointer-events: none; 
    max-width: 85vw;
    white-space: normal;
    word-break: break-all;
    line-height: 1.5;
}
.toast-notification.show { top: 20px; opacity: 1; }

@media (max-width: 850px) {
    body { padding: 8px; overflow-y: auto; height: auto; }
    input, textarea, select { font-size: 16px !important; }
    .workspace-grid { grid-template-columns: 1fr; height: auto; }
    .config-pane { min-height: auto; }
    .preview-pane { min-height: 400px; height: auto; padding-bottom: 20px; }
    .result-area { padding: 14px 0; }
}