/**
 * 图片生成系统主样式文件
 * 现代化UI设计
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: #f5f7fb;
    color: #1f2329;
    line-height: 1.6;
}

/* 首页全屏布局 */
body:not(.admin-page) {
    min-height: 100vh;
    overflow-y: auto;
    background-attachment: fixed;
}

/* 主容器 */
.container {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
}

/* 首页全屏布局 */
body:not(.admin-page) .container {
    min-height: 100vh;
}

/* 头部 */
.header {
    background: rgba(255,255,255,0.7);
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    backdrop-filter: blur(10px);
    padding: 14px 24px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header .nav {
    display: inline-flex;
    gap: 10px;
}

.header .nav a {
    color: #1d4ed8;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid rgba(29, 78, 216, 0.15);
    background: linear-gradient(120deg, rgba(248,249,255,0.8), rgba(241,245,255,0.9));
    font-size: 14px;
    transition: all 0.2s ease;
}

.header .nav a:hover {
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.3);
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-config {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #fff;
    color: #475467;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-config:hover {
    color: #1d4ed8;
    border-color: rgba(29, 78, 216, 0.2);
    background: rgba(248, 249, 255, 0.8);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.btn-config svg {
    width: 16px;
    height: 16px;
}

/* 主页面布局 */
.main-layout {
    display: flex;
    gap: 24px;
    flex: 1;
    overflow: hidden;
    padding: 24px;
}

/* 生成器标签页 */
.generator-tabs {
    display: flex;
    gap: 12px;
    padding: 16px 24px 0;
    background: rgba(255,255,255,0.6);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.generator-tab {
    border: none;
    background: transparent;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    color: #475467;
    cursor: pointer;
    transition: all 0.2s ease;
}

.generator-tab.active {
    background: #1d4ed8;
    color: #fff;
    box-shadow: 0 8px 18px rgba(29, 78, 216, 0.25);
}

.generator-panels {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.generator-panel {
    display: none;
    flex: 1;
    height: 100%;
}

.generator-panel.active {
    display: flex;
    flex-direction: column;
}

.generator-panel .main-layout {
    height: 100%;
}

.home-container {
    padding: 0 32px 48px;
    gap: 24px;
}

.home-hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 32px;
    padding: 32px 0;
    align-items: center;
}

.hero-text h1 {
    font-size: 32px;
    color: #0f172a;
    margin: 12px 0 18px;
}

.hero-eyebrow {
    font-size: 14px;
    font-weight: 600;
    color: #1d4ed8;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.hero-desc {
    font-size: 16px;
    color: #475467;
    margin-bottom: 24px;
    line-height: 1.8;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hero-btn {
    padding: 14px 28px;
    flex: initial;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
}

/* hero区域的次要按钮样式 */
.hero-btn.ghost {
    background: rgba(255, 255, 255, 0.9);
    color: #1d4ed8;
    border: 2px solid rgba(29, 78, 216, 0.2);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.hero-btn.ghost:hover {
    background: #fff;
    border-color: #1d4ed8;
    color: #0f172a;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
    transform: translateY(-2px);
}

.hero-preview {
    display: grid;
    gap: 16px;
}

.preview-card {
    background: #fff;
    border-radius: 18px;
    padding: 20px 24px;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15,23,42,0.05);
}

.preview-card h4 {
    margin-bottom: 10px;
    font-size: 16px;
    color: #0f172a;
}

.preview-card ul {
    list-style: disc;
    margin-left: 18px;
    color: #475467;
    font-size: 14px;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.home-card {
    background: #fff;
    border-radius: 18px;
    padding: 20px 24px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.home-card h3 {
    font-size: 18px;
    color: #0f172a;
}

.home-card p {
    flex: 1;
    font-size: 14px;
    color: #475467;
    line-height: 1.7;
}

.home-card.accent {
    background: #fff;
    color: #0f172a;
}

.home-card.accent p {
    color: #475467;
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: none;
    color: #1d4ed8;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    align-self: flex-start;
    padding: 8px 0;
    transition: all 0.2s ease;
    text-decoration: none;
}

.text-link:hover {
    color: #0f172a;
    transform: translateX(4px);
}

/* accent卡片中的链接样式 - 与其他卡片保持一致 */
.home-card.accent .text-link {
    color: #1d4ed8;
}

.home-card.accent .text-link:hover {
    color: #0f172a;
    transform: translateX(4px);
}

.home-tips {
    background: #fff;
    border-radius: 18px;
    padding: 28px;
    margin-top: 24px;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.home-tips h3 {
    margin-bottom: 12px;
    color: #0f172a;
}

.home-tips ol {
    padding-left: 20px;
    color: #475467;
    line-height: 1.8;
}

.batch-page-wrapper {
    padding: 32px;
}

.batch-panel {
    margin: 0 24px 24px;
    background: #fff;
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    height: calc(100% - 24px);
}

.batch-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.batch-panel-header h3 {
    font-size: 20px;
    color: #0f172a;
    margin-bottom: 6px;
}

.batch-panel-desc {
    font-size: 13px;
    color: #98a2b3;
    max-width: 520px;
}

.batch-panel-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.batch-panel-actions .btn.btn-warning {
    background: #f59e0b;
    color: #fff;
}

.batch-panel-actions .btn.btn-warning:hover {
    background: #d97706;
}

.batch-usage-hint {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    color: #475467;
}

.batch-usage-hint strong {
    color: #1d4ed8;
    font-size: 16px;
}

.batch-usage-hint small {
    color: #94a3b8;
    font-size: 12px;
}

.batch-layout-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
}

.layout-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #475467;
    cursor: pointer;
}

.layout-option input {
    accent-color: #1d4ed8;
}

.layout-select-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.batch-layout-select {
    min-width: 220px;
    padding: 10px 14px;
    border: 1px solid #cbd5f5;
    border-radius: 10px;
    font-size: 13px;
    background: #fff;
}

.batch-panel-actions .btn {
    flex: initial;
    min-width: auto;
    white-space: nowrap;
}

.batch-render-sandbox {
    position: fixed;
    bottom: -9999px;
    right: -9999px;
    width: 512px;
    height: 512px;
    pointer-events: none;
    opacity: 0;
    z-index: -1;
}

.batch-render-sandbox .canvas-container {
    height: 100%;
    padding: 0;
    border: none;
    box-shadow: none;
}

.batch-render-sandbox #sandboxCanvas {
    width: 100%;
    height: 100%;
}

.batch-progress {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px dashed #d0d5dd;
    background: #f8fafc;
    color: #475467;
    font-size: 13px;
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}

.batch-progress.active {
    display: flex;
}

.batch-progress strong {
    color: #1d4ed8;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-pending {
    background: rgba(14, 116, 144, 0.12);
    color: #0e7490;
}

.status-saving {
    background: rgba(251, 191, 36, 0.2);
    color: #b45309;
}

.status-success {
    background: rgba(16, 185, 129, 0.2);
    color: #047857;
}

.status-warning {
    background: rgba(251, 191, 36, 0.2);
    color: #92400e;
}

.status-failed {
    background: rgba(239, 68, 68, 0.2);
    color: #b91c1c;
}

.status-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #94a3b8;
}

.batch-status {
    margin: 18px 0 16px;
    font-size: 13px;
    color: #7f8c8d;
}

.batch-status.muted {
    color: #98a2b3;
}

.batch-status.success {
    color: #27ae60;
}

.batch-status.error {
    color: #e74c3c;
}

.batch-status.info {
    color: #475467;
}

.batch-table {
    flex: 1;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    overflow: auto;
}

.batch-table table {
    width: 100%;
    border-collapse: collapse;
}

.batch-table th,
.batch-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #eef2f7;
    font-size: 13px;
    color: #475467;
}

.batch-table th {
    background: #f8fafc;
    color: #1f2329;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.batch-table tbody tr:last-child td {
    border-bottom: none;
}

.batch-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.batch-item-meta img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid #eef2f7;
}

.batch-item-meta span {
    display: block;
    font-size: 13px;
    color: #0f172a;
}

.batch-item-meta small {
    display: block;
    font-size: 12px;
    color: #98a2b3;
}

.batch-text-meta span {
    display: block;
    font-size: 13px;
    color: #0f172a;
    line-height: 1.4;
}

.batch-text-meta small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #98a2b3;
}

.batch-empty {
    text-align: center;
    padding: 30px;
    color: #98a2b3;
    font-size: 13px;
}

.text-button {
    border: none;
    background: #eef2ff;
    color: #1d4ed8;
    cursor: pointer;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 999px;
    transition: all 0.2s ease;
    line-height: 1;
}

.text-button:hover:not(:disabled) {
    background: #dbeafe;
    color: #0f172a;
    text-decoration: none;
}

.text-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #98a2b3;
}

.text-button.danger {
    background: #fee2e2;
    color: #dc2626;
}

.text-button.danger:hover:not(:disabled) {
    background: #fecaca;
    color: #b91c1c;
}

.batch-select-header {
    width: 80px;
    text-align: center;
}

.batch-header-center,
.batch-table td {
    text-align: center;
    vertical-align: middle;
}

.batch-row-highlight {
    background: #ecfeff;
    box-shadow: inset 0 0 0 1px rgba(6, 182, 212, 0.6);
}

.select-all-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #475467;
    user-select: none;
}

.select-all-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.select-all-toggle label {
    cursor: pointer;
}

.btn-inline {
    flex: initial;
}

/* 左侧面板 - 元素选择 */
.left-panel {
    width: 280px;
    min-width: 280px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    padding: 20px;
    overflow-y: auto;
    flex-shrink: 0;
}

.panel-section {
    margin-bottom: 30px;
}

.panel-section h3 {
    font-size: 15px;
    color: #0f172a;
    margin-bottom: 15px;
    letter-spacing: .2px;
}

/* 搜索框样式 */
.panel-search {
    margin-bottom: 12px;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    color: #1f2329;
    background: #f8f9fa;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-input::placeholder {
    color: #98a2b3;
}

/* 分页信息样式 */
.panel-pagination-info {
    font-size: 12px;
    color: #7f8c8d;
    text-align: center;
    margin: 10px 0 8px;
    padding: 6px 0;
}

/* 分页控件样式 */
.panel-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.panel-pagination button {
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    color: #1f2329;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
}

.panel-pagination button:hover:not(:disabled) {
    border-color: #3498db;
    background: #f0f7ff;
    color: #3498db;
}

.panel-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}

.panel-pagination .page-info {
    font-size: 12px;
    color: #7f8c8d;
    padding: 0 8px;
}

/* 管理页面分页样式 */
.admin-pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0 10px;
    padding: 8px 0;
}

.admin-pagination-info {
    font-size: 13px;
    color: #7f8c8d;
}

.admin-pagination-size {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-pagination-size label {
    font-size: 13px;
    color: #7f8c8d;
    margin: 0;
}

.admin-pagination-size select {
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    color: #1f2329;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-pagination-size select:hover {
    border-color: #3498db;
}

.admin-pagination-size select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.admin-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 15px 0;
}

.admin-pagination button {
    padding: 8px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    color: #1f2329;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 70px;
}

.admin-pagination button:hover:not(:disabled) {
    border-color: #3498db;
    background: #f0f7ff;
    color: #3498db;
}

.admin-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}

.admin-pagination .page-info {
    font-size: 13px;
    color: #7f8c8d;
    padding: 0 12px;
}

/* 元素列表 */
.element-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.element-item {
    position: relative;
    cursor: pointer;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    aspect-ratio: 1;
}

.element-item:hover {
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.element-item.active {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

.element-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.element-item .element-name {
    padding: 8px;
    font-size: 12px;
    text-align: center;
    background: #f8f9fa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 文字元素 */
.text-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid #e0e0e0;
}

.text-item:hover {
    border-color: #3498db;
    background: #e8f4f8;
}

.text-item.active {
    border-color: #3498db;
    background: #d4e6f1;
}

.text-item .text-content {
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 5px;
}

.text-item .text-meta {
    font-size: 12px;
    color: #7f8c8d;
}

/* 上传按钮 */
.upload-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    width: 100%;
    margin-top: 10px;
}

.upload-btn:hover {
    background: #2980b9;
}

.upload-btn input[type="file"] {
    display: none;
}

/* AI生成按钮 */
.ai-generate-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #9b59b6;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    width: 100%;
    margin-top: 10px;
}

.ai-generate-btn:hover {
    background: #8e44ad;
}

/* 中间画布区域 */
.canvas-area {
    flex: 1;
    min-width: 0;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.canvas-container {
    flex: 1;
    position: relative;
    background: #f8f9fa;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    overflow: visible; /* 改为visible，确保HTML2Canvas可以正确截图 */
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#canvas {
    position: relative;
    background: #fff;
    /* 尺寸由JS动态设置，固定为正方形比例 1:1 */
    /* 确保HTML2Canvas可以正确截图 */
    overflow: visible;
    transform: translateZ(0); /* 启用硬件加速，提高截图质量 */
    aspect-ratio: 1 / 1; /* 强制保持正方形比例 */
    box-sizing: border-box;
}

@media (max-width: 1200px) {
    .canvas-container {
        height: 400px;
    }
}

/* 可拖拽元素 */
.draggable-element {
    position: absolute;
    cursor: move;
    user-select: none;
}

.draggable-element.dragging {
    opacity: 0.8;
    z-index: 1000;
}

/* 背景图层 */
.layer-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    object-fit: cover; /* 确保背景图填充画布 */
    /* 背景图不需要交互，但HTML2Canvas可以正常截图 */
}

/* 贴图层 */
.layer-sticker {
    z-index: 2;
}

.layer-sticker img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* pointer-events由drag.js动态控制，不需要在这里设置 */
}

/* 文字层 */
.layer-text {
    z-index: 3;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    /* pointer-events由drag.js动态控制，不需要在这里设置 */
    min-width: 0;
    min-height: 0;
    display: inline-block;
}

/* 右侧属性面板 */
.right-panel {
    width: 260px;
    min-width: 260px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(15,23,42,0.08);
    padding: 20px;
    overflow-y: auto;
    flex-shrink: 0;
}

.property-group {
    margin-bottom: 22px;
}

/* 必填字段星号标记 */
label.required::after,
label:has(+ input[required])::after,
label:has(+ textarea[required])::after,
label:has(+ select[required])::after {
    content: ' *';
    color: #e74c3c;
    font-weight: bold;
}

.property-group label {
    display: block;
    font-size: 13px;
    color: #475467;
    margin-bottom: 6px;
    font-weight: 600;
}

.property-group input,
.property-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    font-size: 14px;
    background: #f8fafc;
}

.property-group input:focus,
.property-group select:focus {
    outline: none;
    border-color: #1d4ed8;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
    background: #fff;
}

/* AI生成表单 */
.ai-form {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
    padding: 24px 26px;
    margin-bottom: 24px;
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.ai-form h3 {
    margin-bottom: 18px;
    font-size: 18px;
    color: #0f172a;
}

.ai-form__body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field.full {
    grid-column: 1 / -1;
}

.form-field--action {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
}

.ai-label {
    font-size: 13px;
    font-weight: 600;
    color: #475467;
}

.ai-hint {
    display: block;
    font-size: 12px;
    color: #98a2b3;
    margin-top: -4px;
}

.ai-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    font-size: 14px;
    background: #f8fafc;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.ai-input:focus {
    outline: none;
    border-color: #1d4ed8;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.ai-input--textarea {
    min-height: 110px;
    resize: vertical;
}

/* 操作按钮区域 */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-sizing: border-box;
}

.btn:not(.hero-btn) {
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff;
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e40af, #1d4ed8);
    box-shadow: 0 6px 18px rgba(29, 78, 216, 0.3);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475467;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #334155;
}

.btn-warning {
    background: #fbbf24;
    color: #78350f;
    border: 1px solid #f59e0b;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.btn-warning:hover {
    background: #f59e0b;
    color: #fff;
}

/* 管理页面样式 */
body.admin-page {
    overflow: auto;
    min-height: 100vh;
}

.admin-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 40px 32px 56px;
}

.admin-header {
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(15, 23, 42, 0.07);
    border-radius: 18px;
    padding: 20px 28px;
    margin-bottom: 28px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.06);
}

.admin-title h1 {
    font-size: 24px;
    color: #0f172a;
    margin-bottom: 6px;
}

.admin-title p {
    font-size: 14px;
    color: #667085;
}

.admin-nav {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-nav a {
    color: #1d4ed8;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid rgba(29, 78, 216, 0.2);
    background: linear-gradient(120deg, rgba(248,249,255,0.9), rgba(241,245,255,0.95));
    font-size: 14px;
    transition: all 0.2s ease;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.3);
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
    gap: 36px;
    margin-bottom: 36px;
    align-items: stretch;
}

.admin-grid.dual-cards {
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    align-items: stretch;
}

.admin-grid.dual-cards .admin-card {
    width: 100%;
}

.admin-card {
    background: #fff;
    border-radius: 18px;
    padding: 28px 30px;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.admin-card h3 {
    font-size: 17px;
    color: #0f172a;
    margin-bottom: 14px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.card-header h3 {
    margin: 0;
}

.card-meta {
    font-size: 13px;
    color: #98a2b3;
}

.admin-card p.card-hint {
    font-size: 13px;
    color: #98a2b3;
    margin-bottom: 16px;
}

.admin-card form input[type="file"] {
    display: block;
    width: 100%;
    padding: 14px 16px;
    border: 2px dashed #cbd5f5;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    margin-bottom: 14px;
    font-size: 14px;
    color: #475467;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.admin-card form input[type="file"]:hover {
    border-color: #1d4ed8;
    background: #f0f7ff;
}

.admin-card form input[type="file"]:focus {
    outline: none;
    border-color: #1d4ed8;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

/* 文件输入框的伪元素样式（用于自定义文件选择按钮） */
.admin-card form input[type="file"]::file-selector-button {
    padding: 8px 16px;
    margin-right: 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-card form input[type="file"]::file-selector-button:hover {
    background: linear-gradient(135deg, #1e40af, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(29, 78, 216, 0.2);
}

.admin-card form input[type="text"],
.admin-card form input[type="number"],
.admin-card form input[type="color"],
.admin-card form textarea,
.admin-card form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    font-size: 14px;
    background: #f8fafc;
    margin-bottom: 12px;
}

.admin-card form textarea {
    min-height: 100px;
    resize: vertical;
}

.admin-card .form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-card .form-row .field {
    flex: 1;
    min-width: 140px;
}

.admin-card label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475467;
    margin-bottom: 6px;
}

.admin-card small {
    display: block;
    font-size: 12px;
    color: #98a2b3;
    margin-top: -6px;
    margin-bottom: 12px;
}

.admin-table {
    margin-top: 10px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.admin-table table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #eef2f6;
    font-size: 14px;
}

.admin-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #0f172a;
}

.admin-table tr:hover td {
    background: #f3f6fb;
}

.admin-table img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 6px 12px rgba(15,23,42,0.08);
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-small.btn-secondary {
    background: #f1f5f9;
    color: #475467;
    border: 1px solid #e2e8f0;
}

.btn-small.btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* 任务中心 */
.task-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.task-card .card-header > div:first-child {
    flex: 1;
    min-width: 320px;
}

.task-actions {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.task-actions .btn-small {
    background: #f8fafc;
    border: 1px solid #d9e1ec;
    color: #334155;
}

.task-actions .btn-small:hover {
    background: #e2e8f0;
}

.task-tips {
    font-size: 12px;
    color: #475467;
    background: #f8fafc;
    border: 1px dashed #cbd5f5;
    padding: 12px 18px;
    border-radius: 12px;
    margin-bottom: 18px;
    line-height: 1.5;
}

.task-tips code {
    background: #e2e8f0;
    border-radius: 4px;
    padding: 2px 6px;
}

.task-table {
    max-height: 420px;
    overflow-y: auto;
}

/* 任务中心状态标签 */
.task-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    min-width: 70px;
}
.task-status.pending {
    background: #94a3b8;
}
.task-status.processing {
    background: #f97316;
}
.task-status.success {
    background: #10b981;
}
.task-status.danger {
    background: #ef4444;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    padding: 32px;
    border-radius: 18px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.modal-header {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.modal-header h3 {
    font-size: 20px;
    color: #0f172a;
    font-weight: 600;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #94a3b8;
    margin-left: auto;
}

.modal-close:hover {
    color: #0f172a;
}

.modal-body {
    margin-bottom: 24px;
    color: #475467;
    line-height: 1.6;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
    margin-bottom: 8px;
}

.modal-body .form-group label.required::after {
    content: ' *';
    color: #e74c3c;
    font-weight: bold;
}

.modal-body .form-group input[type="text"],
.modal-body .form-group input[type="number"],
.modal-body .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    font-size: 14px;
    color: #1f2329;
    background: #fff;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.modal-body .form-group input[type="text"]:focus,
.modal-body .form-group input[type="number"]:focus,
.modal-body .form-group textarea:focus {
    outline: none;
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.modal-body .form-group small {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* 定位存档弹窗 */
#positionModal .position-modal {
    max-width: 1000px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    padding-top: 48px;
}

#positionModal .modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
}

.position-form {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.position-form .form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.position-form .form-row.justify-end {
    justify-content: flex-end;
    margin-bottom: 0;
}

.position-form .field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.position-form input,
.position-form textarea {
    border: 1px solid #cbd5f5;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    width: 100%;
}

.position-table-wrapper {
    flex: 1;
    overflow: auto;
}

.position-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e2e8f0;
}

.position-table th,
.position-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    vertical-align: top;
}

.position-label {
    font-weight: 600;
    color: #0f172a;
}

.position-meta {
    font-size: 12px;
    color: #94a3b8;
}

.position-assoc span,
.position-coords span {
    display: block;
    font-size: 12px;
    color: #475467;
}

.position-remarks {
    font-size: 13px;
    color: #475467;
}

.position-actions {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
}

.position-actions .text-button {
    white-space: nowrap;
}

.text-status-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.text-status-cell .btn-small {
    width: fit-content;
}

/* 消息提示 */
.message {
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    display: none;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.message.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.message.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.message.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-layout {
        flex-direction: column;
        height: auto;
    }
    
    .left-panel,
    .right-panel {
        width: 100%;
    }
    
    body {
        overflow: auto;
    }
    
    .container {
        height: auto;
        min-height: 100vh;
    }
}

