/* ================================================================
   授权管理系统 v2.0 — 全局样式
   配色: 主色 #4F46E5 (Indigo) / 背景 #F3F4F6 / 侧栏 #1E293B
   ================================================================ */

/* ========== 基础重置 ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #F3F4F6; color: #1F2937; font-size: 14px; line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: #4F46E5; text-decoration: none; }
a:hover { color: #4338CA; }

/* ================================================================
   应用布局: 侧栏 + 主区
   ================================================================ */
.app-layout { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
    width: 240px; min-width: 240px;
    background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
    color: #CBD5E1;
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    overflow-y: auto;
}
.sidebar-header {
    padding: 28px 20px 24px;
    display: flex; align-items: center; gap: 14px;
    border-bottom: 1px solid rgba(148,163,184,0.12);
}
.sidebar-logo {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: #fff; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; letter-spacing: 1px;
    flex-shrink: 0;
}
.sidebar-title h1 { font-size: 16px; color: #F1F5F9; font-weight: 600; line-height: 1.3; }
.sidebar-title span { font-size: 11px; color: #64748B; letter-spacing: 0.5px; }

/* 导航菜单 */
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 16px;
    border-radius: 8px;
    color: #94A3B8; font-size: 14px; font-weight: 500;
    transition: all 0.15s;
    cursor: pointer;
}
.nav-item:hover { background: rgba(99,102,241,0.12); color: #E2E8F0; }
.nav-item.active {
    background: linear-gradient(135deg, rgba(79,70,229,0.25), rgba(99,102,241,0.15));
    color: #A5B4FC;
    box-shadow: inset 3px 0 0 #6366F1;
}
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* 底部用户区 */
.sidebar-footer {
    padding: 16px 12px; border-top: 1px solid rgba(148,163,184,0.12);
    display: flex; align-items: center; justify-content: space-between;
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 36px; height: 36px;
    background: #4F46E5; color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
}
.user-meta strong { display: block; color: #E2E8F0; font-size: 13px; }
.user-meta span { color: #64748B; font-size: 11px; }
.logout-btn {
    background: none; border: 1px solid #334155; color: #64748B;
    width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
    font-size: 16px; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.logout-btn:hover { border-color: #EF4444; color: #EF4444; background: rgba(239,68,68,0.1); }
.change-pwd-link {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; margin-bottom: 10px;
    color: #94A3B8; font-size: 13px; border-radius: 6px;
    transition: all 0.15s;
}
.change-pwd-link .nav-icon { width: 15px; height: 15px; }
.change-pwd-link:hover { background: rgba(99,102,241,0.12); color: #A5B4FC; }

/* ---------- 主内容区 ---------- */
.main-area { flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-height: 100vh; }

/* 面包屑 */
.breadcrumb {
    padding: 16px 32px 0;
    font-size: 13px; color: #9CA3AF;
}
.breadcrumb a { color: #6B7280; }
.breadcrumb a:hover { color: #4F46E5; }
.breadcrumb span { color: #9CA3AF; }

/* 内容 */
.content { flex: 1; padding: 24px 32px 40px; }

/* ================================================================
   页面标题
   ================================================================ */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 700; color: #111827; }
.page-header p { color: #6B7280; font-size: 13px; margin-top: 4px; }

/* ================================================================
   仪表盘
   ================================================================ */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card {
    background: #fff; border-radius: 12px; padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    display: flex; align-items: center; gap: 16px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.stat-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.stat-icon.blue   { background: #EEF2FF; color: #4F46E5; }
.stat-icon.green  { background: #ECFDF5; color: #10B981; }
.stat-icon.purple { background: #F5F3FF; color: #8B5CF6; }
.stat-icon.orange { background: #FFF7ED; color: #F97316; }
.stat-body { flex: 1; }
.stat-value { font-size: 28px; font-weight: 700; color: #111827; line-height: 1.2; }
.stat-label { font-size: 13px; color: #9CA3AF; margin-top: 2px; }

.dashboard-section { margin-bottom: 32px; }
.section-title {
    font-size: 16px; font-weight: 600; color: #374151;
    margin-bottom: 12px; padding-bottom: 10px;
    border-bottom: 2px solid #E5E7EB;
}

/* ================================================================
   表格
   ================================================================ */
.search-bar { margin-bottom: 16px; }
.search-row { display: flex; gap: 10px; align-items: center; }
.search-input { flex: 1; max-width: 360px; }
.table-wrap {
    background: #fff; border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}
.table {
    width: 100%; border-collapse: collapse;
}
.table thead { background: #F9FAFB; }
.table th {
    padding: 12px 16px; text-align: left;
    font-size: 12px; font-weight: 600; color: #6B7280;
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid #E5E7EB;
}
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid #F3F4F6;
    font-size: 14px; color: #374151;
}
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: #F9FAFB; }
.table tbody tr:last-child td { border-bottom: none; }
.table code {
    background: #F3F4F6; color: #4F46E5;
    padding: 2px 8px; border-radius: 4px;
    font-family: "SF Mono", "Consolas", monospace; font-size: 12px;
    letter-spacing: 0.3px;
}
.table-actions { display: flex; gap: 6px; }

/* ================================================================
   状态徽章
   ================================================================ */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.2px;
}
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-info    { background: #DBEAFE; color: #1E40AF; }
.badge-gray    { background: #F3F4F6; color: #6B7280; }

/* ================================================================
   按钮
   ================================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; border-radius: 8px; border: 1px solid #D1D5DB;
    background: #fff; color: #374151; cursor: pointer;
    font-size: 14px; font-weight: 500;
    transition: all 0.15s; white-space: nowrap;
}
.btn:hover { background: #F9FAFB; border-color: #9CA3AF; }
.btn-primary {
    background: #4F46E5; color: #fff; border-color: #4F46E5;
}
.btn-primary:hover { background: #4338CA; border-color: #4338CA; }
.btn-danger {
    background: #EF4444; color: #fff; border-color: #EF4444;
}
.btn-danger:hover { background: #DC2626; border-color: #DC2626; }
.btn-success {
    background: #10B981; color: #fff; border-color: #10B981;
}
.btn-success:hover { background: #059669; border-color: #059669; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; }

/* ================================================================
   表单
   ================================================================ */
.card {
    background: #fff; border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    padding: 28px;
}
.card-title {
    font-size: 16px; font-weight: 600; color: #111827;
    margin-bottom: 20px; padding-bottom: 12px;
    border-bottom: 1px solid #F3F4F6;
}
.form-group { margin-bottom: 20px; }
.form-label {
    display: block; margin-bottom: 6px;
    font-size: 13px; font-weight: 600; color: #374151;
}
.form-label .required { color: #EF4444; }
.form-control {
    width: 100%; padding: 10px 14px;
    border: 1px solid #D1D5DB; border-radius: 8px;
    font-size: 14px; color: #1F2937; background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.form-control:focus {
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.form-control:read-only { background: #F9FAFB; color: #6B7280; }
.form-control::placeholder { color: #9CA3AF; }
.form-hint { font-size: 12px; color: #9CA3AF; margin-top: 4px; }
.form-checkbox {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.form-checkbox input[type="checkbox"] {
    width: 18px; height: 18px; accent-color: #4F46E5; cursor: pointer;
}
.form-actions {
    display: flex; gap: 10px; margin-top: 24px; padding-top: 20px;
    border-top: 1px solid #F3F4F6;
}
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); background-position: right 12px center; background-repeat: no-repeat; background-size: 16px; padding-right: 36px; }

/* ================================================================
   详情信息
   ================================================================ */
.detail-block { margin-bottom: 28px; }
.info-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 0;
    background: #fff; border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}
.info-item {
    display: flex; padding: 16px 20px; border-bottom: 1px solid #F3F4F6;
}
.info-item:nth-child(odd) { background: #FAFAFA; }
.info-label { width: 100px; font-size: 13px; color: #6B7280; font-weight: 500; flex-shrink: 0; }
.info-value { font-size: 14px; color: #111827; flex: 1; }

/* ================================================================
   提示消息
   ================================================================ */
.alert {
    padding: 14px 18px; border-radius: 8px; margin-bottom: 16px;
    font-size: 14px; display: flex; align-items: flex-start; gap: 10px;
    line-height: 1.5;
}
.alert::before { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-error   { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }
.alert-error::before   { content: "✕"; }
.alert-success { background: #F0FDF4; border: 1px solid #BBF7D0; color: #065F46; }
.alert-success::before { content: "✓"; }
.alert-warning { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; }
.alert-warning::before { content: "!"; font-weight: bold; }
.alert-info    { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }
.alert ul { margin: 8px 0 0 0; padding-left: 18px; font-size: 13px; }
.alert ul li { margin-bottom: 3px; }

/* ================================================================
   空状态
   ================================================================ */
.empty-state {
    text-align: center; padding: 60px 20px; color: #9CA3AF;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; color: #6B7280; margin-bottom: 8px; }
.empty-state p { font-size: 13px; margin-bottom: 20px; }

/* ================================================================
   登录页与改密页
   ================================================================ */
.auth-page {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1E293B 0%, #312E81 50%, #4F46E5 100%);
}
.auth-card {
    background: #fff; border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 44px 40px; width: 420px; max-width: 95vw;
}
.auth-logo {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: #fff; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700; margin: 0 auto 20px;
}
.auth-card h1 { text-align: center; font-size: 20px; margin-bottom: 4px; color: #111827; }
.auth-card .subtitle { text-align: center; color: #9CA3AF; font-size: 13px; margin-bottom: 28px; }

/* ================================================================
   响应式
   ================================================================ */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { width: 64px; min-width: 64px; }
    .sidebar-title, .sidebar-nav .nav-item span:not(.nav-icon),
    .user-meta, .sidebar-logo { display: none; }
    .sidebar-nav { padding: 12px 8px; }
    .nav-item { justify-content: center; padding: 12px; }
    .sidebar-footer { padding: 12px 8px; justify-content: center; }
    .user-info { display: none; }
    .main-area { margin-left: 64px; }
    .stats-grid { grid-template-columns: 1fr; }
    .content { padding: 16px; }
}
