/**
 * 卷换卷子系统 - 样式表
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --dark-color: #2c3e50;
    --gray-color: #95a5a6;
    --light-gray: #ecf0f1;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 30px 0;
    box-shadow: var(--shadow);
}

.header .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.logo {
    font-size: 2em;
    font-weight: 700;
}

.tagline {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Main */
.main {
    flex: 1;
    padding: 30px 0;
}

/* Actions */
.actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

/* Filters */
.filters {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-select,
.filter-input {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    min-width: 150px;
}

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

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
}

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

.btn-secondary:hover {
    background-color: #27ae60;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: #666;
}

.btn-outline:hover {
    background-color: var(--light-gray);
}

.btn-download {
    background-color: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    font-size: 13px;
}

.btn-download:hover {
    background-color: #27ae60;
}

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

/* Resource List */
.resource-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.resource-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}

.resource-card:hover {
    transform: translateY(-2px);
}

.resource-info {
    flex: 1;
}

.resource-title {
    font-size: 1.1em;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.resource-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.badge {
    background-color: var(--primary-color);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.badge-secondary {
    background-color: var(--secondary-color);
}

.meta-text {
    color: var(--gray-color);
    font-size: 13px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    color: var(--gray-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow: auto;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray-color);
}

.modal-close:hover {
    color: var(--dark-color);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--dark-color);
}

.download-resource-title {
    background: var(--light-gray);
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    color: var(--dark-color);
}

/* Form */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

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

.form-control-file {
    width: 100%;
    padding: 10px;
    border: 1px dashed var(--border-color);
    border-radius: 4px;
}

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

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.form-result {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
}

.form-result.success {
    background-color: #d4edda;
    color: #155724;
}

.form-result.error {
    background-color: #f8d7da;
    color: #721c24;
}

.loading {
    color: var(--primary-color);
}

/* Footer */
.footer {
    background-color: var(--dark-color);
    color: white;
    padding: 20px 0;
    text-align: center;
    margin-top: auto;
}

/* Admin Styles */
.admin-body {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background-color: var(--dark-color);
    color: white;
    padding: 20px 0;
    position: fixed;
    height: 100%;
}

.sidebar h2 {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin: 0;
}

.sidebar-nav a {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: background 0.3s;
}

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

.admin-content {
    flex: 1;
    margin-left: 240px;
    padding: 20px;
    background-color: #f5f7fa;
}

.admin-header {
    background: white;
    padding: 15px 20px;
    margin: -20px -20px 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    color: var(--gray-color);
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 2em;
    font-weight: 700;
    color: var(--dark-color);
}

/* Tables */
.table-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: var(--light-gray);
    font-weight: 600;
    color: var(--dark-color);
}

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

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-approved {
    background-color: #d4edda;
    color: #155724;
}

.status-rejected {
    background-color: #f8d7da;
    color: #721c24;
}

/* Admin Forms */
.admin-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 600px;
}

.admin-form h2 {
    margin-bottom: 20px;
    color: var(--dark-color);
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--dark-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination a {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--dark-color);
}

.pagination a.active,
.pagination a:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

    .filter-select,
    .filter-input {
        width: 100%;
    }

    .resource-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .sidebar {
        width: 60px;
        overflow: hidden;
    }

    .sidebar h2,
    .sidebar a span {
        display: none;
    }

    .admin-content {
        margin-left: 60px;
    }
}

/* Help Modal */
.help-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}
.help-btn:hover {
    background-color: var(--primary-dark);
}

/* Missing Resources Section */
.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark-color);
    margin: 40px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.missing-resources-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 3px dashed var(--border-color);
}

.missing-list {
    background-color: #fff9f0;
    border: 1px solid #ffe4b5;
    border-radius: 8px;
    padding: 15px;
}

.missing-card {
    background-color: #fff;
    border: 1px solid #ffd700;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
}

.missing-card .resource-title {
    color: #d35400;
}

.status-text {
    color: #e67e22;
    font-weight: 500;
    font-size: 14px;
}

.badge-warning {
    background-color: #f39c12;
    color: white;
}

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

.help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    overflow: auto;
}

.help-content {
    position: relative;
    width: 90%;
    max-width: 800px;
    margin: 40px auto;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    max-height: calc(100vh - 80px);
    overflow: hidden;
}

.help-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    z-index: 10000;
    line-height: 1;
}
.help-close:hover {
    color: #333;
}

.help-content iframe {
    width: 100%;
    height: calc(100vh - 120px);
    min-height: 500px;
    border: none;
    display: block;
}

@media (max-width: 768px) {
    .help-content {
        width: 95%;
        margin: 20px auto;
    }
    .help-content iframe {
        height: calc(100vh - 100px);
    }
}
