/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.5;
    min-height: 100vh;
}

/* ===== 头部 ===== */
.header {
    position: relative;
    height: 150px;
    overflow: hidden;
}
.header-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a5fb4 0%, #3584e4 50%, #62a0ea 100%);
}
.header-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.header-content {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 20px;
    max-width: 800px;
    margin: 0 auto;
}
.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}
.logo-icon {
    width: 50px;
    height: 50px;
    background: #fff;
    backdrop-filter: blur(10px);
    border-radius: 12px;
    object-fit: contain;
    border: 1px solid rgba(255,255,255,0.3);
}
.logo-text h1 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
}
.logo-text p {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    margin-top: 2px;
    letter-spacing: 1px;
}

/* ===== 搜索区 ===== */
.search-section {
    position: relative;
    margin-top: -24px;
    padding: 0 16px;
    z-index: 2;
}
.search-box {
    background: #fff;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-width: 800px;
    margin: 0 auto;
}
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    color: #999;
    pointer-events: none;
}
#searchInput {
    width: 100%;
    height: 46px;
    padding: 0 44px;
    border: 2px solid #e8ecf1;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    background: #f8f9fb;
}
#searchInput:focus {
    border-color: #3584e4;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(53,132,228,0.1);
}
#searchInput::placeholder { color: #aab; }

/* 搜索标签 */
.search-tabs {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.tab {
    padding: 5px 12px;
    border: 1px solid #e0e4e8;
    background: #f8f9fb;
    border-radius: 16px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.tab.active {
    background: #1a5fb4;
    color: #fff;
    border-color: #1a5fb4;
}

/* 按部门查询按钮 */
.dept-selector-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 42px;
    margin-top: 10px;
    border: 1px dashed #3584e4;
    background: #f0f7ff;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #1a5fb4;
    cursor: pointer;
    transition: all 0.2s;
}
.dept-selector-btn svg {
    width: 18px;
    height: 18px;
}
.dept-selector-btn:active {
    background: #e0efff;
}

.clear-btn {
    position: absolute;
    right: 14px;
    width: 22px;
    height: 22px;
    border: none;
    background: #ddd;
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== 校区筛选 ===== */
.campus-filter {
    padding: 12px 16px 0;
    max-width: 800px;
    margin: 0 auto;
}
.filter-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.filter-scroll::-webkit-scrollbar { display: none; }
.chip {
    padding: 7px 16px;
    border: 1px solid #e0e4e8;
    background: #fff;
    border-radius: 20px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.chip.active {
    background: #1a5fb4;
    color: #fff;
    border-color: #1a5fb4;
}

/* ===== 统计栏 ===== */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 14px;
    max-width: 800px;
    margin: 0 auto;
}
.stat-item {
    text-align: center;
}
.stat-num {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #1a5fb4;
    line-height: 1;
}
.stat-label {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

/* ===== 结果列表 ===== */
.result-list {
    padding: 0 16px 80px;
    max-width: 800px;
    margin: 0 auto;
}

/* 分类标题 */
.category-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 18px 4px 10px;
    font-size: 15px;
    font-weight: 700;
    color: #1a5fb4;
}
.category-title:first-child {
    padding-top: 8px;
}
.category-dot {
    width: 6px;
    height: 6px;
    background: #3584e4;
    border-radius: 50%;
}
.category-campus {
    font-size: 11px;
    color: #888;
    font-weight: 400;
    margin-left: 6px;
    padding: 2px 8px;
    background: #e8f0fe;
    border-radius: 10px;
}

/* 部门块 */
.dept-block {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    overflow: hidden;
}
.dept-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: rgba(0,0,0,0.05);
}
.dept-header:active {
    background: #f5f7fa;
}
.dept-info {
    flex: 1;
    min-width: 0;
}
.dept-name {
    font-size: 15px;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dept-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.dept-campus {
    font-size: 11px;
    color: #1a5fb4;
    background: #e8f0fe;
    padding: 1px 6px;
    border-radius: 4px;
}
.dept-count {
    font-size: 11px;
    color: #999;
}
.dept-arrow {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    transition: transform 0.25s;
    flex-shrink: 0;
}
.dept-arrow svg {
    width: 18px;
    height: 18px;
}
.dept-arrow.expanded {
    transform: rotate(180deg);
}

/* 部门内电话列表 */
.dept-phones {
    border-top: 1px solid #f0f0f0;
    padding: 4px 0;
}
.phone-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: rgba(0,0,0,0.05);
}
.phone-row:active {
    background: #f5f7fa;
}
.phone-row:not(:last-child) {
    border-bottom: 1px solid #f8f8f8;
}
.phone-row-name {
    font-size: 14px;
    color: #444;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 12px;
}
.phone-row-num {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 600;
    color: #2e7d32;
    text-decoration: none;
    flex-shrink: 0;
    padding: 5px 10px;
    background: #e8f5e9;
    border-radius: 16px;
}
.phone-row-num svg {
    width: 13px;
    height: 13px;
}

/* 高亮 */
.highlight {
    background: #fff3cd;
    color: #856404;
    padding: 0 2px;
    border-radius: 2px;
}

/* ===== 加载 ===== */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e8ecf1;
    border-top-color: #3584e4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #aaa;
}
.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}
.empty-state p {
    font-size: 16px;
    color: #666;
    margin-bottom: 4px;
}
.empty-state span {
    font-size: 13px;
}

/* ===== 回到顶部 ===== */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    z-index: 100;
}
.back-to-top svg { width: 20px; height: 20px; }

/* ===== 弹窗 ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}
.modal-content {
    position: relative;
    background: #fff;
    width: 100%;
    max-width: 480px;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header h3 {
    font-size: 18px;
    color: #222;
}
.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 20px;
    color: #666;
    cursor: pointer;
}
.modal-body {
    text-align: center;
    padding: 10px 0 20px;
}
.modal-name {
    font-size: 18px;
    font-weight: 600;
    color: #222;
}
.modal-dept {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}
.phone-number {
    display: inline-block;
    margin-top: 16px;
    font-size: 28px;
    font-weight: 700;
    color: #1a5fb4;
    letter-spacing: 2px;
    text-decoration: none;
}
.modal-footer {
    display: flex;
    gap: 12px;
}
.btn-copy, .btn-call {
    flex: 1;
    height: 48px;
    border-radius: 12px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.btn-copy {
    background: #f0f0f0;
    color: #555;
}
.btn-call {
    background: #3584e4;
    color: #fff;
}

/* 多号码列表 */
.phone-multi-list {
    margin-top: 12px;
}
.phone-multi-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.phone-multi-item:last-child {
    border-bottom: none;
}
.phone-multi-num {
    font-size: 20px;
    font-weight: 700;
    color: #1a5fb4;
    letter-spacing: 1px;
}
.phone-multi-actions {
    display: flex;
    gap: 8px;
}
.btn-copy-sm, .btn-call-sm {
    padding: 6px 14px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.btn-copy-sm {
    background: #f0f0f0;
    color: #555;
}
.btn-call-sm {
    background: #3584e4;
    color: #fff;
}

/* ===== 部门选择弹窗 ===== */
.dept-modal-content {
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}
.dept-modal-content .modal-header {
    padding: 16px 20px;
    margin-bottom: 0;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.dept-modal-content .modal-header h3 {
    font-size: 17px;
}
.dept-modal-body {
    overflow-y: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}
.dept-modal-campus {
    margin-bottom: 4px;
}
.dept-modal-campus-title {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px 6px;
    font-size: 13px;
    font-weight: 700;
    color: #1a5fb4;
}
.dept-modal-campus-title::before {
    content: '';
    width: 4px;
    height: 14px;
    background: #3584e4;
    border-radius: 2px;
}
.dept-modal-category {
    padding: 4px 0;
}
.dept-modal-category-title {
    padding: 8px 20px 4px 28px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
}
.dept-modal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px 10px 32px;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: rgba(0,0,0,0.05);
}
.dept-modal-item:active {
    background: #f5f7fa;
}
.dept-modal-item-name {
    font-size: 14px;
    color: #333;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dept-modal-item-count {
    font-size: 12px;
    color: #999;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    flex-shrink: 0;
}
.dept-modal-item-arrow {
    width: 16px;
    height: 16px;
    color: #bbb;
    margin-left: 6px;
    flex-shrink: 0;
}

/* ===== 响应式 ===== */
@media (min-width: 768px) {
    .modal { align-items: center; }
    .modal-content { border-radius: 20px; }
    .dept-modal-content { border-radius: 16px; max-height: 70vh; }
}
