/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
}

/* 顶部导航 */
.header {
    background: white;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.tenant-name {
    color: #667eea;
    font-weight: 500;
}

.user-menu {
    position: relative;
}

.user-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.3s;
}

.user-btn:hover {
    background: #f5f7fa;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    min-width: 150px;
    display: none;
    margin-top: 8px;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    transition: background 0.3s;
}

.user-dropdown a:hover {
    background: #f5f7fa;
}

/* 主容器 */
.main-container {
    display: flex;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: white;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.nav-menu {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item:hover {
    background: #f5f7fa;
    color: #667eea;
}

.nav-item.active {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 500;
}

.nav-item .icon {
    font-size: 20px;
}

/* 主内容区 */
.content {
    flex: 1;
    min-width: 0;
    margin-left: 240px;
    padding: 30px;
}

.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

.page-title {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    font-size: 40px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

/* 信息区域 */
.info-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.info-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.info-label {
    color: #666;
    min-width: 120px;
}

.info-value {
    color: #333;
    font-weight: 500;
}

/* 表格 */
.table-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f5f7fa;
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #ddd;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.data-table tbody tr:hover {
    background: #f9f9f9;
}

.text-center {
    text-align: center;
}

/* 配置网格 */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.config-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.config-card h4 {
    font-size: 16px;
    margin-bottom: 10px;
}

.config-card .config-info {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.config-card .config-actions {
    display: flex;
    gap: 10px;
}

/* 资源网格 */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.resource-card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.resource-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.resource-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
}

.resource-size {
    font-size: 12px;
    color: #666;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show,
.modal.active {
    display: flex;
}

.modal-dialog {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* 状态标签 */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* 响应式 */
/* 配置卡片样式 */
.config-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.config-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.config-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.config-header h4 {
    margin: 0;
    font-size: 18px;
    color: #333;
    flex: 1;
}

.config-info {
    margin-bottom: 15px;
    color: #666;
}

.config-info p {
    margin: 8px 0;
    font-size: 14px;
}

.config-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background: #667eea;
    color: white;
}

.badge-success {
    background: #48bb78;
    color: white;
}

.badge-secondary {
    background: #a0aec0;
    color: white;
}

.badge-warning {
    background: #ed8936;
    color: white;
}

.badge-danger {
    background: #f56565;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* 资源卡片样式 */
.resource-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.resource-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.resource-preview {
    width: 100%;
    height: 150px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.resource-icon {
    font-size: 48px;
}

.resource-info {
    padding: 15px;
}

.resource-info h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
}

.badge-info {
    background: #3182ce;
    color: white;
}

.resource-desc {
    font-size: 13px;
    color: #666;
    margin: 8px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.resource-date {
    font-size: 12px;
    color: #999;
    margin: 8px 0 0 0;
}

.resource-actions {
    padding: 0 15px 15px 15px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 上传进度条 */
.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

#upload-progress {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

#upload-status {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* 会员套餐 / 卡密管理 */
.membership-view-tabs {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 18px;
    padding: 4px;
    border: 1px solid #d9e0ea;
    border-radius: 6px;
    background: #eef2f7;
}

.membership-view-tab {
    min-width: 110px;
    padding: 9px 16px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #5b6472;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.membership-view-tab.active {
    background: #fff;
    color: #285ea8;
    box-shadow: 0 1px 3px rgba(31, 41, 55, 0.16);
}

.membership-panel[hidden] {
    display: none;
}

#page-student-membership,
.membership-panel {
    min-width: 0;
    max-width: 100%;
}

#membership-plan-view .data-table {
    min-width: 760px;
}

.membership-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.membership-section-header h3 {
    margin: 0 0 4px;
    font-size: 18px;
    color: #202938;
}

.membership-section-header p {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
}

.membership-card-filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 160px auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.membership-card-filters input,
.membership-card-filters select {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #d7dee8;
    border-radius: 4px;
    background: #fff;
    color: #283548;
    font-size: 14px;
}

.membership-table-scroll {
    overflow-x: auto;
}

.membership-table-scroll .data-table {
    min-width: 900px;
}

.membership-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 210px;
}

.membership-actions .btn {
    min-width: 54px;
}

.membership-code {
    color: #213b63;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    white-space: nowrap;
}

.membership-metric {
    font-weight: 700;
}

.membership-metric-unused {
    color: #285ea8;
}

.membership-metric-redeemed {
    color: #18815d;
}

.membership-pagination {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    min-height: 34px;
    margin-top: 12px;
}

.membership-page-button {
    width: 34px;
    height: 34px;
    border: 1px solid #d4dce8;
    border-radius: 4px;
    background: #fff;
    color: #344054;
    cursor: pointer;
}

.membership-page-button.active {
    border-color: #285ea8;
    background: #285ea8;
    color: #fff;
}

.modal-dialog.membership-modal-wide {
    width: min(1120px, 94vw);
    max-width: 1120px;
    overflow: hidden;
}

.membership-modal-wide .modal-body {
    max-height: 66vh;
    overflow-y: auto;
}

.membership-card-detail-table {
    max-height: 48vh;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .content {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        padding: 20px;
    }

    #page-student-membership .table-container {
        width: 100%;
        max-width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }

    .membership-section-header {
        align-items: stretch;
        flex-direction: column;
    }

    .membership-section-header .btn {
        width: 100%;
    }

    .membership-card-filters {
        grid-template-columns: 1fr;
    }

    .membership-view-tabs {
        display: flex;
        width: 100%;
    }

    .membership-view-tab {
        flex: 1;
        min-width: 0;
    }
}

