/**
 * 核力科技后台管理 SPA - 样式表
 * - 侧栏布局（宽屏展开 + 768px 汉堡菜单）
 * - display 切换页面（保留 DOM 状态）
 * - 过渡动画
 */

/* ==================== 基础重置 ==================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #F1F5F9;
    min-height: 100vh;
    display: flex;
    overflow: hidden;
}

/* ==================== 侧栏 ==================== */

.sidebar {
    width: 240px;
    min-width: 240px;
    height: 100vh;
    background: linear-gradient(180deg, #0a1628 0%, #1a365d 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    position: relative;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.2s;
}

.sidebar-close:hover {
    color: #fff;
}

/* 侧栏导航 */

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
    color: #fff;
    background: rgba(0, 102, 255, 0.2);
    border-left: 3px solid #0066FF;
}

.nav-icon {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
}

.nav-text {
    white-space: nowrap;
}

/* 侧栏底部 */

.sidebar-footer {
    padding: 0.75rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-logout:hover {
    background: rgba(220, 38, 38, 0.15);
    color: #FCA5A5;
}

/* ==================== 遮罩层（移动端） ==================== */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ==================== 管理界面容器 ==================== */

.admin-wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* ==================== 主内容区 ==================== */

.main-content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== 顶部栏 ==================== */

.topbar {
    background: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid #E2E8F0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.hamburger:hover {
    background: #F1F5F9;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: #0F172A;
    margin: 4px 0;
    border-radius: 1px;
    transition: all 0.3s;
}

.topbar-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #0F172A;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-user {
    font-size: 0.9rem;
    color: #64748B;
}

/* ==================== 页面容器 ==================== */

.page-container {
    flex: 1;
    padding: 1.5rem;
}

.page {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==================== 统计卡片 ==================== */

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat {
    background: #fff;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}

.stat:hover {
    transform: translateY(-2px);
}

.stat h3 {
    font-size: 0.85rem;
    color: #64748B;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat .num {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat.blue .num { color: #0066FF; }
.stat.orange .num { color: #F59E0B; }
.stat.green .num { color: #00D4AA; }
.stat.purple .num { color: #6366F1; }
.stat.red .num { color: #DC2626; }

/* ==================== 工具栏 ==================== */

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-input {
    padding: 0.6rem 1rem;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    font-size: 0.9rem;
    width: 220px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #0066FF;
}

.filter-select {
    padding: 0.6rem;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fff;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #0066FF;
}

.date-input {
    padding: 0.55rem;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    font-size: 0.85rem;
    width: 140px;
}

.date-input:focus {
    outline: none;
    border-color: #0066FF;
}

.date-sep {
    color: #94A3B8;
    font-size: 0.85rem;
}

.btn-search {
    padding: 0.6rem 1.5rem;
    background: linear-gradient(135deg, #0066FF, #00D4AA);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.btn-search:hover { opacity: 0.9; }

.btn-export {
    padding: 0.6rem 1.2rem;
    background: #10B981;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-export:hover { background: #059669; }

.btn-add {
    padding: 0.6rem 1.5rem;
    background: #0066FF;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-add:hover { background: #0052CC; }

/* ==================== 表格 ==================== */

.table-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.table-title {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #E2E8F0;
    font-weight: 600;
    font-size: 1rem;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid #E2E8F0;
    white-space: nowrap;
}

th {
    background: #F8FAFC;
    font-weight: 600;
    color: #64748B;
    font-size: 0.85rem;
}

td {
    font-size: 0.9rem;
    color: #0F172A;
}

.empty {
    text-align: center;
    padding: 3rem;
    color: #64748B;
}

/* ==================== 徽章 ==================== */

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.badge.pending { background: #FEF3C7; color: #D97706; }
.badge.replied { background: #D1FAE5; color: #059669; }
.badge.open { background: #D1FAE5; color: #059669; }
.badge.closed { background: #FEE2E2; color: #DC2626; }

/* ==================== 小按钮 ==================== */

.btn-sm {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    margin-right: 0.25rem;
    transition: opacity 0.2s;
}

.btn-sm:hover { opacity: 0.85; }

.btn-view { background: #EFF6FF; color: #2563EB; }
.btn-edit { background: #EFF6FF; color: #2563EB; }
.btn-toggle { background: #FEF3C7; color: #D97706; }
.btn-del { background: #FEE2E2; color: #DC2626; }

/* ==================== 分页 ==================== */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 0 0.5rem;
    font-size: 0.9rem;
    color: #64748B;
}

.pagination-btns {
    display: flex;
    gap: 0.25rem;
}

.page-btn {
    padding: 0.4rem 0.75rem;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.page-btn:hover {
    border-color: #0066FF;
    color: #0066FF;
}

.page-btn.active {
    background: #0066FF;
    color: #fff;
    border-color: #0066FF;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 分页省略号 */
.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.5rem;
    color: #94A3B8;
    font-size: 0.85rem;
    user-select: none;
    min-width: 28px;
}

/* ==================== 弹窗 ==================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.show {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: auto;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-head {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-head h3 {
    font-size: 1.1rem;
}

.close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748B;
    transition: color 0.2s;
}

.close:hover { color: #0F172A; }

.modal-body {
    padding: 1.5rem;
}

.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    font-size: 0.85rem;
    color: #64748B;
    margin-bottom: 0.25rem;
}

.field .val {
    color: #0F172A;
}

.field .msg {
    background: #F8FAFC;
    padding: 1rem;
    border-radius: 8px;
    white-space: pre-wrap;
}

.btn-done {
    background: linear-gradient(135deg, #0066FF 0%, #00D4AA 100%);
    color: #fff;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-done:hover { opacity: 0.9; }

/* ==================== 岗位表单 ==================== */

.form-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.form-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #E2E8F0;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #0F172A;
    font-size: 0.9rem;
}

.form-group label .req {
    color: #DC2626;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #E2E8F0;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #0066FF;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.btn-submit {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, #0066FF, #00D4AA);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: opacity 0.2s;
}

.btn-submit:hover { opacity: 0.9; }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.msg {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.msg.ok { color: #059669; }
.msg.err { color: #DC2626; }

.hint {
    font-size: 0.8rem;
    color: #94A3B8;
    margin-top: 0.2rem;
}

/* ==================== 修改密码弹窗 ==================== */

.pwd-field {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    font-size: 0.95rem;
    margin-top: 0.3rem;
    transition: border-color 0.2s;
}

.pwd-field:focus {
    outline: none;
    border-color: #0066FF;
}

.btn-pwd-submit {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #0066FF, #00D4AA);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: opacity 0.2s;
}

.btn-pwd-submit:hover { opacity: 0.9; }

.pwd-msg {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.pwd-msg.ok { color: #059669; }
.pwd-msg.err { color: #DC2626; }

/* ==================== 响应式：768px 断点 ==================== */

@media (max-width: 768px) {
    /* 侧栏变为抽屉模式 */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    /* 汉堡菜单可见 */
    .hamburger {
        display: block;
    }

    /* 统计卡片 2 列 */
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 工具栏竖排 */
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        width: 100%;
    }

    .date-input {
        width: 100%;
    }

    /* 表格水平滚动 */
    .table-wrapper {
        -webkit-overflow-scrolling: touch;
    }

    th, td {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
    }

    /* 分页 */
    .pagination {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    /* 表单行单列 */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* 页面内边距调整 */
    .page-container {
        padding: 1rem;
    }
}

/* ==================== 小屏手机（480px 以下） ==================== */

@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr;
    }

    .topbar-title {
        font-size: 1rem;
    }

    .page-container {
        padding: 0.75rem;
    }
}

/* ==================== 登录页面 ==================== */
.login-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a1628 0%, #1a365d 100%);
    z-index: 9999;
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 400px;
    min-width: 280px;
    text-align: center;
}

.login-header {
    margin-bottom: 20px;
}

.login-header .logo-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 8px;
}

.login-header .logo-text {
    font-size: 24px;
    font-weight: 700;
    color: #1a365d;
}

.login-box h2 {
    color: #334155;
    margin-bottom: 24px;
    font-size: 18px;
}

.login-field {
    margin-bottom: 16px;
}

.login-field label {
    display: block;
    color: #64748b;
    font-size: 14px;
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.login-field input:focus {
    border-color: #3b82f6;
    outline: none;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-login:hover {
    background: #2563eb;
}

.login-msg {
    margin-top: 12px;
    color: #ef4444;
    font-size: 14px;
}

/* ==================== 登录页面响应式 ==================== */
@media (max-width: 480px) {
    .login-page {
        padding: 16px;
    }
    
    .login-box {
        width: 100%;
        padding: 24px 20px;
        border-radius: 8px;
    }
    
    .login-header .logo-icon {
        font-size: 32px;
    }
    
    .login-header .logo-text {
        font-size: 20px;
    }
    
    .login-box h2 {
        font-size: 16px;
    }
    
    .login-field input {
        padding: 10px 12px;
        font-size: 16px; /* 防止 iOS 缩放 */
    }
    
    .btn-login {
        padding: 14px;
        font-size: 16px;
    }
}
