/* ER总图工具样式 - 基于erdgram_modern_v2.css */

.main-wrapper, body {
    background: #f5f6fa;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #333;
    line-height: 1.6;
}

.main-wrapper {
    min-height: 100vh;
}

/* 顶部标题区域 */
.top-header {
    background: #fff;
    border-bottom: 1px solid #e8eaed;
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: center;
}

.main-title {
    font-size: 24px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 8px;
}

.main-subtitle {
    font-size: 14px;
    color: #5f6368;
    margin-bottom: 16px;
}

.feature-tags {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.feature-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 16px;
    font-size: 12px;
    color: #5f6368;
    border: 1px solid #e8eaed;
}

.feature-tag i {
    color: #1a73e8;
    font-size: 14px;
}

/* 主容器 - 两栏布局 */
.main-container {
    width: 100%;
    margin: 0;
    padding: 32px 0;
    display: grid;
    grid-template-columns: 380px 1fr;
    align-items: start;
    min-height: 600px;
    gap: 20px;
}

@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 20px 16px;
    }
}

/* 左侧面板 */
.left-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 10px 0 24px;
    height: 1200px;
    box-sizing: border-box;
}

/* 卡片样式 */
.card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8eaed;
    overflow: hidden;
    transition: box-shadow .2s;
}

.card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f3f4;
    background: #fafbfc;
}

.card-title {
    font-size: 16px;
    font-weight: 500;
    color: #202124;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.card-title i {
    color: #1a73e8;
    font-size: 18px;
}

.card-body {
    padding: 20px;
}

/* SQL输入区域 */
.sql-input-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sql-input-card .card-body {
    padding: 20px 20px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sql-textarea {
    width: 100%;
    flex: 1;
    min-height: 200px;
    padding: 12px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-family: Monaco, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.4;
    background: #fafbfc;
    resize: vertical;
    transition: .2s;
    margin-bottom: 16px;
}

.sql-textarea:focus {
    outline: 0;
    border-color: #1a73e8;
    background: #fff;
    box-shadow: 0 0 0 1px #1a73e8;
}

.sql-textarea::placeholder {
    color: #9aa0a6 !important;
    line-height: 1.4;
    opacity: 1 !important;
    font-size: 12px;
    white-space: pre-line;
}

.primary-btn {
    width: 100%;
    height: 48px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: .2s;
    cursor: pointer;
}

.primary-btn:hover {
    background: #1557b0;
    box-shadow: 0 2px 8px rgba(26,115,232,.24);
}

.primary-btn:active {
    transform: translateY(1px);
}

.primary-btn i {
    font-size: 16px;
}

/* ER图显示区域 - 扩展到右侧全宽 */
.er-display-card {
    height: 1160px;
    margin: 0 24px 0 0;
    display: flex;
    flex-direction: column;
}

.er-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f3f4;
    background: #fafbfc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.er-title {
    font-size: 16px;
    font-weight: 500;
    color: #202124;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.er-title i {
    color: #1a73e8;
    font-size: 18px;
}

.er-toolbar {
    display: flex;
    gap: 6px;
}

.tool-btn {
    width: 36px;
    height: 36px;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .2s;
    color: #5f6368;
    cursor: pointer;
}

.tool-btn:hover {
    background: #f1f3f4;
    border-color: #1a73e8;
    color: #1a73e8;
}

.tool-btn.export-btn {
    width: auto;
    padding: 0 12px;
    gap: 6px;
    background: #34a853;
    border-color: #34a853;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
}

.tool-btn.export-btn:hover {
    background: #2d8f47;
    border-color: #2d8f47;
    color: #fff;
}

.graph-container {
    flex: 1;
    background: #fff;
    position: relative;
    border-radius: 0 0 12px 12px;
    min-height: 800px;
    overflow: hidden;
}

/* 确保mxGraph的SVG可见 */
.graph-container svg {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
}

.empty-state {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #9aa0a6;
    z-index: 1001;
    padding: 40px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    max-width: 500px;
}

.empty-icon {
    margin-bottom: 20px;
}

.empty-icon i {
    color: #d1d5db;
}

.icon-4x {
    font-size: 48px;
}

.text-muted {
    color: #6b7280;
}

.empty-state h4 {
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 12px;
    font-size: 18px;
}

.empty-state p {
    margin: 0 0 20px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #9ca3af;
}

/* 按钮样式 */
.modern-btn {
    font-weight: 500;
    border-radius: 6px;
    padding: 10px 20px;
    transition: all 0.2s;
    border: 1px solid;
    text-shadow: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.modern-btn.btn-success {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
}

.modern-btn.btn-success:hover {
    background: #059669;
    border-color: #059669;
    color: #fff;
    text-decoration: none;
}

.modern-btn i {
    font-size: 14px;
}

/* 表格列表 */
.tables-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tables-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.table-list-container {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    max-height: 450px;
}

.table-item-info {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    transition: .2s;
}

.table-item-info:hover {
    background: #e8f0fe;
    border-color: #1a73e8;
    transform: translateX(2px);
}

.table-name {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 4px;
    color: #202124;
}

.table-comment {
    font-size: 12px;
    color: #5f6368;
    margin-bottom: 2px;
}

.table-column-count {
    font-size: 11px;
    color: #9aa0a6;
}

/* 关系信息卡片 */
.relationships-card {
    flex: 0 0 auto;
}

.relationships-container {
    max-height: 300px;
    overflow-y: auto;
}

.relationship-item {
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #fff3e0;
    border: 1px solid #ffe0b2;
    border-radius: 6px;
    font-size: 12px;
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    gap: 8px;
    align-items: center;
}

.relationship-from {
    font-weight: 500;
    color: #202124;
    text-align: right;
}

.relationship-arrow {
    color: #f57c00;
    font-weight: bold;
}

.relationship-to {
    font-weight: 500;
    color: #202124;
}

.relationship-type {
    color: #5f6368;
    font-size: 10px;
    grid-column: 1 / -1;
    text-align: center;
    padding-top: 4px;
    border-top: 1px solid #ffe0b2;
    margin-top: 4px;
}

/* 错误提示 */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 13px;
    display: none;
    align-items: center;
    gap: 8px;
}

.alert i {
    font-size: 16px;
}

.alert-danger {
    background: #fce8e6;
    color: #d93025;
    border: 1px solid #f28b82;
}

/* 加载动画 */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #f1f3f4;
    border-top: 2px solid #1a73e8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* 滚动条样式 */
.table-list-container::-webkit-scrollbar,
.relationships-container::-webkit-scrollbar {
    width: 6px;
}

.table-list-container::-webkit-scrollbar-track,
.relationships-container::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 3px;
}

.table-list-container::-webkit-scrollbar-thumb,
.relationships-container::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 3px;
}

.table-list-container::-webkit-scrollbar-thumb:hover,
.relationships-container::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
}

/* 响应式 */
@media (max-width: 768px) {
    .header-content {
        padding: 0 16px;
    }

    .main-container {
        padding: 20px 16px;
    }

    .feature-tags {
        gap: 12px;
    }

    .feature-tag {
        font-size: 11px;
        padding: 4px 8px;
    }

    .er-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .er-toolbar {
        justify-content: center;
    }

    .graph-container {
        height: 800px;
    }

    .table-list-container {
        max-height: 300px;
    }
}
