/* ============================================
   统一页面布局样式系统
   ============================================ */

/* 统一页面容器 - 所有页面使用相同的基础结构 */
.page-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    min-height: 0; /* 允许flex子元素收缩 */
}

.page-container .container-xl {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

/* 页面标题区域 */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1, .page-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
}

/* 统一卡片系统 */
.unified-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.unified-card:hover {
    box-shadow: var(--shadow-md);
}

.unified-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.unified-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.unified-card-body {
    padding: 1.5rem;
}

/* 网格布局系统 */
.grid-container {
    display: grid;
    gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* 统一按钮系统 */
.unified-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.unified-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.unified-btn-primary {
    background: var(--primary-color);
    color: white;
}

.unified-btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.unified-btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.unified-btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
}

/* 统一表单系统 */
.unified-form-group {
    margin-bottom: 1.5rem;
}

.unified-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.unified-form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition);
}

.unified-form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.unified-form-input::placeholder {
    color: var(--text-muted);
}

/* 统一表格系统 */
.unified-table-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.unified-table {
    width: 100%;
    border-collapse: collapse;
}

.unified-table thead {
    background: var(--bg-secondary);
}

.unified-table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.unified-table td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.unified-table tbody tr:hover {
    background: var(--bg-secondary);
}

/* 状态标签系统 */
.unified-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.unified-badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.unified-badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #D97706;
}

.unified-badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #DC2626;
}

.unified-badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #2563EB;
}

/* 加载状态 */
.unified-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.unified-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.unified-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
    text-align: center;
}

.unified-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .page-container .container-xl {
        padding: 1rem 0.75rem;
    }

    .unified-card-body,
    .unified-card-header {
        padding: 1rem;
    }

    .unified-table th,
    .unified-table td {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .page-container {
        background: #0f172a;
    }
}