/* ============================================
   物资存放点管理系统 - 公共样式
   现代化简约风格 v2.0
   ============================================ */

/* ---- CSS 变量 ---- */
:root {
    --primary: #4f6ef7;
    --primary-hover: #3b57d9;
    --primary-light: #eef1ff;
    --success: #22c55e;
    --success-bg: #f0fdf4;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --info: #3b82f6;
    --purple: #8b5cf6;
    --cyan: #06b6d4;
    --orange: #f97316;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --text-primary: #1d1d1f;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-page: #f4f5f7;
    --bg-card: #ffffff;
    --border: #e5e7eb;
    --border-focus: #4f6ef7;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 16px;
    --font: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, #4f6ef7 0%, #7c3aed 100%);
}

/* ---- Reset ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 14px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: var(--font);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ---- 通用页面背景 ---- */
.page-auth {
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

.page-app {
    background: var(--bg-page);
    min-height: 100vh;
}

/* ---- Auth 容器（登录/注册） ---- */
.auth-container {
    background: var(--bg-card);
    padding: 44px 40px 36px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.4s ease;
}

.auth-container .logo-section {
    text-align: center;
    margin-bottom: 32px;
}

.auth-container .logo-section h1 {
    font-size: 26px;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.auth-container .logo-section p {
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-container .auth-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-container .auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-container .auth-footer a:hover { color: var(--primary-hover); text-decoration: underline; }

/* ---- Header（首页/管理页） ---- */
.header {
    background: var(--bg-card);
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header .logo h1 {
    font-size: 20px;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header .logo .logo-icon {
    font-size: 26px;
    line-height: 1;
}

.header .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.header .user-info .username {
    font-weight: 600;
    color: var(--text-primary);
}

/* ---- Button 按钮系统 ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(79, 110, 247, 0.3);
}

.btn-primary:hover { opacity: 0.92; box-shadow: 0 4px 12px rgba(79, 110, 247, 0.35); }

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
}

.btn-secondary:hover { background: var(--gray-200); }

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover { background: #dc2626; }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover { background: var(--primary-light); }

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    border-radius: var(--radius-md);
    margin-top: 4px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 4px;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 10px;
}

.btn-ghost:hover { background: var(--gray-100); color: var(--text-primary); }

/* ---- Form 表单 ---- */
.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-card);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.12);
}

.form-group input::placeholder { color: var(--text-muted); }

.form-group .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.form-group .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
    cursor: pointer;
    font-weight: 400;
}

.form-group .checkbox-group input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary);
}

/* ---- Card 卡片 ---- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.card-hover {
    cursor: pointer;
    transition: all var(--transition);
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* ---- Projects Grid（首页） ---- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.project-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--gray-200);
}

.project-card.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.project-card.disabled:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

.project-card .project-icon {
    font-size: 44px;
    margin-bottom: 14px;
    line-height: 1;
}

.project-card .project-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.project-card .project-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.project-card .access-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.project-card .access-badge.allowed {
    background: #e6f7ed;
    color: #166534;
}

.project-card .access-badge.denied {
    background: var(--danger-bg);
    color: #991b1b;
}

.project-card .access-badge.public {
    background: #e0f2fe;
    color: #075985;
}

/* ---- Message 提示 ---- */
.message {
    text-align: center;
    margin-bottom: 18px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.5;
}

.message.error {
    color: var(--danger);
    background: var(--danger-bg);
}

.message.success {
    color: #166534;
    background: var(--success-bg);
}

.message.success a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

/* ---- Table 表格 ---- */
.table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    border: 1px solid var(--border);
}

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

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

th {
    background: var(--gray-50);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--gray-50); }

/* ---- Badge 角色标签 ---- */
.role-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.role-admin { background: #fce4ec; color: #c62828; }
.role-advanced { background: #e0f2fe; color: #0369a1; }
.role-intermediate { background: #fff3e0; color: #c2410c; }
.role-user { background: var(--gray-100); color: var(--text-secondary); }
.role-outsourcing { background: #e6f7ed; color: #166534; }

/* ---- Project Tags ---- */
.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.project-tag {
    padding: 2px 8px;
    background: var(--gray-100);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ---- Modal 弹窗 ---- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
    backdrop-filter: blur(2px);
}

.modal-overlay.show { display: flex; animation: fadeIn 0.2s ease; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: scaleIn 0.25s ease;
}

.modal h3 {
    font-size: 18px;
    margin-bottom: 24px;
    color: var(--text-primary);
    font-weight: 700;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ---- Toast 消息 ---- */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    display: none;
    box-shadow: var(--shadow-lg);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.show { display: block; animation: slideInRight 0.3s ease; }

/* ---- Action Buttons 操作按钮组 ---- */
.action-buttons {
    display: flex;
    gap: 6px;
}

/* ---- Toolbar ---- */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.toolbar h2 {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 700;
}

/* ---- Container ---- */
.container {
    padding: 28px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ---- Animations ---- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .auth-container { padding: 32px 24px 28px; border-radius: var(--radius-lg); }
    .auth-container .logo-section h1 { font-size: 22px; }
    
    .header { padding: 12px 16px; }
    .header .logo h1 { font-size: 17px; }
    .header .user-info { gap: 8px; font-size: 13px; }
    
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 20px 16px;
    }
    .project-card { padding: 22px; }
    
    .container { padding: 16px; }
    .toolbar { flex-direction: column; align-items: stretch; }
    
    th, td { padding: 10px 8px; font-size: 12px; }
    .action-buttons { flex-direction: column; }
    
    .modal { padding: 24px 20px; margin: 16px; }
    
    .form-group input,
    .form-group select { padding: 11px 12px; }
}
