/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================
   头部样式 - 修复导航换行问题
   ============================================ */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    flex-wrap: nowrap;      /* ✅ 不换行 */
    gap: 20px;
}

.header h1 {
    font-size: 22px;         /* ✅ 从24px减小到22px */
    font-weight: 600;
    white-space: nowrap;     /* ✅ 标题不换行 */
    flex-shrink: 0;          /* ✅ 标题不压缩 */
}

.nav {
    display: flex;
    gap: 6px;                /* ✅ 从15px减小到6px */
    flex-wrap: nowrap;       /* ✅ 不换行 */
    align-items: center;
    overflow-x: auto;        /* ✅ 溢出时横向滚动 */
    scrollbar-width: none;   /* Firefox 隐藏滚动条 */
    -ms-overflow-style: none;/* IE 隐藏滚动条 */
}

.nav::-webkit-scrollbar {
    display: none;           /* Chrome/Safari 隐藏滚动条 */
}

.nav a {
    color: white;
    text-decoration: none;
    padding: 8px 14px;       /* ✅ 从8px 16px减小到8px 14px */
    border-radius: 5px;
    transition: background-color 0.3s;
    white-space: nowrap;     /* ✅ 文字不换行 */
    font-size: 14px;         /* ✅ 统一字号 */
    flex-shrink: 0;          /* ✅ 不压缩 */
}

.nav a:hover,
.nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
}

.nav .logout-link {
    color: #fed7d7;
}

.nav .logout-link:hover {
    background-color: rgba(252, 129, 129, 0.3);
    color: white;
}

/* 筛选区域 */
.filter-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.filter-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-group {
    flex: 1;
    min-width: 150px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: white;
}

.btn-primary {
    background: #667eea;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: #48bb78;
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: #fc8181;
}

.btn-danger:hover {
    background: #f56565;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* 作业列表 */
.homework-list {
    display: grid;
    gap: 20px;
}

.homework-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}

.homework-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.homework-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.homework-header h2 {
    font-size: 18px;
}

.homework-header h2 a {
    color: #333;
    text-decoration: none;
}

.homework-header h2 a:hover {
    color: #667eea;
}

.subject-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #e9d8fd;
    color: #6b46c1;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.homework-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.homework-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 10px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.homework-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remaining-time {
    font-weight: 500;
    color: #667eea;
}

/* 状态徽章 */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active {
    background: #c6f6d5;
    color: #22543d;
}

.status-badge.ended {
    background: #feb2b2;
    color: #742a2a;
}

.status-badge.submitted {
    background: #bee3f8;
    color: #2a4365;
}

.status-badge.graded {
    background: #c6f6d5;
    color: #22543d;
}

.status-badge.late {
    background: #fbd38d;
    color: #744210;
}

.status-badge.pending {
    background: #e2e8f0;
    color: #2d3748;
}

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

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

/* 分页 */
.pagination-wrapper {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 5px;
    list-style: none;
}

.pagination li {
    display: inline;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.pagination a:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination .active span {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 详情页 */
.homework-detail {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.detail-header h2 {
    font-size: 24px;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.detail-description {
    margin: 25px 0;
}

.detail-description h3 {
    margin-bottom: 15px;
    color: #555;
}

.description-content {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    line-height: 1.8;
}

.detail-attachment {
    margin: 20px 0;
}

.action-section {
    margin: 25px 0;
    text-align: center;
}

.submissions-section {
    margin-top: 30px;
}

.submissions-section h3 {
    margin-bottom: 15px;
}

/* 表格 */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* 表单 */
.form-container {
    max-width: 800px;
    margin: 0 auto;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

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

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

/* ============================================
   响应式设计 - 修复导航栏显示
   ============================================ */
@media (max-width: 900px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .nav {
        flex-wrap: wrap;      /* ✅ 小屏幕换行 */
        width: 100%;
        overflow-x: visible;
    }
    
    .nav a {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .filter-form {
        flex-direction: column;
    }

    .form-group {
        min-width: 100%;
    }

    .homework-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .homework-meta {
        flex-direction: column;
        gap: 5px;
    }

    .meta-grid {
        grid-template-columns: 1fr;
    }

    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 15px 20px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .nav a {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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



/* ============================================
   引入上传模态框样式
   ============================================ */
@import url('upload-modal.css');

/* 上传按钮样式增强 */
.btn-upload {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-upload:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-upload:active {
    transform: translateY(0);
}

.btn-upload .upload-icon {
    font-size: 20px;
}


/* ============================================
   自定义分页样式（圆角方块，沿用原 .pagination 风格）
   ============================================ */
.pagination-wrapper {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination-wrapper a,
.pagination-wrapper span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    user-select: none;
}

.pagination-wrapper a:hover {
    background: #f7fafc;
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

.pagination-wrapper a:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.pagination-wrapper span.current {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
}

.pagination-wrapper span.disabled {
    color: #cbd5e0;
    background: #f7fafc;
    border-color: #edf2f7;
    cursor: not-allowed;
    box-shadow: none;
}

.pagination-wrapper span.ellipsis {
    background: transparent;
    border: none;
    color: #a0aec0;
    box-shadow: none;
    min-width: 24px;
    padding: 0 4px;
}