/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Navigation */
.navbar {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e5e7eb;
    padding: 0;
}

.nav-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
}

.logo-section {
    display: flex;
    align-items: center;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    color: #4f46e5;
    margin-right: 0.75rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937; /* 调整为更深的灰色 */
}

.nav-buttons {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-button {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-weight: 700;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.nav-button.active {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.nav-button:not(.active) {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.nav-button:not(.active):hover {
    background: #f1f5f9;
    color: #475569;
}

.nav-button-icon {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 100%;
    margin: 0 auto;
    min-height: calc(100vh - 8rem); /* 确保内容区域有足够高度 */
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    height: calc(100vh - 12rem); /* 设置固定高度，减少底部紫色间隙 */
    max-height: calc(100vh - 12rem);
}

.content-wrapper.submission-mode {
    display: block;
    height: auto;
}

/* Leaderboard Panel */
.leaderboard-panel {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%; /* 占满可用高度 */
}

.panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    flex-shrink: 0; /* 防止压缩 */
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.panel-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937; /* 调整为更深的灰色 */
    margin-bottom: 0;
    line-height: 1.4;
}

.panel-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.4;
}

.submit-button-header {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #10b981, #8b5cf6);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 1rem;
    white-space: nowrap;
}

.submit-button-header:hover {
    background: linear-gradient(135deg, #059669, #7c3aed);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Search and Filter */
.search-filter-section {
    padding: 1rem 1.5rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0; /* 防止压缩 */
}

.search-filter-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input-container {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: #6b7280;
}

.search-input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: white;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-select {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
    min-width: 200px;
}

.filter-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.sort-button {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: white;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.sort-button:hover {
    background: #f3f4f6;
}

.sort-icon {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
}

/* Table */
.table-container {
    flex: 1;
    overflow: auto;
    background: white;
    border-radius: 0 0 1rem 1rem;
    min-height: 0; /* 允许 flex 收缩 */
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-header {
    background: #f8fafc;
    border-bottom: 2px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-header th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #4b5563; /* 调整表头文字颜色 */
    border-bottom: 1px solid #e5e7eb;
}

.table-header th.center {
    text-align: center;
}

.table-row {
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s ease;
}

.table-row:hover {
    background: #f8fafc;
}

.table-cell {
    padding: 1rem;
    vertical-align: middle;
}

.table-cell.center {
    text-align: center;
}

.rank-cell {
    font-weight: 600;
    color: #4f46e5;
}

.model-name {
    font-weight: 600;
    color: #1f2937; /* 调整模型名称颜色 */
}

.team-name {
    color: #6b7280;
}

.score-cell {
    font-weight: 600;
    color: #1f2937; /* 改为深灰色 */
}

.score-cell.score-na {
    color: #9ca3af; /* 调整N/A的颜色 */
    font-weight: 400;
}

.type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.type-badge.type-open-source {
    background: #dcfce7;
    color: #166534;
}

.type-badge.type-proprietary {
    background: #fef3c7;
    color: #d97706;
}

/* Papers Panel */
.papers-panel {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%; /* 占满可用高度 */
}

.papers-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    flex-shrink: 0; /* 防止压缩 */
}

.papers-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937; /* 调整为更深的灰色 */
    margin-bottom: 0.25rem;
}

.papers-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 600;
}

.papers-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 0; /* 允许 flex 收缩 */
}

.paper-item {
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.paper-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.paper-item:last-child {
    margin-bottom: 0;
}

.paper-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937; /* 调整论文标题颜色 */
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.paper-authors {
    color: #6b7280;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.paper-journal {
    color: #4f46e5;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.paper-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.paper-link {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    background: #3b82f6;
    color: white;
    text-decoration: none;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.paper-link:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.paper-link.github {
    background: #374151;
}

.paper-link.github:hover {
    background: #111827;
}

.link-icon {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
}

/* Submission Panel */
.submission-container {
    max-width: 800px;
    margin: 0 auto;
    height: calc(100vh - 12rem); /* 设置固定高度 */
    overflow-y: auto; /* 添加垂直滚动 */
}

.submission-panel {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 100%; /* 确保内容占满容器 */
}

.submission-header {
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 1px solid #e5e7eb;
    text-align: center;
}

.submission-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937; /* 调整提交标题颜色 */
    margin-bottom: 0.5rem;
}

.submission-subtitle {
    color: #6b7280;
    font-size: 1rem;
    line-height: 1.5;
}

.submission-content {
    padding: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
    margin-bottom: 1.5rem;
}

.form-label {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.label-icon {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
}

.form-input,
.form-textarea {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: white;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.submission-guidelines {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.submission-guidelines h4 {
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 0.5rem;
}

.submission-guidelines ul {
    font-size: 0.875rem;
    color: #1e40af;
    line-height: 1.5;
    list-style: none;
    padding: 0;
}

.submission-guidelines li {
    margin-bottom: 0.25rem;
}

.submit-form-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    gap: 0.5rem;
}

.submit-form-button:hover {
    background: linear-gradient(135deg, #047857, #059669);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

/* Loading button styles */
.loading-spinner {
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-top: 2px solid white;
    border-radius: 50%;
    width: 1rem;
    height: 1rem;
    animation: spin 0.6s linear infinite;
    margin-left: 0.5rem;
    display: none; /* 默认隐藏 */
}

.submit-button-loading {
    position: relative;
    pointer-events: none;
}

.submit-button-loading .submit-form-button {
    background: rgba(5, 150, 105, 0.7);
    cursor: not-allowed;
}

.submit-button-loading .loading-spinner {
    display: inline-block;
}

/* Footer */
.footer {
    background: white;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
    margin-top: auto;
    padding: 1.5rem 0;
    border-top: 1px solid #e5e7eb;
}

.footer-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
    color: #6b7280;
}

.footer-content h3 {
    font-weight: bold;
    font-size: 1.125rem;
    color: #1f2937; /* 调整footer标题颜色 */
    margin-bottom: 1rem;
}

.footer-contacts {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.contact-item p {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.contact-item a {
    color: #6b7280;
    text-decoration: none;
}

.contact-item a:hover {
    color: #374151;
}

.contact-divider {
    border-left: 1px solid #d1d5db;
    height: 2rem;
}

.footer-copyright {
    font-size: 0.75rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        height: auto; /* 在小屏幕上自适应高度 */
    }
    
    .papers-panel,
    .leaderboard-panel {
        max-height: 400px;
    }
    
    .submission-container {
        height: calc(100vh - 10rem); /* 在平板上调整高度 */
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .nav-content {
        padding: 0 1rem;
    }
    
    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .search-filter-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input-container {
        min-width: auto;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-contacts {
        flex-direction: column;
        gap: 1rem;
    }
    
    .contact-divider {
        display: none;
    }
    
    .submission-container {
        height: calc(100vh - 8rem); /* 在移动设备上调整高度 */
    }
}

@media (max-width: 480px) {
    .nav-content {
        flex-direction: column;
        height: auto;
        padding: 1rem;
        gap: 1rem;
    }
    
    .nav-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .panel-title {
        font-size: 1.25rem;
    }
    
    .submission-title {
        font-size: 1.5rem;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .leaderboard-table {
        min-width: 800px;
    }
    
    .submission-container {
        height: calc(100vh - 6rem); /* 在最小屏幕上调整高度 */
    }
}
