/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f0f4f8;
    color: #1a202c;
    min-height: 100vh;
}

/* ========== 导航栏 ========== */
.navbar {
    background: linear-gradient(135deg, #1a202c, #2d3748);
    color: white;
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-display {
    font-size: 0.9rem;
    opacity: 0.9;
}

.btn-logout {
    background: rgba(255,255,255,0.15);
    color: white;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.25);
}

/* ========== 容器 ========== */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* ========== 卡片 ========== */
.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
}

/* ========== 登录卡片 ========== */
.login-card {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2.5rem;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: #4a5568;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

/* ========== 按钮 ========== */
.btn {
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #4299e1;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #3182ce;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.btn-secondary {
    background: #edf2f7;
    color: #2d3748;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.error-message {
    color: #e53e3e;
    font-size: 0.9rem;
    margin-top: 0.75rem;
    text-align: center;
}

/* ========== 欢迎横幅 ========== */
.welcome-banner {
    background: linear-gradient(135deg, #4299e1, #667eea);
    color: white;
    border-radius: 12px;
    padding: 2rem 2.5rem;
    margin-bottom: 1.5rem;
}

.welcome-banner h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.welcome-banner p {
    margin-top: 0.5rem;
    opacity: 0.9;
}

.role-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-icon {
    font-size: 2.5rem;
    width: 3.5rem;
    text-align: center;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3748;
}

.stat-label {
    font-size: 0.85rem;
    color: #718096;
}

/* ========== 表格 ========== */
.table-container {
    overflow-x: auto;
}

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

table th {
    background: #f7fafc;
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
}

table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #edf2f7;
}

table tr:hover td {
    background: #f7fafc;
}

.loading-text {
    text-align: center;
    color: #a0aec0;
    padding: 2rem 0 !important;
}

/* ========== 功能网格 ========== */
.function-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.function-item h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #2d3748;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
}

.input-group input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

.result-box {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f7fafc;
    border-radius: 8px;
    font-size: 0.9rem;
    min-height: 44px;
    color: #4a5568;
    word-break: break-all;
    border: 1px solid #e2e8f0;
    line-height: 1.5;
}

.result-box.success {
    background: #f0fff4;
    border-color: #9ae6b4;
    color: #276749;
}

.result-box.error {
    background: #fff5f5;
    border-color: #feb2b2;
    color: #c53030;
}

.result-box.info {
    background: #ebf8ff;
    border-color: #90cdf4;
    color: #2b6cb0;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    background: #2d3748;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    transform: translateY(120px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: #38a169;
}

.toast.error {
    background: #e53e3e;
}

.toast.info {
    background: #3182ce;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }
    .container {
        padding: 0 1rem;
        margin: 1rem auto;
    }
    .card {
        padding: 1rem 1.25rem;
    }
    .login-card {
        margin: 2rem auto;
        padding: 1.75rem;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .function-grid {
        grid-template-columns: 1fr;
    }
    .welcome-banner h1 {
        font-size: 1.25rem;
    }
    .btn-group {
        flex-direction: column;
    }
    .btn-group .btn {
        width: 100%;
    }
}