/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 参考BI Academy的深绿色主题 */
    --bg: #0a1f16;
    --bg-2: #0f2a1f;
    --surface: #123025;
    --primary: #1a3a2d;
    --primary-2: #0f2a1f;
    --text: #e8f2ec;
    --muted: #a8b8b0;
    --gold: #b89d6e;
    --card: #123025;
    --border: #2a5a47;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    
    /* 保留原有变量名以兼容 */
    --primary-color: #b89d6e;
    --primary-hover: #a88d5e;
    --success-color: #34C759;
    --danger-color: #FF3B30;
    --warning-color: #FF9500;
    --bg-dark: #0a1f16;
    --bg-surface: #123025;
    --text-primary: #e8f2ec;
    --text-secondary: #a8b8b0;
    --border-color: #2a5a47;
}

body {
    font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: radial-gradient(1000px 600px at 10% -10%, rgba(26, 58, 45, 0.2), transparent),
                radial-gradient(800px 500px at 100% 0%, rgba(15, 42, 31, 0.23), transparent),
                linear-gradient(180deg, var(--bg), var(--bg-2));
    color: var(--text-primary);
    line-height: 1.6;
}

/* 登录页面 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(1000px 600px at 10% -10%, rgba(26, 58, 45, 0.2), transparent),
                radial-gradient(800px 500px at 100% 0%, rgba(15, 42, 31, 0.23), transparent),
                linear-gradient(180deg, var(--bg), var(--bg-2));
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

/* 登录页面全屏布局（当使用左右布局时） */
body.login-page .login-container {
    max-width: none;
    padding: 0;
}

.login-card {
    background: linear-gradient(180deg, var(--surface), var(--primary-2));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 30px;
    box-shadow: var(--shadow);
}

.login-title {
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 16px;
    font-weight: 500;
}

.login-mode {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* NFC 刷卡区域 */
.nfc-indicator {
    text-align: center;
    padding: 40px 20px;
    margin: 20px 0;
    background: var(--bg-dark);
    border-radius: 12px;
    border: 2px dashed var(--border-color);
}

.nfc-icon {
    font-size: 64px;
    margin-bottom: 15px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.nfc-hint {
    color: var(--text-secondary);
    font-size: 16px;
    margin: 0;
}

.nfc-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    border: none;
    padding: 0;
    margin: 0;
    pointer-events: none;
    caret-color: transparent;
}

.switch-login-mode {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.switch-login-mode a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.switch-login-mode a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.btn-nfc-switch {
    width: 100%;
    padding: 14px 24px;
    background: var(--bg-dark);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-nfc-switch:hover {
    background: rgba(0, 122, 255, 0.1);
    border-color: var(--primary-hover);
    color: var(--primary-hover);
}

.nfc-icon-small {
    font-size: 20px;
}

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

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.form-divider::before,
.form-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border-color);
}

.form-divider::before {
    left: 0;
}

.form-divider::after {
    right: 0;
}

.form-divider span {
    background: var(--bg-surface);
    padding: 0 10px;
    color: var(--text-secondary);
    font-size: 12px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-block {
    width: 100%;
}

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

.error-message {
    background: rgba(255, 59, 48, 0.2);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

/* Dashboard 样式 */
.dashboard-container {
    min-height: 100vh;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    background: color-mix(in srgb, var(--bg-2) 75%, transparent);
    backdrop-filter: blur(8px);
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 10;
}

.dashboard-title {
    font-size: 24px;
    font-weight: bold;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-size: 16px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.dashboard-main {
    display: flex !important;
    flex: 1;
    overflow: hidden;
    flex-direction: row !important;
}

/* 侧边栏样式 */
.sidebar {
    width: 240px !important;
    min-width: 240px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    flex-shrink: 0;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    display: block !important;
    position: relative;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 10px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.sidebar-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 0;
    background: var(--primary-color);
    border-radius: 0 3px 3px 0;
    transition: all 0.3s ease;
}

.sidebar-item:hover {
    background: rgba(0, 122, 255, 0.1);
    color: var(--text-primary);
    transform: translateX(4px);
}

.sidebar-item.active {
    background: rgba(0, 122, 255, 0.15);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-item.active::before {
    transform: translateY(-50%) scaleY(1);
    height: 70%;
}

.sidebar-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    transition: transform 0.3s ease;
}

.sidebar-item:hover .sidebar-icon {
    transform: scale(1.1);
}

.sidebar-text {
    flex: 1;
}

.dashboard-content-wrapper {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    max-width: 1400px;
    width: 100%;
}

.dashboard-content {
    padding: 0;
}

/* 标签页动画 */
.tab-panel {
    animation-duration: 0.3s;
    animation-timing-function: ease-in-out;
}

.fade-in {
    animation-name: fadeIn;
}

.fade-out {
    animation-name: fadeOut;
}

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

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease-out;
}

.stat-card {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
}

.section-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
}

.table-container {
    background: var(--bg-surface);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.table-container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-dark);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

.table tbody tr {
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.table tbody tr:hover {
    background: var(--bg-dark);
    transform: scale(1.01);
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(52, 199, 89, 0.2);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(255, 149, 0, 0.2);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(255, 59, 48, 0.2);
    color: var(--danger-color);
}

/* 筛选容器 */
.filter-container {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-row {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s;
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 响应式 */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }
    
    .dashboard-main {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 10px 0;
        max-height: 200px;
        overflow-x: auto;
    }
    
    .sidebar-nav {
        flex-direction: row;
        gap: 5px;
        padding: 0 10px;
        overflow-x: auto;
    }
    
    .sidebar-item {
        white-space: nowrap;
        padding: 10px 16px;
        min-width: fit-content;
    }
    
    .sidebar-item::before {
        display: none;
    }
    
    .sidebar-item.active {
        border-bottom: 2px solid var(--primary-color);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-content-wrapper {
        padding: 20px;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
    }
}

