/* 管理后台样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #8B6914;
    --primary-light: #B8860B;
    --primary-dark: #5C4033;
    --bg-color: #f5f0e8;
    --card-bg: #fffef9;
    --text-color: #3E2C1C;
    --text-light: #8B7355;
    --border-color: rgba(184, 134, 11, 0.15);
    --success-color: #43A047;
    --danger-color: #E53935;
    --warning-color: #FF9800;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* ====== 登录页面 ====== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f0e8 0%, #e8e0d0 100%);
    position: relative;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%238b6914' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.login-box {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 50px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 40px rgba(139, 105, 20, 0.1);
    border: 1px solid var(--border-color);
    position: relative;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(139, 105, 20, 0.25);
}

.logo-icon {
    font-size: 40px;
    color: #fff;
    font-family: 'KaiTi', 'STKaiti', serif;
}

.login-header h1 {
    font-size: 28px;
    color: var(--primary-dark);
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.login-header p {
    font-size: 16px;
    color: var(--text-light);
}

.login-form .form-group {
    margin-bottom: 24px;
}

.login-form label {
    display: block;
    font-size: 14px;
    color: var(--text-color);
    margin-bottom: 8px;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fff;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(184, 134, 11, 0.1);
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 105, 20, 0.3);
}

/* ====== 管理后台布局 ====== */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* ====== 侧边栏 ====== */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #fffef9 0%, #f5f0e8 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    font-family: 'KaiTi', 'STKaiti', serif;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-dark);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(184, 134, 11, 0.05);
    color: var(--primary-color);
}

.nav-item.active {
    background: rgba(184, 134, 11, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-light);
}

.nav-icon {
    font-size: 20px;
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-footer span {
    font-size: 14px;
    color: var(--text-light);
}

.sidebar-footer a {
    font-size: 14px;
    color: var(--danger-color);
    text-decoration: none;
}

.sidebar-footer a:hover {
    text-decoration: underline;
}

/* ====== 主内容区 ====== */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h2 {
    font-size: 28px;
    color: var(--primary-dark);
    font-weight: 600;
}

/* ====== 按钮样式 ====== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 105, 20, 0.25);
}

.btn-secondary {
    padding: 12px 24px;
    background: #f0f0f0;
    color: var(--text-color);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    padding: 12px 24px;
    background: var(--danger-color);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: #c62828;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.btn-edit {
    background: rgba(67, 160, 71, 0.1);
    color: var(--success-color);
}

.btn-edit:hover {
    background: var(--success-color);
    color: #fff;
}

.btn-delete {
    background: rgba(229, 57, 53, 0.1);
    color: var(--danger-color);
}

.btn-delete:hover {
    background: var(--danger-color);
    color: #fff;
}

/* ====== 难度标签 ====== */
.difficulty-tabs {
    display: flex;
    gap: 16px;
    margin-bottom: 30px;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 20px;
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn:hover {
    border-color: var(--primary-light);
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(184, 134, 11, 0.1), rgba(184, 134, 11, 0.05));
    border-color: var(--primary-light);
    box-shadow: 0 4px 15px rgba(184, 134, 11, 0.1);
}

.tab-icon {
    font-size: 22px;
}

.tab-btn span:nth-child(2) {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-color);
}

.tab-count {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--primary-light);
    color: #fff;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ====== 题目列表 ====== */
.question-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.question-item {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.question-item:hover {
    box-shadow: 0 6px 20px rgba(139, 105, 20, 0.08);
    border-color: rgba(184, 134, 11, 0.3);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.question-info {
    flex: 1;
}

.question-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.question-meta {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--text-light);
}

.question-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.question-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.type-nextline {
    background: rgba(76, 175, 80, 0.1);
    color: #2E7D32;
}

.type-author {
    background: rgba(33, 150, 243, 0.1);
    color: #1565C0;
}

.type-title {
    background: rgba(156, 39, 176, 0.1);
    color: #7B1FA2;
}

.question-content {
    background: rgba(255, 248, 220, 0.4);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.question-poem {
    font-size: 17px;
    color: var(--text-color);
    line-height: 1.8;
    font-weight: 500;
}

.question-answer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.answer-label {
    font-size: 14px;
    color: var(--text-light);
}

.answer-value {
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 600;
}

.question-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.option-tag {
    padding: 8px 16px;
    background: #f5f5f5;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-color);
}

.option-tag.correct {
    background: rgba(76, 175, 80, 0.15);
    color: #2E7D32;
    font-weight: 500;
}

.question-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ====== 弹窗 ====== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-small .modal-content {
    max-width: 400px;
}

.modal-large .modal-content {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    color: var(--primary-dark);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f0f0f0;
    color: var(--text-color);
}

.modal-body {
    padding: 30px;
    text-align: center;
}

.modal-body p {
    font-size: 16px;
    color: var(--text-color);
    line-height: 1.6;
}

.modal-form {
    padding: 30px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(184, 134, 11, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    display: block;
    font-size: 13px;
    color: var(--text-light);
    margin-top: 6px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
}

/* ====== 空状态 ====== */
.empty-state {
    text-align: center;
    padding: 80px 40px;
}

.empty-state-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--text-color);
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 15px;
    color: var(--text-light);
}

/* ====== AI导入样式 ====== */
.import-container {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.preview-section {
    border-top: 1px solid var(--border-color);
    padding: 24px 30px;
    flex: 1;
    min-height: 300px;
    overflow-y: auto;
}

.import-section {
    padding: 30px;
}

.import-difficulty-select {
    margin-bottom: 24px;
}

.import-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
}

.difficulty-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.difficulty-radio {
    cursor: pointer;
}

.difficulty-radio input {
    display: none;
}

.radio-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.difficulty-radio:hover .radio-box {
    border-color: var(--primary-light);
}

.difficulty-radio input:checked + .radio-box {
    border-color: var(--primary-light);
    background: linear-gradient(135deg, rgba(184, 134, 11, 0.1), rgba(184, 134, 11, 0.05));
    box-shadow: 0 4px 12px rgba(184, 134, 11, 0.15);
}

.radio-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.radio-text {
    font-size: 13px;
    color: var(--text-color);
    font-weight: 500;
}

.import-textarea {
    width: 100%;
    min-height: 300px;
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.8;
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    transition: all 0.3s ease;
}

.import-textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(184, 134, 11, 0.1);
}

.import-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
    padding: 12px 16px;
    background: rgba(76, 175, 80, 0.08);
    border-radius: 8px;
    color: #2E7D32;
    font-size: 14px;
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 16px;
    font-size: 16px;
}

/* 预览区域 */
.preview-section {
    border-top: 1px solid var(--border-color);
    padding: 24px 30px;
    max-height: 500px;
    overflow-y: auto;
}

.preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
    position: sticky;
    bottom: 0;
    background: var(--card-bg);
    padding-bottom: 20px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.preview-header h4 {
    font-size: 18px;
    color: var(--primary-dark);
}

.preview-stats {
    display: flex;
    gap: 16px;
}

.stat-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.stat-badge.primary {
    background: rgba(76, 175, 80, 0.1);
    color: #2E7D32;
}

.stat-badge.middle {
    background: rgba(33, 150, 243, 0.1);
    color: #1565C0;
}

.stat-badge.high {
    background: rgba(156, 39, 176, 0.1);
    color: #7B1FA2;
}

.stat-badge.university {
    background: rgba(255, 152, 0, 0.1);
    color: #E65100;
}

.preview-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.preview-item {
    background: #f8f8f8;
    border-radius: 12px;
    padding: 16px 20px;
    border: 1px solid var(--border-color);
}

.preview-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.preview-item-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-dark);
}

.preview-item-type {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.preview-item-type.nextLine {
    background: rgba(76, 175, 80, 0.1);
    color: #2E7D32;
}

.preview-item-type.author {
    background: rgba(33, 150, 243, 0.1);
    color: #1565C0;
}

.preview-item-type.title {
    background: rgba(156, 39, 176, 0.1);
    color: #7B1FA2;
}

.preview-item-content {
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.6;
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(255, 248, 220, 0.3);
    border-radius: 8px;
}

.preview-item-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preview-option {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-color);
}

.preview-option.correct {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
    color: #2E7D32;
    font-weight: 500;
}

.preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* ====== 响应式 ====== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: fixed;
        bottom: 0;
        top: auto;
        height: auto;
        z-index: 100;
        flex-direction: row;
        padding: 10px 0;
    }

    .sidebar-header,
    .sidebar-footer {
        display: none;
    }

    .sidebar-nav {
        display: flex;
        justify-content: space-around;
        width: 100%;
        padding: 0;
    }

    .nav-item {
        flex-direction: column;
        padding: 8px;
        border-left: none;
    }

    .nav-item span:last-child {
        font-size: 12px;
    }

    .main-content {
        margin-left: 0;
        margin-bottom: 70px;
        padding: 20px;
    }

    .difficulty-tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1 1 calc(50% - 8px);
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}
