/**
 * 现代简约风格 CSS - 社区生活服务平台
 * 设计风格：现代简约、大留白、柔和阴影、微妙动效
 * 版本: 2.0
 */

/* ==================== CSS变量定义 ==================== */
:root {
    /* 主色调 - 深蓝绿色系 */
    --primary: #3B82F6;
    --primary-light: #60A5FA;
    --primary-dark: #2563EB;
    --primary-bg: #EFF6FF;
    
    /* 辅助色 - 橙色系 */
    --accent: #F97316;
    --accent-light: #FB923C;
    --accent-bg: #FFF7ED;
    
    /* 成功/警告/危险色 */
    --success: #10B981;
    --success-bg: #ECFDF5;
    --warning: #F59E0B;
    --warning-bg: #FFFBEB;
    --danger: #EF4444;
    --danger-bg: #FEF2F2;
    
    /* 中性色 */
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* 过渡 */
    --transition-fast: 150ms ease;
    --transition: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* 字体 */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* ==================== 基础重置 ==================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100vh;
}

/* ==================== 容器布局 ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-sm {
    max-width: 640px;
}

.container-lg {
    max-width: 1400px;
}

/* ==================== 卡片组件 ==================== */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-body {
    padding: 24px;
}

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

/* ==================== 标题排版 ==================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, var(--primary), var(--primary-light));
    border-radius: 2px;
}

/* ==================== 按钮系统 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.btn:active {
    transform: scale(0.98);
}

/* 主按钮 */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #1D4ED8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

/* 次要按钮 */
.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    transform: translateY(-1px);
}

/* 强调按钮 */
.btn-accent {
    background: linear-gradient(135deg, var(--accent) 0%, #EA580C 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

.btn-accent:hover {
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
    transform: translateY(-1px);
}

/* 边框按钮 */
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-bg);
}

/* 危险按钮 */
.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #DC2626 100%);
    color: white;
}

.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* 按钮尺寸 */
.btn-sm {
    padding: 6px 14px;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-block {
    width: 100%;
}

/* 图标按钮 */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

/* ==================== 状态徽章 ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.4;
}

.badge-primary {
    background: var(--primary-bg);
    color: var(--primary);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-accent {
    background: var(--accent-bg);
    color: var(--accent);
}

/* 状态点 */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.active { background: var(--success); }
.status-dot.pending { background: var(--warning); }
.status-dot.inactive { background: var(--text-light); }

/* ==================== 表单元素 ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder {
    color: var(--text-light);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* ==================== 表格样式 ==================== */
.table-wrapper {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.table thead {
    background: var(--bg-secondary);
}

.table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-secondary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ==================== 导航栏 ==================== */
.navbar {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-light);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    gap: 24px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.navbar-brand img {
    height: 36px;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.navbar-menu a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.navbar-menu a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.navbar-menu a.active {
    background: var(--primary-bg);
    color: var(--primary);
}

/* 移动端菜单按钮 - 桌面端隐藏 */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0.5rem;
    line-height: 1;
}

/* ==================== 网格布局 ==================== */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ==================== 新闻/商品卡片 ==================== */
.news-card,
.goods-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
}

.news-card:hover,
.goods-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: transparent;
}

.news-card-image,
.goods-card-image {
    position: relative;
    padding-top: 66.67%;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.news-card-image img,
.goods-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.news-card:hover .news-card-image img,
.goods-card:hover .goods-card-image img {
    transform: scale(1.05);
}

.news-card-body,
.goods-card-body {
    padding: 20px;
}

.news-card-title,
.goods-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.news-card-meta,
.goods-card-meta {
    font-size: 0.8125rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 价格样式 */
.goods-card-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--danger);
    margin-top: 12px;
}

.goods-card-price span {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-light);
    text-decoration: line-through;
    margin-left: 8px;
}

/* ==================== 状态容器 ==================== */
.status-card {
    padding: 20px;
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    text-align: center;
}

.status-card-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.status-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.status-card-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    max-width: 320px;
    margin: 0 auto;
}

/* ==================== 加载动画 ==================== */
.loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-light) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 0;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: var(--transition-fast);
}

.pagination a:hover {
    background: var(--bg-tertiary);
    border-color: var(--border);
    color: var(--text-primary);
}

.pagination .active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ==================== 面包屑导航 ==================== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb-separator {
    color: var(--text-light);
}

.breadcrumb .current {
    color: var(--text-primary);
    font-weight: 500;
}

/* ==================== 工具类 ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.bg-primary { background: var(--primary-bg); }
.bg-success { background: var(--success-bg); }
.bg-warning { background: var(--warning-bg); }
.bg-danger { background: var(--danger-bg); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.hidden { display: none; }
.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* ==================== 响应式断点 ==================== */
@media (max-width: 1200px) {
    .container { padding: 0 16px; }
}

@media (max-width: 768px) {
    html { font-size: 15px; }
    
    .navbar-inner { flex-wrap: wrap; }
    
    .navbar-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        flex-direction: column;
        padding: 12px;
        border-top: 1px solid var(--border-light);
        box-shadow: var(--shadow-md);
        z-index: 1000;
    }
    
    .navbar-menu.active { display: flex; }
    
    .mobile-menu-btn { display: block; }
    
    /* 导航遮罩层 */
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
    }
    
    .nav-overlay.active { display: block; }
    
    .card-body { padding: 16px; }
    
    .table th,
    .table td { padding: 12px 8px; font-size: 0.875rem; }
    
    .section-title { font-size: 1.125rem; }
}

@media (max-width: 480px) {
    html { font-size: 14px; }
    
    .btn { padding: 10px 16px; }
    .btn-lg { padding: 12px 20px; }
    
    .card-body { padding: 12px; }
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ==================== 选中文字 ==================== */
::selection {
    background: var(--primary);
    color: white;
}

/* ==================== 焦点元素 ==================== */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ==================== 打印样式 ==================== */
@media print {
    .navbar,
    .btn,
    .pagination {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
