/* ============================================================
   AI极速备课工具 - 全局样式
   ============================================================ */

:root {
    --primary: #2E7D32;
    --primary-light: #4CAF50;
    --primary-bg: #E8F5E9;
    --accent: #FF6F00;
    --accent-bg: #FFF3E0;
    --text: #212121;
    --text-secondary: #616161;
    --bg: #FAFAFA;
    --card-bg: #FFFFFF;
    --border: #E0E0E0;
    --border-focus: #2E7D32;
    --error: #D32F2F;
    --error-bg: #FFEBEE;
    --success: #2E7D32;
    --success-bg: #E8F5E9;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   导航栏
   ============================================================ */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-quota {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--primary-bg);
    padding: 4px 12px;
    border-radius: 20px;
}
.nav-user {
    font-size: 14px;
    font-weight: 500;
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-light); }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-bg); }
.btn-text {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}
.btn-text:hover { color: var(--text); }
.btn-lg {
    padding: 12px 32px;
    font-size: 16px;
    border-radius: var(--radius);
}
.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

/* ============================================================
   主要内容区
   ============================================================ */
.main-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

/* 英雄区 */
.hero {
    text-align: center;
    padding: 36px 0 28px;
}
.hero h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}
.highlight {
    color: var(--primary);
    background: var(--primary-bg);
    padding: 2px 8px;
    border-radius: 4px;
}
.hero-sub {
    margin-top: 12px;
    font-size: 15px;
    color: var(--text-secondary);
}

/* ============================================================
   场景选择卡片
   ============================================================ */
.scene-select {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}
.scene-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.scene-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.scene-card.selected {
    border-color: var(--color, var(--primary));
    box-shadow: 0 0 0 3px rgba(46,125,50,0.12);
}
.scene-card.coming-soon {
    opacity: 0.55;
    cursor: default;
}
.scene-card.coming-soon:hover {
    transform: none;
    box-shadow: var(--shadow);
    border-color: var(--border);
}
.scene-card .scene-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    background: #F5F5F5;
    color: #999;
    font-weight: 500;
}
.scene-card .scene-icon {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}
.scene-card .scene-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}
.scene-card .scene-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
/* 选中时对应颜色 */
.scene-card.selected .scene-title {
    color: var(--color, var(--primary));
}
/* 表单区域初始隐藏 */
#form-section { display: none; }
#form-section.visible { display: block; }
/* 场景提示条 */
.scene-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin: 16px 0 0;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}
.scene-hint.public {
    background: #FFF3E0;
    color: #E65100;
    border: 1px solid #FFE0B2;
}
.form-section { margin-top: 12px; }
.form-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
}
.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.form-header h2 {
    font-size: 20px;
    font-weight: 600;
}
.form-badge {
    font-size: 12px;
    color: var(--primary);
    background: var(--primary-bg);
    padding: 4px 12px;
    border-radius: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group.full-width { grid-column: 1 / -1; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.required { color: var(--error); }
.optional { color: var(--text-secondary); font-weight: 400; font-size: 12px; }

input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.15s;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(46,125,50,0.1);
}
select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23616161' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea { resize: vertical; }

.form-actions {
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.quota-hint {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 错误提示 */
.error-msg {
    margin-top: 12px;
    padding: 10px 16px;
    background: var(--error-bg);
    color: var(--error);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

/* 生成中 */
.generating {
    text-align: center;
    padding: 40px 0 20px;
}
.generating p {
    margin-top: 16px;
    font-size: 15px;
    color: var(--text-secondary);
}
.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 3px solid var(--primary-bg);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   激活码区
   ============================================================ */
.redeem-section { margin-top: 24px; }
.redeem-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 32px;
}
.redeem-card h3 {
    font-size: 16px;
    margin-bottom: 12px;
}
.redeem-row {
    display: flex;
    gap: 12px;
}
.redeem-row input {
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: monospace;
}
#redeem-msg {
    margin-top: 10px;
    font-size: 13px;
}

/* ============================================================
   历史记录
   ============================================================ */
.history-section { margin-top: 32px; }
.history-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
}
.history-list {
    display: grid;
    gap: 8px;
}
.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s;
}
.history-item:hover { border-color: var(--primary); }
.history-item .hi-left { display: flex; align-items: center; gap: 12px; }
.history-badge {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 20px;
    background: var(--primary-bg);
    color: var(--primary);
}
.hi-time { font-size: 12px; color: var(--text-secondary); }

/* ============================================================
   结果页
   ============================================================ */
.result-header {
    text-align: center;
    padding: 24px 0;
}
.result-header h1 {
    font-size: 24px;
    margin: 12px 0;
}
.result-badge {
    display: inline-block;
    font-size: 12px;
    padding: 3px 12px;
    border-radius: 20px;
    background: var(--primary-bg);
    color: var(--primary);
    margin: 0 4px;
}
.result-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.result-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}
.tab-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.tab-btn:hover { color: var(--text); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.content-body {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 32px;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: center;
}

.disclaimer {
    margin-top: 24px;
    padding: 14px 20px;
    background: var(--accent-bg);
    color: var(--accent);
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-align: center;
}

/* ============================================================
   认证页面
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}
.auth-card h1 {
    font-size: 22px;
    text-align: center;
    color: var(--primary);
}
.auth-sub {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin: 8px 0 28px;
}
.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}
.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* ============================================================
   弹窗
   ============================================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 36px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}
.modal-card h2 {
    font-size: 20px;
    margin-bottom: 24px;
}
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-card { padding: 24px 20px; }
    .hero h1 { font-size: 22px; }
    .nav-inner { padding: 0 16px; }
    .main-content { padding: 24px 16px 60px; }
    .result-tabs { overflow-x: auto; }
    .tab-btn { padding: 10px 14px; font-size: 13px; white-space: nowrap; }
    .content-body { padding: 20px; }
    .scene-select { grid-template-columns: 1fr; }
    .scene-card { padding: 20px 18px; }
    .result-actions { flex-wrap: wrap; }
}

/* ============================================================
   底部版权
   ============================================================ */
.site-footer {
    text-align: center;
    padding: 32px 0 24px;
    font-size: 13px;
    color: var(--text-secondary);
}
.site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}
.site-footer a:hover {
    color: var(--primary);
}
.site-footer span {
    margin: 0 8px;
}
.footer-text { color: var(--text-disabled); }
