/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --accent-magnetic: #ef4444;
    --accent-thermoelectric: #f59e0b;
    --accent-superconductor: #8b5cf6;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==================== 导航栏 ==================== */
.navbar {
    background-color: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-gray);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

.login-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.login-btn:hover {
    background-color: var(--primary-dark);
}

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
    width: 100%;
}

/* ==================== Hero 区域 ==================== */
.hero-section {
    text-align: center;
    margin-bottom: 4rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-gray);
    margin-bottom: 1.5rem;
}

.hero-description {
    max-width: 800px;
    margin: 0 auto;
    color: var(--text-gray);
    font-size: 1.125rem;
    line-height: 1.8;
}

/* ==================== 数据库卡片 ==================== */
.database-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.database-card {
    background-color: var(--bg-white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
}

.database-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.database-card.magnetic {
    border-top: 4px solid var(--accent-magnetic);
}

.database-card.thermoelectric {
    border-top: 4px solid var(--accent-thermoelectric);
}

.database-card.superconductor {
    border-top: 4px solid var(--accent-superconductor);
}

.card-header h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.card-header p {
    color: var(--text-gray);
    font-size: 0.875rem;
}

.card-body {
    margin: 1.5rem 0;
}

.count-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.count-label {
    color: var(--text-gray);
    font-size: 0.875rem;
}

.count-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.explore-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.arrow-icon {
    width: 20px;
    height: 20px;
}

.random-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-dark);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.random-btn:hover {
    background-color: var(--border-color);
}

/* ==================== 模态弹窗 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-white);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    color: var(--text-dark);
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-gray);
    padding: 0.25rem;
}

.close-btn svg {
    width: 24px;
    height: 24px;
}

.close-btn:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-property {
    display: flex;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-property:last-child {
    border-bottom: none;
}

.modal-property strong {
    min-width: 150px;
    color: var(--text-gray);
    font-weight: 500;
}

.modal-property span {
    color: var(--text-dark);
}

/* ==================== 页脚 ==================== */
.footer {
    background-color: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-gray);
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.25rem;
    }

    .database-section {
        grid-template-columns: 1fr;
    }
}
