/* 全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    overflow: auto;
}

/* 应用容器 */
.app-container {
    display: flex;
    min-height: 100vh;
    background-color: #f8f9fa;
    position: relative;
}

/* 侧边栏切换按钮 */
.sidebar-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1050;
    display: none;
}

/* 左侧边栏 */
.sidebar {
    width: 250px;
    background-color: #343a40;
    color: white;
    padding: 20px 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid #495057;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #f8f9fa;
}

.sidebar-header .btn-outline-light {
    color: #f8f9fa;
    border-color: #f8f9fa;
    padding: 4px 8px;
    font-size: 12px;
}

.sidebar-header .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    padding: 10px 0;
}

.sidebar-nav .nav-item {
    position: relative;
}

.sidebar-nav .nav-link {
    color: #adb5bd;
    padding: 10px 20px;
    margin: 0;
    border-radius: 0;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.sidebar-nav .nav-link:hover {
    background-color: #495057;
    color: white;
}

.sidebar-nav .nav-link.active {
    background-color: #007bff;
    color: white;
}

/* 自定义模块下拉菜单 */
#custom-modules-dropdown {
    background-color: #343a40;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1010;
    position: absolute;
    width: 100%;
    left: 0;
    top: 100%;
    display: block;
}

/* 确保系统设置不被折叠 */
.sidebar-nav > .nav-item:nth-child(4) {
    position: relative;
    z-index: 1020;
}

#custom-modules-dropdown .dropdown-item {
    color: #adb5bd;
    padding: 10px 20px;
    font-size: 14px;
    transition: all 0.2s ease;
}

#custom-modules-dropdown .dropdown-item:hover {
    background-color: #495057;
    color: white;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
}

/* 应用式导航界面 */
.app-navigation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f8f9fa;
    z-index: 900;
    transition: all 0.3s ease;
}

.app-card {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.app-card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-5px);
}

.app-icon {
    font-size: 36px;
    margin-bottom: 10px;
    color: #007bff;
}

/* 应用式选择界面 */
.app-selection-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #343a40;
    color: white;
    z-index: 2000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-selection-container {
    width: 100%;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.app-selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #495057;
}

.app-selection-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.app-card-large {
    background-color: #495057;
    border-radius: 10px;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.app-card-large:hover {
    background-color: #007bff;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    transform: translateY(-10px);
}

.app-icon-large {
    font-size: 48px;
    margin-bottom: 15px;
    color: white;
}

.app-card-large h4 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
}

.app-card-large p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

/* 页面切换 */
.page {
    display: none;
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

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

/* 仪表盘样式 */
.container-fluid {
    max-width: 1200px;
    margin: 0 auto;
}

/* 快速API选择 */
#quick-api-select {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

/* 选项卡样式 */
.tab-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.nav-tabs {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0 10px;
    margin: 0;
}

.nav-tabs .nav-link {
    border: 1px solid transparent;
    border-radius: 6px 6px 0 0;
    margin-right: 8px;
    color: #495057;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.nav-tabs .nav-link:hover {
    border-color: #dee2e6 #dee2e6 #fff;
    background-color: #e9ecef;
}

.nav-tabs .nav-link.active {
    background-color: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
    font-weight: 600;
    color: #007bff;
}

.tab-content {
    background-color: #fff;
    padding: 20px;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

/* API设置页面 */
#api-settings {
    background-color: #f8f9fa;
}

#api-settings h2 {
    color: #212529;
    margin-bottom: 10px;
}

#api-settings .card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#api-settings .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

#api-settings .card-header-tabs {
    border-bottom: none;
}

#api-settings .card-header-tabs .nav-link {
    border-radius: 6px 6px 0 0;
    color: #495057;
    transition: all 0.2s ease;
}

#api-settings .card-header-tabs .nav-link.active {
    background-color: white;
    border-color: #dee2e6 #dee2e6 white;
    color: #007bff;
}

#api-settings .card-body {
    background-color: white;
}

.api-config-form {
    padding: 10px 0;
}

.api-config-form .form-control {
    margin-bottom: 15px;
}

/* 模板配置页面 */
#template-settings .card {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#template-settings .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

#template-settings .card-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#template-settings .card-body {
    padding: 20px;
}

/* 工作流搭建页面 */
#workflow .card {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#workflow .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

#workflow .card-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#workflow-steps {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    min-height: 200px;
    border-radius: 4px;
    border: 1px solid #ddd;
    padding: 10px;
    resize: vertical;
}

/* 表单样式 */
.form-control {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.form-label {
    font-weight: 500;
    margin-bottom: 5px;
    color: #495057;
    display: block;
}

/* 按钮样式 */
.btn {
    border-radius: 4px;
    border: 1px solid transparent;
    padding: 6px 12px;
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #004085;
}

.btn-secondary {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #495057;
}

.btn-secondary:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* 表格样式 */
.table {
    font-size: 14px;
    border-collapse: collapse;
    width: 100%;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    padding: 8px 12px;
    text-align: left;
}

.table td {
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
    padding: 8px 12px;
}

.table-bordered {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #dee2e6;
}

/* 列表样式 */
.list-group {
    margin-bottom: 15px;
}

.list-group-item {
    position: relative;
    display: block;
    padding: 10px 15px;
    margin-bottom: -1px;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.125);
    cursor: pointer;
    transition: all 0.2s ease;
}

.list-group-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.list-group-item:last-child {
    margin-bottom: 0;
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 8px;
}

.list-group-item:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
}

.list-group-item.active {
    z-index: 2;
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 加载状态 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

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

/* 文本区域样式 */
textarea {
    resize: vertical;
    min-height: 100px;
}

/* API状态样式 */
#api-status {
    font-weight: 500;
    background-color: #e3f2fd;
    color: #1976d2;
    border-radius: 4px;
    padding: 6px 12px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        height: 100%;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        padding: 10px;
        margin-left: 0;
        transition: margin-left 0.3s ease;
    }
    
    .main-content.shifted {
        margin-left: 250px;
    }
    
    .row {
        flex-direction: column;
    }
    
    .col-md-4, .col-md-8, .col-md-3, .col-md-5, .col-md-6, .col-md-9 {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .nav-tabs .nav-link {
        margin-bottom: 5px;
    }
    
    .app-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .app-card-large {
        padding: 20px 15px;
        min-height: 150px;
    }
    
    .app-icon-large {
        font-size: 36px;
    }
    
    .app-card-large h4 {
        font-size: 16px;
    }
    
    .app-card-large p {
        font-size: 12px;
    }
}



/* 其他页面样式 */
#dashboard, #template-settings, #workflow {
    padding: 0;
}

/* 可视化工作流编辑器样式 */
.node-library {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    height: 100%;
    overflow-y: auto;
}

.node-library h6 {
    margin-bottom: 15px;
    font-weight: 600;
}

.node-item {
    background-color: white;
    border: 1px solid #007bff;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: grab;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.node-item:hover {
    background-color: #e3f2fd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
    border-color: #0056b3;
}

.node-item:active {
    cursor: grabbing;
}

.node-item i {
    font-size: 18px;
    color: #007bff;
}

.node-library h6 {
    margin-bottom: 15px;
    font-weight: 600;
    color: #495057;
    padding-bottom: 5px;
    border-bottom: 1px solid #e9ecef;
}

.workflow-canvas-container {
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

#workflow-canvas {
    background-color: white;
    cursor: crosshair;
}

.node-properties {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    height: 100%;
    overflow-y: auto;
}

.node-properties h6 {
    margin-bottom: 15px;
    font-weight: 600;
}

.node-properties-content {
    background-color: white;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

/* 工作流节点样式 */
.workflow-node {
    position: absolute;
    background-color: white;
    border: 2px solid #007bff;
    border-radius: 8px;
    padding: 15px;
    min-width: 150px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: move;
    z-index: 10;
}

.workflow-node.selected {
    border-color: #ffc107;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.3);
}

.workflow-node .node-title {
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.workflow-node .node-type {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 10px;
}

.workflow-node .node-actions {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.workflow-node .node-actions button {
    padding: 2px 8px;
    font-size: 12px;
}

/* 连线样式 */
.workflow-connection {
    stroke: #6c757d;
    stroke-width: 2;
    fill: none;
}

.workflow-connection.selected {
    stroke: #ffc107;
    stroke-width: 3;
}

.workflow-connection:hover {
    stroke: #007bff;
    stroke-width: 3;
}

/* 端口样式 */
.workflow-port {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #007bff;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
}

.workflow-port:hover {
    transform: scale(1.2);
    background-color: #0056b3;
}

.workflow-port.in-port {
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
}

.workflow-port.out-port {
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
}

/* 选择下拉框样式 */
select.form-select {
    cursor: pointer;
}

/* 文本输入框样式 */
input.form-control {
    cursor: text;
}

/* 输出设置样式 */
#output-before, #output-during, #output-after {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 模板编辑器样式 */
#template-content {
    min-height: 300px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

/* 批量生成结果表格 */
#batch-results {
    font-size: 14px;
    width: 100%;
}

#batch-results th {
    font-weight: 600;
    background-color: #f8f9fa;
}

#batch-results td {
    vertical-align: middle;
}

/* 代码块样式 */
pre, code {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 2px 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
}

pre {
    padding: 10px;
    overflow-x: auto;
    margin: 10px 0;
}

pre code {
    border: none;
    background: none;
    padding: 0;
}

/* 卡片标题样式 */
h5.card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

/* 工具栏按钮组 */
.btn-group {
    display: flex;
    gap: 5px;
}

.btn-group .btn {
    margin: 0;
}

/* 搜索框样式 */
input[type="text"]::placeholder {
    color: #adb5bd;
    font-style: italic;
}

/* 复选框样式 */
.form-check {
    margin-bottom: 10px;
}

.form-check-label {
    margin-left: 5px;
}

/* 分隔线样式 */
hr {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid #e9ecef;
}

/* 信息提示样式 */
.alert {
    padding: 10px 15px;
    margin-bottom: 15px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}
