/* ========== 基础样式 ========== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #2d3436 0%, #000000 100%);
    min-height: 100vh;
    padding: 20px;
}

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

/* ========== 头部 ========== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: #ffffff;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-link {
    display: block;
    line-height: 0;
}

.header-logo {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
    cursor: pointer;
}

.header-logo:hover {
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
    color: #ffffff;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-actions .backup-btn,
.header-actions .restore-btn {
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.header-actions .backup-btn {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.header-actions .backup-btn:hover {
    background: rgba(74, 222, 128, 0.25);
}

.header-actions .restore-btn {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
}

.header-actions .restore-btn:hover {
    background: rgba(96, 165, 250, 0.25);
}

.logout-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* ========== 卡片 ========== */
.card {
    background: rgba(45, 52, 54, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ========== 添加表单区域 ========== */
.add-section {
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px 16px 0 0;
    position: relative;
    z-index: 100;
}

.add-form {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.input-group {
    flex: 1;
    min-width: 150px;
}

.input-group label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
    font-weight: 500;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.input-group input[readonly] {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    cursor: pointer;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.12);
}

/* ========== 按钮 ========== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    align-self: flex-end;
}

.btn-primary:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.25);
}

.btn-small {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit { background: rgba(96, 165, 250, 0.2); color: #60a5fa; }
.btn-edit:hover { background: rgba(96, 165, 250, 0.3); }
.btn-delete { background: rgba(248, 113, 113, 0.2); color: #f87171; }
.btn-delete:hover { background: rgba(248, 113, 113, 0.3); }

.btn-secondary { 
    background: rgba(255, 255, 255, 0.1); 
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-secondary:hover { 
    background: rgba(255, 255, 255, 0.2); 
    color: #ffffff;
}

/* ========== 工具栏 ========== */
.toolbar {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.stats {
    display: flex;
    gap: 20px;
}

.stat-item { text-align: center; }

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
}

.stat-number.warning { color: #fbbf24; }
.stat-number.danger { color: #f87171; }
.stat-number.today { color: #4ade80; }

.stat-clickable {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.stat-clickable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.stat-clickable.active-warning { background: rgba(251, 191, 36, 0.2); }
.stat-clickable.active-danger { background: rgba(248, 113, 113, 0.2); }
.stat-clickable.active-today { background: rgba(74, 222, 128, 0.2); }

.stat-label { font-size: 12px; color: rgba(255, 255, 255, 0.5); }

.controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.sort-btn, .filter-btn {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.sort-btn:hover, .filter-btn:hover { 
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.sort-btn.active { 
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: white; 
}

.filter-btn.active { 
    background: rgba(248, 113, 113, 0.2); 
    border-color: rgba(248, 113, 113, 0.3); 
    color: #f87171; 
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}

.sort-select option {
    background: #2d3436;
    color: #ffffff;
}

.sort-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
}

/* ========== 筛选区域 ========== */
.filter-section {
    padding: 12px 20px;
    background: rgba(251, 191, 36, 0.15);
    border-bottom: 1px solid rgba(251, 191, 36, 0.3);
    display: none;
}

.filter-section.show { display: block; }

.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-row label { font-size: 14px; color: #fbbf24; font-weight: 500; }

.search-input {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-family: inherit;
    width: 150px;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.12);
}

.filter-select {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-family: inherit;
}

.filter-select option {
    background: #2d3436;
    color: #ffffff;
}

.clear-filter {
    padding: 8px 16px;
    background: rgba(251, 146, 60, 0.3);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.4);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-filter:hover {
    background: rgba(251, 146, 60, 0.4);
}

.filter-count { margin-left: auto; font-size: 14px; color: #fbbf24; font-weight: 600; }

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

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

.user-table th {
    text-align: left;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.user-table td {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.user-table tr:hover td { background: rgba(255, 255, 255, 0.03); }
.user-table tr.expired-row td { background: rgba(248, 113, 113, 0.1); }
.user-table tr.expired-row:hover td { background: rgba(248, 113, 113, 0.15); }

.user-name { 
    font-weight: 600; 
    color: #ffffff; 
    cursor: pointer;
    transition: all 0.2s;
}
.user-name:hover { color: #60a5fa; }
.user-name:active { color: #3b82f6; }

.user-note { color: rgba(255, 255, 255, 0.5); font-size: 13px; }
.expire-date { font-weight: 500; color: rgba(255, 255, 255, 0.8); }
.created-at { color: rgba(255, 255, 255, 0.4); font-size: 12px; }

.days-left {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.days-left.danger { background: rgba(248, 113, 113, 0.2); color: #f87171; }
.days-left.warning { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.days-left.safe { background: rgba(74, 222, 128, 0.2); color: #4ade80; }
.days-left.expired { background: #f87171; color: white; animation: pulse 2s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

.actions { display: flex; gap: 8px; }

.empty-state {
    text-align: center;
    padding: 60px 20px !important;
    color: rgba(255, 255, 255, 0.4);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ========== 加载和提示 ========== */
.loading { text-align: center; padding: 40px; color: rgba(255, 255, 255, 0.5); }

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(45, 52, 54, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 2000;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show { opacity: 1; }
