/* ===================================
   账号管理系统 - 全局样式
   暗色主题 | 移动端优先 | 现代设计
   =================================== */

:root {
    /* 颜色系统 */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: rgba(26, 26, 37, 0.8);
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    
    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-radius: 12px;
    --border-radius-lg: 16px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    
    /* 动画 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* 重置样式 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 
                 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 背景动画 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(168, 85, 247, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ===================================
   布局
   =================================== */
.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    padding: 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.page-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-content {
    flex: 1;
    padding: 16px;
}

/* ===================================
   卡片
   =================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    backdrop-filter: blur(10px);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===================================
   表单
   =================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

textarea.form-input {
    min-height: 80px;
    resize: vertical;
}

/* ===================================
   按钮
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

/* ===================================
   登录页
   =================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 360px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .icon {
    width: 64px;
    height: 64px;
    background: var(--accent-gradient);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    box-shadow: var(--shadow-glow);
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ===================================
   导航栏
   =================================== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.navbar-brand .icon {
    width: 32px;
    height: 32px;
    background: var(--accent-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-user span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===================================
   标签页
   =================================== */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

.tab:hover:not(.active) {
    color: var(--text-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ===================================
   列表
   =================================== */
.list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    transition: all var(--transition-fast);
}

.list-item:hover {
    border-color: var(--accent-primary);
}

.list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.list-item-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    word-break: break-all;
}

.list-item-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.list-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.list-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ===================================
   标签
   =================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-admin {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-secondary);
}

.badge-worker {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* ===================================
   模态框
   =================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.modal-footer .btn {
    flex: 1;
}

/* ===================================
   扫码器
   =================================== */
.scanner-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 16px;
}

.scanner-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-frame {
    width: 70%;
    height: 70%;
    border: 2px solid var(--accent-primary);
    border-radius: 16px;
    box-shadow: 
        0 0 0 9999px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(99, 102, 241, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.scanner-line {
    position: absolute;
    left: 15%;
    right: 15%;
    height: 2px;
    background: var(--accent-gradient);
    box-shadow: 0 0 10px var(--accent-primary);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { top: 15%; }
    50% { top: 85%; }
    100% { top: 15%; }
}

.scanner-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 12px;
}

/* ===================================
   空状态
   =================================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 16px;
}

/* ===================================
   加载状态
   =================================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===================================
   提示消息
   =================================== */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 90%;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s ease;
}

.toast.success {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.toast.error {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===================================
   工具类
   =================================== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }

.hidden { display: none !important; }

/* ===================================
   响应式
   =================================== */
@media (min-width: 768px) {
    .container {
        max-width: 600px;
    }
    
    .login-box {
        max-width: 400px;
    }
}
