/* ==========================================
   员工通讯录 - 主样式表
   ========================================== */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #4A90D9;
    --primary-dark: #2B6CB0;
    --primary-light: #EBF4FF;
    --accent: #E53E3E;
    --success: #38A169;
    --bg: #F7F9FC;
    --card-bg: #FFFFFF;
    --text: #1A202C;
    --text-secondary: #4A5568;
    --text-muted: #A0AEC0;
    --border: #E2E8F0;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { text-decoration: none; color: var(--primary); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }

/* ---- Header ---- */
.header {
    background: linear-gradient(135deg, #2B6CB0 0%, #4A90D9 50%, #63B3ED 100%);
    color: #fff;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(74, 144, 217, 0.25);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.logo h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

.logo .subtitle {
    font-size: 11px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: block;
}

.header-stats {
    display: flex;
    gap: 28px;
}

.stat-item {
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    opacity: 0.8;
}

.header-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    transition: var(--transition);
    flex-shrink: 0;
}
.header-logout:hover {
    background: rgba(255,255,255,0.3);
    color: #fff;
}

/* ---- Container ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ---- Filter Bar ---- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.search-box {
    flex: 1;
    min-width: 240px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    height: 46px;
    padding: 0 16px 0 44px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    background: var(--card-bg);
    transition: var(--transition);
    outline: none;
    color: var(--text);
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-select {
    height: 46px;
    padding: 0 36px 0 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A0AEC0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: var(--transition);
}

.filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.btn-clear {
    display: inline-flex;
    align-items: center;
    height: 46px;
    padding: 0 16px;
    background: #EDF2F7;
    color: var(--text-secondary);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-clear:hover { background: #E2E8F0; color: var(--text); }

/* ---- Results Info ---- */
.results-info {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 16px;
}
.results-info strong {
    color: var(--primary);
    font-weight: 600;
}

/* ==========================================
   通讯录卡片网格
   ========================================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

/* ---- Contact Card ---- */
.contact-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border: 1px solid transparent;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    user-select: none;
}

.contact-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.contact-card:active {
    transform: scale(0.985);
}

/* ---- Card Avatar ---- */
.card-avatar {
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(74, 144, 217, 0.3);
    position: relative;
    overflow: hidden;
}

.card-avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---- Card Body ---- */
.card-body {
    flex: 1;
    min-width: 0;
}

/* 姓名行：大字号 + 醒目颜色 */
.card-header-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.card-name {
    font-size: 21px;
    font-weight: 700;
    color: #1A202C;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 部门 */
.card-dept {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* 手机号：大字号 + 醒目颜色 */
.card-phone {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.card-phone svg {
    color: var(--primary);
    flex-shrink: 0;
}

.card-phone a {
    font-size: 17px;
    font-weight: 700;
    color: #1E40AF;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.card-phone a:hover {
    color: var(--primary-dark);
}

/* ---- Card Arrow ---- */
.card-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
    transition: var(--transition);
}

.contact-card:hover .card-arrow {
    opacity: 1;
    transform: translateY(-50%) translateX(3px);
}

/* ---- Gender Badge ---- */
.gender-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.gender-badge.male {
    background: #EBF4FF;
    color: #2B6CB0;
}

.gender-badge.female {
    background: #FED7E2;
    color: #B83280;
}

/* ==========================================
   详情弹窗
   ========================================== */
.detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.detail-overlay.active {
    opacity: 1;
    visibility: visible;
}

.detail-modal {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 36px 32px 28px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-overlay.active .detail-modal {
    transform: translateY(0);
}

.detail-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #F7F9FC;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.detail-close:hover {
    background: #E2E8F0;
    color: var(--text);
}

/* Detail Modal scrollbar */
.detail-modal::-webkit-scrollbar { width: 6px; }
.detail-modal::-webkit-scrollbar-track { background: transparent; }
.detail-modal::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #CBD5E0, #A0AEC0);
    border-radius: 10px;
}

/* Avatar in Detail */
.detail-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
    margin: 0 auto 16px;
    box-shadow: 0 6px 20px rgba(74, 144, 217, 0.35);
    position: relative;
    overflow: hidden;
}

/* Name in Detail */
.detail-name {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    color: #1A202C;
    margin-bottom: 24px;
    letter-spacing: 1px;
}

/* Info Grid */
.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
    margin-bottom: 24px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.detail-item.detail-full {
    grid-column: 1 / -1;
}

.detail-item.highlight {
    background: #EBF8FF;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #BEE3F8;
}

.detail-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.detail-value {
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
    word-break: break-all;
}

.highlight .detail-value {
    font-size: 18px;
    font-weight: 700;
    color: #1E40AF;
}

.detail-email {
    color: var(--primary) !important;
}

/* Detail Actions */
.detail-actions {
    display: flex;
    gap: 12px;
}

.detail-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.call-btn {
    background: #2B6CB0;
    color: #fff;
}
.call-btn:hover {
    background: #1A4A7A;
    color: #fff;
}

.email-btn {
    background: #EDF2F7;
    color: var(--text);
}
.email-btn:hover {
    background: #E2E8F0;
    color: var(--text);
}

/* ==========================================
   空状态
   ========================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state p {
    margin-top: 16px;
    font-size: 16px;
}

/* ==========================================
   Footer
   ========================================== */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.admin-link {
    color: var(--text-muted);
    font-size: 13px;
    transition: var(--transition);
}
.admin-link:hover {
    color: var(--primary);
}

/* ==========================================
   管理后台
   ========================================== */

/* ---- Admin Login ---- */
.admin-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 50%, #4A90D9 100%);
    padding: 24px;
}

.login-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    width: 420px;
    max-width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-card h2 {
    text-align: center;
    color: #1a365d;
    font-size: 26px;
    margin-bottom: 6px;
}

.login-sub {
    text-align: center;
    color: #718096;
    font-size: 14px;
    margin-bottom: 28px;
}

.login-error {
    background: #FFF5F5;
    color: #C53030;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 14px;
    text-align: center;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .btn-primary {
    width: 100%;
    height: 46px;
    font-size: 16px;
}

/* ---- Buttons ---- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 42px;
    padding: 0 22px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

/* ---- Form Group ---- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #2D3748;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    outline: none;
    background: #fff;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.form-group input[type="file"] {
    height: auto;
    padding: 10px 0;
    border: none;
    border-radius: 0;
}

/* ---- Admin Layout ---- */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 240px;
    background: #1a365d;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo h3 {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-logo small {
    display: block;
    font-size: 12px;
    opacity: 0.7;
    margin-top: 4px;
}

.sidebar-menu {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar-menu a.active {
    background: var(--primary);
    color: #fff;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer a {
    display: block;
    text-align: center;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    padding: 8px;
    transition: var(--transition);
}

.sidebar-footer a:hover {
    color: #fff;
}

.admin-main {
    flex: 1;
    margin-left: 240px;
    background: var(--bg);
    min-height: 100vh;
}

.admin-topbar {
    background: #fff;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-topbar h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1a365d;
}

.admin-content {
    padding: 28px;
}

/* ---- Alerts ---- */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.alert-success {
    background: #C6F6D5;
    color: #22543D;
    border: 1px solid #9AE6B4;
}

.alert-error {
    background: #FED7D7;
    color: #742A2A;
    border: 1px solid #FC8181;
}

/* ---- Stats Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-card-icon.blue { background: #EBF4FF; color: #2B6CB0; }
.stat-card-icon.green { background: #E6FFFA; color: #319795; }
.stat-card-icon.purple { background: #FAF5FF; color: #805AD5; }
.stat-card-icon.orange { background: #FFFAF0; color: #DD6B20; }

.stat-card-num {
    font-size: 26px;
    font-weight: 700;
    color: #1a365d;
    line-height: 1;
}

.stat-card-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ---- Upload Section ---- */
.upload-section {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.upload-section h3 {
    font-size: 17px;
    font-weight: 700;
    color: #1a365d;
    margin-bottom: 16px;
}

.upload-area {
    display: block;
    width: 100%;
    border: 2px dashed #CBD5E0;
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    background: #F7FAFC;
    cursor: pointer;
    transition: var(--transition);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.upload-area p {
    color: var(--text);
    font-size: 15px;
    margin-bottom: 6px;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
}

.upload-area input[type="file"] {
    display: none;
}

/* ---- Action Bar ---- */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.action-bar .btn-primary {
    height: 38px;
    padding: 0 16px;
}

/* ---- Admin Contact List ---- */
.admin-list-wrap {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.admin-list {
    display: flex;
    flex-direction: column;
}

.admin-list-header {
    display: grid;
    grid-template-columns: 56px minmax(180px, 2fr) minmax(180px, 1.5fr) auto;
    gap: 16px;
    align-items: center;
    padding: 12px 20px;
    background: #F7FAFC;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: #4A5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-list-header .contact,
.admin-list-header .actions {
    text-align: right;
}

.admin-list-item {
    display: grid;
    grid-template-columns: 56px minmax(180px, 2fr) minmax(180px, 1.5fr) auto;
    gap: 16px;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.admin-list-item:last-child {
    border-bottom: none;
}

.admin-list-item:hover {
    background: #F7FAFC;
}

.admin-list-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.admin-list-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-list-main {
    min-width: 0;
}

.admin-list-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.admin-list-name {
    font-size: 16px;
    font-weight: 700;
    color: #1A202C;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-list-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #718096;
}

.admin-list-position {
    color: #4A5568;
    font-weight: 500;
}

.admin-list-dept {
    display: inline-flex;
    align-items: center;
    background: #EDF2F7;
    color: #4A5568;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.admin-list-contact {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    min-width: 0;
}

.admin-list-contact-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #4A5568;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    transition: var(--transition);
}

.admin-list-contact-item:hover {
    color: var(--primary);
}

.admin-list-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-list-empty {
    text-align: center;
    padding: 48px 20px;
    color: #A0AEC0;
}

@media (max-width: 768px) {
    .admin-list-header {
        display: none;
    }

    .admin-list-item {
        grid-template-columns: 52px 1fr auto;
        grid-template-rows: auto auto;
        gap: 12px;
        padding: 14px 16px;
    }

    .admin-list-avatar {
        grid-row: 1 / 3;
    }

    .admin-list-main {
        grid-column: 2 / 3;
        grid-row: 1;
    }

    .admin-list-actions {
        grid-column: 3 / 4;
        grid-row: 1;
        align-self: start;
    }

    .admin-list-contact {
        grid-column: 2 / 4;
        grid-row: 2;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 10px;
    }
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-edit {
    background: #EBF4FF;
    color: #2B6CB0;
}

.btn-edit:hover {
    background: #BEE3F8;
}

.btn-del {
    background: #FFF5F5;
    color: #C53030;
}

.btn-del:hover {
    background: #FED7D7;
}

/* ---- Modal (Admin) ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ---- Admin Modal ---- */
.modal-admin {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 82vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show .modal-admin {
    transform: translateY(0);
}

/* Modal header */
.modal-admin-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #F7FAFC, #EDF2F7);
    border-radius: 16px 16px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-admin-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #EBF4FF, #BEE3F8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.modal-admin-header h3 {
    font-size: 19px;
    font-weight: 700;
    color: #1a365d;
    margin: 0;
}

.modal-admin-sub {
    font-size: 13px;
    color: #718096;
    margin: 2px 0 0;
}

.modal-admin-close {
    margin-left: auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #A0AEC0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.modal-admin-close:hover {
    background: #E2E8F0;
    color: #1A202C;
}

/* Avatar upload section */
.avatar-upload-section {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--border);
}

.avatar-upload-preview {
    width: 76px;
    height: 76px;
    min-width: 76px;
    border-radius: 50%;
    background: #4A90D9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(74, 144, 217, 0.3);
    transition: var(--transition);
}

.avatar-upload-preview:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 28px rgba(74, 144, 217, 0.4);
}

.avatar-upload-preview span {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
    z-index: 1;
    pointer-events: none;
}

.avatar-upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}

.avatar-upload-preview input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.avatar-upload-info p {
    font-size: 14px;
    color: #2D3748;
    margin: 0 0 4px;
}

.avatar-upload-info p:last-child {
    font-size: 12px;
    color: #A0AEC0;
    margin: 0;
}

/* Form sections inside modal */
.form-section {
    padding: 16px 24px 12px;
    border-bottom: 1px solid #F0F0F0;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #A0AEC0;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #EDF2F7;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 10px;
    flex: 1;
    min-width: 0;
}

.form-half {
    flex: 1;
}

.form-full {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #4A5568;
}

.form-group .required {
    color: #E53E3E;
}

.form-group input,
.form-group select {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    outline: none;
    background: #fff;
    transition: var(--transition);
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.12);
}

.form-group input::placeholder {
    color: #CBD5E0;
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A0AEC0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Modal footer actions */
.modal-admin-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 24px 18px;
}

.btn-cancel {
    height: 42px;
    padding: 0 24px;
    background: #EDF2F7;
    color: #4A5568;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-cancel:hover {
    background: #E2E8F0;
}

.btn-save {
    height: 42px;
    padding: 0 28px;
    background: linear-gradient(135deg, #2B6CB0, #4A90D9);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.3);
}

.btn-save:hover {
    background: linear-gradient(135deg, #1A4A7A, #2B6CB0);
    box-shadow: 0 6px 16px rgba(74, 144, 217, 0.4);
    transform: translateY(-1px);
}



/* --- Scrollbar for modal --- */
.modal-admin {
    scrollbar-width: thin;
    scrollbar-color: #CBD5E0 transparent;
}

.modal-admin::-webkit-scrollbar {
    width: 8px;
}

.modal-admin::-webkit-scrollbar-track {
    background: rgba(237, 242, 247, 0.5);
    border-radius: 8px;
    margin: 6px 0;
}

.modal-admin::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #CBD5E0, #A0AEC0);
    border-radius: 8px;
    border: 2px solid rgba(237, 242, 247, 0.5);
    background-clip: padding-box;
    transition: background 0.2s ease;
}

.modal-admin::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #A0AEC0, #718096);
    border: 2px solid rgba(237, 242, 247, 0.5);
    background-clip: padding-box;
}

/* ---- Settings Page ---- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
}

.settings-grid .upload-section {
    margin-bottom: 0;
}

.text-muted {
    color: #718096;
    font-size: 14px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.file-info {
    margin-top: 12px;
    font-size: 14px;
    color: var(--primary);
    display: none;
}

.input-static {
    background: #F7FAFC !important;
    color: #718096 !important;
    cursor: not-allowed;
}

/* ==========================================
   移动端适配
   ========================================== */
@media (max-width: 768px) {
    /* Header */
    .header {
        padding: 12px 0;
    }

    .header-inner {
        padding: 0 16px;
        gap: 12px;
    }

    .logo h1 {
        font-size: 18px;
    }

    .logo .subtitle {
        font-size: 10px;
    }

    .logo svg {
        width: 30px;
        height: 30px;
        flex-shrink: 0;
    }

    .header-stats {
        display: none;
    }

    .header-logout {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    /* Container */
    .container {
        padding: 12px;
    }

    /* Filter Bar */
    .filter-bar {
        gap: 8px;
    }

    .search-box {
        min-width: 0;
    }

    .search-box input {
        height: 42px;
        font-size: 14px;
    }

    .filter-select {
        height: 42px;
        font-size: 13px;
        padding: 0 30px 0 10px;
    }

    .btn-clear {
        height: 42px;
        font-size: 13px;
        padding: 0 12px;
    }

    /* Cards Grid - Single Column */
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Contact Card */
    .contact-card {
        padding: 14px 16px;
        gap: 12px;
        border-radius: 14px;
    }

    .card-avatar {
        width: 48px;
        height: 48px;
        min-width: 48px;
        border-radius: 50%;
        font-size: 18px;
    }

    .card-name {
        font-size: 18px;
    }

    .card-phone a {
        font-size: 15px;
    }

    .card-dept {
        font-size: 12px;
    }

    .card-arrow {
        right: 10px;
    }

    /* Gender Badge */
    .gender-badge {
        font-size: 10px;
        padding: 2px 8px;
    }

    /* Detail Modal */
    .detail-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .detail-modal {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 56vh;
        padding: 12px 20px 16px;
        width: 100%;
    }

    .detail-modal::before {
        content: '';
        display: block;
        width: 32px;
        height: 3px;
        background: #CBD5E0;
        border-radius: 2px;
        margin: 0 auto 10px;
        opacity: 0.5;
    }

    .detail-avatar {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        font-size: 18px;
        margin-bottom: 8px;
    }

    .detail-name {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .detail-info-grid {
        gap: 6px 12px;
    }

    .detail-label {
        font-size: 11px;
        margin-bottom: 2px;
    }

    .detail-value {
        font-size: 13px;
    }

    .highlight .detail-value {
        font-size: 14px;
    }

    .detail-actions {
        gap: 8px;
        margin-top: 12px;
    }

    .detail-btn {
        height: 38px;
        font-size: 13px;
        padding: 0 12px;
    }

    /* Footer */
    .footer {
        padding: 16px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 16px;
    }

    .contact-card {
        padding: 12px 14px;
    }

    .card-avatar {
        width: 44px;
        height: 44px;
        min-width: 44px;
        border-radius: 50%;
        font-size: 16px;
    }

    .card-name {
        font-size: 16px;
    }

    .card-phone a {
        font-size: 14px;
    }

    .detail-modal {
        border-radius: 16px 16px 0 0;
        max-height: 52vh;
        padding: 10px 16px 12px;
    }

    .detail-modal::before {
        width: 28px;
        height: 3px;
        margin-bottom: 8px;
    }

    .detail-avatar {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        font-size: 16px;
        margin-bottom: 6px;
    }

    .detail-name {
        font-size: 17px;
        margin-bottom: 8px;
    }

    .detail-info-grid {
        grid-template-columns: 1fr;
        gap: 5px 10px;
    }

    .detail-item.detail-full {
        grid-column: 1;
    }

    .detail-label {
        font-size: 10px;
        margin-bottom: 1px;
    }

    .detail-value {
        font-size: 12px;
    }

    .detail-actions {
        margin-top: 10px;
    }

    .detail-btn {
        height: 36px;
        font-size: 12px;
        padding: 0 10px;
    }
}

/* ==========================================
   管理后台移动端适配
   ========================================== */

.back-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: #A0AEC0;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--primary);
}

@media (max-width: 768px) {
    /* Admin Login */
    .login-card {
        padding: 32px 24px;
    }

    .login-card h2 {
        font-size: 22px;
    }

    .login-sub {
        font-size: 13px;
    }

    /* Admin Layout */
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        position: static;
        flex-direction: row;
        align-items: center;
        padding: 12px 16px;
        gap: 12px;
    }

    .sidebar-logo {
        border-bottom: none;
        padding: 0;
        white-space: nowrap;
    }

    .sidebar-menu {
        flex-direction: row;
        padding: 0;
        margin-left: auto;
        gap: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-menu a {
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    .sidebar-footer {
        display: none;
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-topbar {
        padding: 14px 16px;
    }

    .admin-topbar h2 {
        font-size: 18px;
    }

    .admin-content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .stat-card-num {
        font-size: 20px;
    }

    .upload-section {
        padding: 18px;
    }

    .upload-area {
        padding: 30px 18px;
    }

    .data-table th,
    .data-table td {
        padding: 12px 14px;
        font-size: 13px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    /* Admin Modal Mobile */
    .modal-admin {
        max-width: 100%;
        max-height: 88vh;
        border-radius: 16px 16px 0 0;
        margin-top: auto;
        transform: translateY(100%);
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-overlay.show .modal-admin {
        transform: translateY(0);
    }

    .modal-admin-header {
        padding: 16px 20px;
    }

    .modal-admin-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        font-size: 18px;
    }

    .modal-admin-header h3 {
        font-size: 16px;
    }

    .avatar-upload-section {
        padding: 14px 20px;
        gap: 12px;
    }

    .avatar-upload-preview {
        width: 64px;
        height: 64px;
        min-width: 64px;
        border-radius: 50%;
    }

    .avatar-upload-preview span {
        font-size: 22px;
    }

    .form-section {
        padding: 14px 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group {
        margin-bottom: 10px;
    }

    .modal-admin-actions {
        padding: 12px 20px 16px;
    }

    .btn-cancel,
    .btn-save {
        height: 38px;
        padding: 0 18px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 28px 20px;
    }

    .data-table td.actions {
        flex-direction: column;
        gap: 6px;
    }

    .btn-sm {
        width: 100%;
    }
}
