/**
 * Lucky Draw 后台管理页面通用样式
 * 适用于所有 backend/pages 页面
 */

/* 页面容器 */
.page-wrapper {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* 页面头部 */
.page-header {
    margin-bottom: 30px;
    padding: 0 5px;
}

.page-header h2 {
    font-size: 28px;
    color: #1a1a1a;
    margin-bottom: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header p {
    color: #666;
    font-size: 14px;
}

/* 内容卡片 */
.content-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    padding: 24px;
    background: linear-gradient(to right, #f8f9fa, #fff);
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.card-header h3 {
    font-size: 18px;
    color: #1a1a1a;
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 数据表格 */
.data-table {
    overflow-x: auto;
}

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

.data-table th {
    background: #fafbfc;
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 13px;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: #f8f9ff;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* 徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    gap: 4px;
    white-space: nowrap;
}

.badge.active, .badge.enabled {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.badge.inactive, .badge.disabled {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

.badge.pending {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
}

.badge.consumed {
    background: linear-gradient(135deg, #e3e3e3 0%, #d4d4d4 100%);
    color: #666;
}

.badge.expired {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

.badge.wheel {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #0d47a1;
}

.badge.grid {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    color: #4a148c;
}

.badge.physical {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #e65100;
}

.badge.virtual {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
}

.badge.coupon {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%);
    color: #880e4f;
}

.badge.none {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    color: #757575;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.4;
    filter: grayscale(100%);
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 24px;
    color: #666;
}

/* 加载状态 */
.loading-container {
    text-align: center;
    padding: 40px 20px;
}

.loading {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 12px;
    color: #999;
    font-size: 14px;
}

/* 过滤器组 */
.filter-group {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    padding: 20px 24px;
    background: #fafbfc;
    border-bottom: 1px solid #e9ecef;
}

.filter-group label {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 链接输入组 */
.link-group {
    margin-bottom: 20px;
}

.link-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.link-input-group {
    display: flex;
    gap: 10px;
}

.link-input-group input {
    flex: 1;
    padding: 11px 14px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    color: #495057;
}

.link-input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: #fff;
}

/* 图片预览 */
.image-preview {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.image-preview:hover {
    transform: scale(2.5);
    z-index: 100;
}

.upload-preview {
    width: 120px;
    height: 120px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-preview:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.upload-preview .placeholder {
    font-size: 48px;
    color: #ccc;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background: #fff;
    border: 2px solid #f0f0f0;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.stat-item .icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.stat-item .content {
    flex: 1;
}

.stat-item .label {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.stat-item .value {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

/* 颜色选择器 */
.color-picker-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker-group input[type="color"] {
    width: 50px;
    height: 40px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
}

.color-picker-group input[type="text"] {
    width: 120px;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .page-header h2 {
        font-size: 24px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .card-actions {
        width: 100%;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
    
    .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* 打印优化 */
@media print {
    .page-header {
        margin-bottom: 20px;
    }
    
    .card-header,
    .filter-group {
        display: none;
    }
    
    .content-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .badge {
        border: 1px solid currentColor;
    }
    
    .btn {
        display: none;
    }
}
