/* ========================================
   后台管理系统样式
   ======================================== */

/* 登录页面 */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--white);
    font-size: 36px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--gray);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--light-gray);
    border-radius: var(--border-radius);
    font-size: 15px;
    transition: var(--transition);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--light-gray);
}

.login-footer a {
    color: var(--gray);
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.login-footer a:hover {
    color: var(--primary-color);
}

/* 后台布局 */
.admin-body {
    background: #f5f7fa;
    min-height: 100vh;
}

.admin-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: var(--dark-color);
    color: var(--white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header i {
    font-size: 24px;
    color: var(--primary-color);
}

.sidebar-header span {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-nav {
    padding: 16px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: var(--white);
    background: rgba(255,255,255,0.05);
    border-left-color: var(--primary-color);
}

.sidebar-nav a i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--light-gray);
}

.content-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-color);
}

.user-info {
    color: var(--gray);
    font-size: 14px;
}

.content-body {
    max-width: 1200px;
}

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

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 24px;
}

.stat-info h3 {
    font-size: 14px;
    color: var(--gray);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-percent {
    font-size: 12px;
    color: var(--gray);
    margin-top: 4px;
}

/* 时间段统计 */
.time-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.time-stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.time-label {
    display: block;
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 8px;
}

.time-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-color);
}

/* 快捷操作 */
.quick-actions {
    margin-bottom: 24px;
}

.quick-actions h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--dark-color);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.action-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    text-decoration: none;
    color: var(--dark-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--primary-color);
}

.action-card i {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.action-card span {
    font-size: 14px;
    font-weight: 500;
}

/* 应用概览 */
.app-overview {
    margin-bottom: 24px;
}

.app-overview h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--dark-color);
}

.overview-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.overview-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--light-gray);
}

.overview-item:last-child {
    border-bottom: none;
}

.overview-item .label {
    color: var(--gray);
    font-size: 14px;
}

.overview-item .value {
    color: var(--dark-color);
    font-weight: 500;
    font-size: 14px;
    max-width: 60%;
}

/* 表格 */
.table-container {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--light-gray);
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray);
    text-transform: uppercase;
}

.data-table td {
    font-size: 14px;
}

.data-table tr:hover {
    background: #f8f9fa;
}

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

.badge.ios {
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF;
}

.badge.android {
    background: rgba(61, 220, 132, 0.1);
    color: #2E8B57;
}

.badge.other {
    background: var(--light-gray);
    color: var(--gray);
}

.badge.active {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success-color);
}

.badge.inactive {
    background: var(--light-gray);
    color: var(--gray);
}

/* 表单卡片 */
.form-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.form-card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--dark-color);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--light-gray);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--gray);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--light-gray);
    color: var(--dark-color);
}

.btn-secondary:hover {
    background: #e0e0e0;
}

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

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

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

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* 提示信息 */
.alert {
    padding: 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(52, 199, 89, 0.2);
}

.alert-error {
    background: rgba(255, 59, 48, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(255, 59, 48, 0.2);
}

/* 轮播图管理 */
.slides-list h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--dark-color);
}

.slides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.slide-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.slide-card:hover {
    box-shadow: var(--shadow-md);
}

.slide-card.inactive {
    opacity: 0.6;
}

.slide-image {
    position: relative;
    height: 160px;
    overflow: hidden;
}

.slide-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide-image .no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-gray);
    color: var(--gray);
    font-size: 48px;
}

.slide-status {
    position: absolute;
    top: 12px;
    right: 12px;
}

.slide-info {
    padding: 16px;
}

.slide-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--dark-color);
}

.slide-info p {
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 8px;
}

.slide-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--gray);
}

.slide-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--light-gray);
}

/* 文件上传 */
.file-upload {
    border: 2px dashed var(--light-gray);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    transition: var(--transition);
}

.file-upload:hover {
    border-color: var(--primary-color);
}

.file-preview {
    margin-top: 16px;
}

.file-preview img {
    max-width: 150px;
    max-height: 150px;
    border-radius: var(--border-radius);
}

.file-preview .no-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--gray);
}

.file-preview .no-image i {
    font-size: 48px;
}

/* 图表区域 */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.chart-card h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--dark-color);
}

.chart-card canvas {
    max-height: 300px;
}

/* 下载记录 */
.downloads-section {
    margin-bottom: 24px;
}

.downloads-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--dark-color);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
}

/* 工具类 */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .admin-container {
        flex-direction: column;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .slides-grid {
        grid-template-columns: 1fr;
    }
}
