/* 百家姓网站主样式文件 */

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

:root {
    --primary-color: #c93838;
    --secondary-color: #d46565;
    --text-color: #333;
    --text-light: #666;
    --bg-light: #f8f8f8;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "SimSun", sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #fff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: bold;
}

.logo .subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

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

.main-nav a {
    color: white;
    text-decoration: none;
    font-size: 1rem;
    transition: opacity 0.3s;
}

.main-nav a:hover,
.main-nav a.active {
    opacity: 0.8;
    border-bottom: 2px solid white;
}

/* Search Section */
.search-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 0;
    text-align: center;
}

.search-section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.search-box {
    display: flex;
    max-width: 500px;
    margin: 0 auto 1rem;
    gap: 10px;
}

.search-box input {
    flex: 1;
    padding: 15px 20px;
    font-size: 1.1rem;
    border: none;
    border-radius: 8px 0 0 8px;
    outline: none;
}

.search-box button {
    padding: 15px 30px;
    font-size: 1.1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: background 0.3s;
}

.search-box button:hover {
    background: var(--secondary-color);
}

.search-hint {
    font-size: 0.95rem;
    opacity: 0.9;
}

.search-hint a {
    color: white;
    text-decoration: none;
    margin: 0 8px;
    border-bottom: 1px dashed white;
}

/* Section Styles */
section {
    padding: 3rem 0;
}

section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

/* Top Surnames */
.top-surnames {
    background: var(--bg-light);
}

.surnames-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.surname-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: var(--shadow);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.surname-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.surname-char {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.surname-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.surname-info .rank {
    font-size: 0.9rem;
    color: var(--text-light);
}

.surname-info .population {
    font-size: 0.85rem;
    color: var(--secondary-color);
}

/* Origins Section */
.origins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.origin-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border-top: 4px solid var(--primary-color);
}

.origin-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.origin-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.origin-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    color: var(--text-color);
}

.origin-card p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.origin-card ul {
    list-style: none;
    margin-bottom: 1rem;
}

.origin-card ul li {
    padding: 0.3rem 0;
    color: var(--text-light);
    font-size: 0.95rem;
}

.origin-card a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

/* Timeline */
.migration-section {
    background: var(--bg-light);
}

.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
    transform: translateX(-50%);
}

.timeline-item {
    display: flex;
    margin-bottom: 3rem;
    position: relative;
}

.timeline-item:nth-child(odd) {
    flex-direction: row;
}

.timeline-item:nth-child(even) {
    flex-direction: row-reverse;
}

.timeline-year {
    flex: 0 0 100px;
    text-align: center;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.1rem;
    z-index: 1;
}

.timeline-content {
    flex: 1;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin: 0 2rem;
    position: relative;
}

.timeline-item:nth-child(odd) .timeline-content {
    margin-left: 2rem;
}

.timeline-item:nth-child(even) .timeline-content {
    margin-right: 2rem;
    text-align: right;
}

.timeline-content h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.timeline-content .route {
    background: var(--bg-light);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    margin: 0.8rem 0;
    font-family: monospace;
    display: inline-block;
}

.timeline-content .dynasty {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Distribution */
.distribution-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.region-list,
.special-groups {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.region-list h3,
.special-groups h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.region-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.region-item:last-child {
    border-bottom: none;
}

.region-name {
    font-weight: 500;
    color: var(--text-color);
}

.region-surnames {
    color: var(--secondary-color);
}

.group-card {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.group-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.group-card p {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Updates */
.updates-section {
    background: var(--bg-light);
}

.updates-list {
    max-width: 600px;
    margin: 0 auto;
}

.update-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.update-date {
    flex: 0 0 120px;
    color: var(--secondary-color);
    font-weight: 500;
}

.update-text {
    flex: 1;
    color: var(--text-color);
}

/* Footer */
.site-footer {
    background: #2c3e50;
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.footer-section p {
    opacity: 0.8;
    line-height: 1.8;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.footer-section a:hover {
    opacity: 1;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.7;
}

/* Animation Classes */
.animate-in {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.suggestion-item:hover {
    background: var(--bg-light);
}

.suggestion-char {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: bold;
    margin-right: 15px;
}

.suggestion-info {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    z-index: 10000;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
    opacity: 0;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.back-to-top:hover {
    transform: scale(1.1);
}
