/* 阑尾炎诊疗智能体学习系统 - 移动端优先响应式样式 */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

/* 容器 */
.container {
    max-width: 768px;
    margin: 0 auto;
    padding: 1rem;
}

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card-header {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 表单 */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 导航栏 */
.navbar {
    background: var(--card-bg);
    padding: 1rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.navbar-brand {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.navbar-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.875rem;
}

.navbar-link:hover {
    color: var(--primary-color);
}

/* 登录页面 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.login-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.login-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* 主页模式选择 */
.mode-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 480px) {
    .mode-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.mode-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    text-decoration: none;
    color: inherit;
}

.mode-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.mode-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.mode-desc {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* 数据源列表 */
.source-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.source-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-color);
}

.source-item:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.source-info h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.source-info p {
    font-size: 0.75rem;
    color: var(--text-light);
}

.source-arrow {
    color: var(--text-light);
    font-size: 1.25rem;
}

/* 聊天界面 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
}

.chat-header {
    background: var(--card-bg);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-back {
    color: var(--text-light);
    text-decoration: none;
    font-size: 1.5rem;
}

.chat-title {
    font-size: 1rem;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-user {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message-assistant {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message-system {
    background: var(--warning-color);
    color: white;
    align-self: center;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

.chat-input-container {
    background: var(--card-bg);
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 1rem;
    resize: none;
    max-height: 120px;
}

.chat-send {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.chat-send:disabled {
    background: var(--text-light);
}

/* 考试相关 */
.exam-info {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.exam-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    margin-right: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: white;
    border-radius: 4px;
    transition: width 0.3s;
}

.judge-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
}

.judge-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
}

.judge-title {
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
}

/* 评分结果 */
.score-card {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 1rem;
}

.score-total {
    font-size: 4rem;
    font-weight: 700;
}

.score-label {
    font-size: 1rem;
    opacity: 0.9;
}

.score-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.score-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.score-item-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.score-item-label {
    font-size: 0.75rem;
    color: var(--text-light);
}

.feedback-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
}

.feedback-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feedback-content {
    color: var(--text-light);
    line-height: 1.6;
}

/* 管理后台 */
.admin-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.admin-nav a {
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.875rem;
}

.admin-nav a.active {
    background: var(--primary-color);
    color: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* 表格 */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-color);
    font-weight: 600;
}

.data-table tr:hover {
    background: rgba(37, 99, 235, 0.05);
}

/* 排行榜 */
.ranking-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 0.5rem;
}

.ranking-position {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 1rem;
}

.ranking-position.gold {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.ranking-position.silver {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    color: white;
}

.ranking-position.bronze {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: white;
}

.ranking-position.normal {
    background: var(--bg-color);
    color: var(--text-light);
}

.ranking-info {
    flex: 1;
}

.ranking-name {
    font-weight: 600;
}

.ranking-detail {
    font-size: 0.75rem;
    color: var(--text-light);
}

.ranking-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

/* 实时点评卡片 */
.feedback-stream {
    max-height: 400px;
    overflow-y: auto;
}

.feedback-item {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.feedback-user {
    font-weight: 600;
}

.feedback-score {
    color: var(--primary-color);
    font-weight: 600;
}

.feedback-text {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* 加载动画 */
.loading {
    display: inline-flex;
    gap: 4px;
}

.loading span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.loading span:nth-child(1) { animation-delay: -0.32s; }
.loading span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* 工具类 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.hidden { display: none; }
