/* =====================================================
   同学相册通讯录 - 主样式表
   响应式设计，适配手机端
   ===================================================== */

:root {
    --primary: #4a6cf7;
    --primary-dark: #3555d8;
    --primary-light: #e8edff;
    --accent: #f97316;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
a { text-decoration: none; color: inherit; transition: var(--transition); }
img { max-width: 100%; height: auto; }

/* ====== 导航栏 ====== */
.navbar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(74,108,247,0.3);
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
}
.nav-brand {
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
}
.nav-brand span { opacity: .85; font-weight: 400; font-size: .9rem; margin-left: 6px; }

.nav-links { display: flex; gap: 24px; list-style: none; }
.nav-links a {
    color: rgba(255,255,255,.88);
    font-size: .95rem;
    position: relative;
    padding: 4px 0;
}
.nav-links a:hover,
.nav-links a.active { color: white; }
.nav-links a::after {
    content: ''; position: absolute;
    bottom: -2px; left: 0; width: 0; height: 2px;
    background: white; border-radius: 1px; transition: width .25s;
}
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }

.menu-toggle {
    display: none; background: none; border: none;
    color: white; font-size: 1.5rem; cursor: pointer; padding: 4px;
}

/* ====== Hero 区域 ====== */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,.1) 0%, transparent 60%);
    animation: float 15s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(5deg); }
    66% { transform: translate(-20px, 20px) rotate(-3deg); }
}
.hero h1 { font-size: 2.5rem; margin-bottom: 10px; position: relative; z-index: 1; }
.hero p { font-size: 1.15rem; opacity: .9; max-width: 500px; margin: 0 auto; position: relative; z-index: 1; }

.search-box {
    max-width: 480px; margin: 28px auto 0; position: relative; z-index: 1;
}
.search-box input {
    width: 100%;
    padding: 14px 50px 14px 22px;
    border-radius: 50px;
    border: 2px solid rgba(255,255,255,.3);
    background: rgba(255,255,255,.15);
    color: white;
    font-size: 1rem;
    outline: none;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}
.search-box input::placeholder { color: rgba(255,255,255,.65); }
.search-box input:focus {
    border-color: white;
    background: rgba(255,255,255,.25);
    box-shadow: 0 0 20px rgba(255,255,255,.15);
}
.search-btn {
    position: absolute; right: 6px; top: 50%;
    transform: translateY(-50%);
    background: white; color: var(--primary);
    border: none; width: 38px; height: 38px;
    border-radius: 50%; cursor: pointer;
    font-size: 1.05rem; display: flex;
    align-items: center; justify-content: center;
    transition: var(--transition);
}
.search-btn:hover { transform: translateY(-50%) scale(1.08); box-shadow: 0 2px 10px rgba(0,0,0,.15); }

/* ====== 内容区通用 ====== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.section { padding: 48px 0; }
.section-title {
    font-size: 1.6rem;
    text-align: center;
    margin-bottom: 32px;
    color: var(--text);
    position: relative;
}
.section-title::after {
    content: '';
    display: block;
    width: 50px; height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    margin: 10px auto 0;
    border-radius: 2px;
}

/* ====== 班级标签栏 ====== */
.class-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 28px;
}
.class-tab {
    padding: 8px 22px;
    border-radius: 50px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    color: var(--text-light);
    cursor: pointer;
    font-size: .92rem;
    transition: var(--transition);
    user-select: none;
}
.class-tab:hover,
.class-tab.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
.class-tab .count {
    font-size: .78rem;
    opacity: .7;
    margin-left: 4px;
}

/* ====== 同学卡片网格 ====== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.classmate-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}
.classmate-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.card-avatar-area {
    height: 140px;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.card-avatar-area img {
    width: 90px; height: 90px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,.85);
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    background: white;
}
.card-avatar-area .avatar-placeholder {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    border: 3px solid rgba(255,255,255,.5);
}
.card-gender-tag {
    position: absolute;
    top: 10px; right: 10px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    color: white;
    background: rgba(0,0,0,.25);
    backdrop-filter: blur(4px);
}
.card-body { padding: 16px 18px 18px; }
.card-name {
    font-size: 1.15rem; font-weight: 700;
    margin-bottom: 4px; color: var(--text);
}
.card-nickname {
    font-size: .82rem; color: var(--accent); margin-bottom: 8px;
}
.card-info-row {
    display: flex; align-items: center; gap: 6px;
    font-size: .85rem; color: var(--text-light); margin-bottom: 5px;
}
.card-info-row .icon { font-size: .9rem; width: 16px; text-align: center; flex-shrink: 0; }
.card-tags {
    display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px;
}
.tag {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    background: var(--primary-light);
    color: var(--primary);
}

/* ====== 照片墙 - 跑马灯效果 ====== */
.photo-wall {
    overflow: hidden;
    position: relative;
    padding: 20px 0;
    --marquee-duration: 25s;
}
/* 跑马灯轨道 */
.photo-marquee-track {
    display: flex;
    gap: 16px;
    width: max-content;
    animation: marqueeScroll var(--marquee-duration) linear infinite;
}
.photo-marquee-track:hover {
    animation-play-state: paused;
}
/* 双轨无缝循环：反向滚动 */
.photo-marquee-track.reverse {
    animation-name: marqueeScrollReverse;
    animation-delay: calc(var(--marquee-duration) / -4);
}
@keyframes marqueeScroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}
@keyframes marqueeScrollReverse {
    from { transform: translateX(-50%); }
    to   { transform: translateX(0); }
}
.photo-item {
    flex-shrink: 0;
    width: 220px;
    aspect-ratio: 4/3;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 12px rgba(0,0,0,.1);
    transition: transform .3s ease, box-shadow .3s ease;
}
.photo-item:hover {
    transform: scale(1.05) translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,.18);
    z-index: 2;
    position: relative;
}
.photo-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.photo-item .photo-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent, rgba(0,0,0,.6));
    display: flex;
    align-items: flex-end;
    padding: 10px 12px;
    opacity: 0;
    transition: opacity .3s ease;
}
.photo-item:hover .photo-overlay { opacity: 1; }
.photo-overlay p { color: white; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 跑马灯控制提示 */
.marquee-hint {
    text-align: center;
    margin-top: 10px;
    font-size: .78rem;
    color: var(--text-muted);
    opacity: .7;
}

/* ====== 留言板 ====== */
.message-list { max-width: 700px; margin: 0 auto; }
.msg-item {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.msg-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.msg-author { font-weight: 600; font-size: .95rem; color: var(--primary); }
.msg-time { font-size: .78rem; color: var(--text-muted); }
.msg-body { font-size: .92rem; color: var(--text-light); line-height: 1.7; }

.msg-form {
    max-width: 700px;
    margin: 24px auto 0;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: 11px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .95rem;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
textarea.form-control { resize: vertical; min-height: 90px; }
.btn {
    display: inline-block;
    padding: 11px 28px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-size: .95rem;
    font-weight: 600;
    transition: var(--transition);
    font-family: inherit;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(74,108,247,.4); }
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

/* ====== 友情链接 ====== */
.links-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
}
.link-card {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 22px;
    background: var(--card-bg);
    border-radius: 50px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border);
}
.link-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}
.link-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary); font-size: 1.1rem; flex-shrink: 0;
}
.link-text { font-size: .92rem; font-weight: 500; }

/* ====== 页脚 ====== */
.footer {
    background: var(--text);
    color: rgba(255,255,255,.7);
    text-align: center;
    padding: 32px 20px;
    margin-top: 48px;
}
.footer a { color: rgba(255,255,255,.9); }
.footer a:hover { color: white; }
.footer-links { display: flex; gap: 20px; justify-content: center; margin-bottom: 12px; }

/* ====== 同学详情弹窗 ====== */
.modal-overlay {
    display: none; position: fixed;
    inset: 0; z-index: 999;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px);
    animation: fadeIn .25s ease;
    overflow-y: auto;
    padding: 20px;
}
.modal-overlay.show { display: block; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal {
    max-width: 520px;
    margin: 40px auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    animation: slideUp .3s ease;
}
@keyframes slideUp { from{transform:translateY(30px);opacity:.5} to{transform:none;opacity:1} }
.modal-close {
    float: right; background: none; border: none;
    font-size: 1.4rem; cursor: pointer;
    color: var(--text-muted); padding: 8px 12px;
    line-height: 1;
    transition: var(--transition);
}
.modal-close:hover { color: var(--text); }
.modal-header {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}
.modal-avatar {
    width: 86px; height: 86px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,.7);
    object-fit: cover;
    background: rgba(255,255,255,.2);
    margin-bottom: 12px;
}
.modal-name { font-size: 1.4rem; font-weight: 700; }
.modal-nickname { font-size: .9rem; opacity: .85; }
.modal-body { padding: 24px; }
.info-block { margin-bottom: 16px; }
.info-label {
    font-size: .8rem; color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
    font-weight: 600;
}
.info-value { font-size: .98rem; color: var(--text); word-break: break-all; }
.bio-section {
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    padding: 16px; margin-top: 16px;
}
.bio-section p { font-size: .92rem; color: var(--primary-dark); line-height: 1.8; font-style: italic; }

/* ====== 空状态 / 加载状态 ====== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; opacity: .5; }
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to{transform:rotate(360deg)} }

/* ====== Toast 提示 ====== */
.toast {
    position: fixed;
    top: 20px; right: 20px;
    background: var(--text);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    z-index: 9999;
    animation: slideInRight .3s ease;
    box-shadow: var(--shadow-lg);
}
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
@keyframes slideInRight { from{transform:translateX(100%)} to{transform:none} }

/* ====== 响应式 ====== */
@media (max-width: 768px) {
    .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0;
        background: var(--primary-dark); flex-direction: column; padding: 16px 0; gap: 0; }
    .nav-links.open { display: flex; }
    .nav-links a { padding: 12px 24px; border-top: 1px solid rgba(255,255,255,.1); }
    .nav-links a::after { display: none; }
    .menu-toggle { display: block; }

    .hero { padding: 40px 16px; }
    .hero h1 { font-size: 1.8rem; }
    .hero p { font-size: .95rem; }

    .section { padding: 32px 0; }
    .section-title { font-size: 1.3rem; margin-bottom: 20px; }

    .card-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
    .card-avatar-area { height: 120px; }
    .card-body { padding: 12px 14px 14px; }

    .modal { margin: 10px auto; max-width: 100%; }
    .photo-item { width: 160px; }

    .class-tabs { gap: 8px; }
    .class-tab { padding: 6px 16px; font-size: .84rem; }
}

@media (max-width: 420px) {
    .nav-inner { padding: 12px 14px; }
    .nav-brand { font-size: 1.1rem; }
    .hero h1 { font-size: 1.5rem; }
    .search-box input { padding: 12px 44px 12px 16px; font-size: .9rem; }
    .card-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .card-avatar-area { height: 110px; }
    .card-avatar-area img { width: 64px; height: 64px; }
    .card-avatar-area .avatar-placeholder { width: 56px; height: 56px; font-size: 1.4rem; }
    .card-body { padding: 10px 12px 12px; }
    .card-name { font-size: 1rem; }
    .card-info-row { font-size: .8rem; }
    .msg-form { padding: 16px; }
    .links-grid { flex-direction: column; align-items: center; }
    .photo-item { width: 130px; }
}
