/* English Buddy 后台配置页（M5，移动端适配） */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
    background: #f5f6fa;
    color: #2d3436;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

/* 头部 */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
}

.admin-header h1 { font-size: 18px; font-weight: 600; }

.back-btn {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
}

.child-tag {
    font-size: 12px;
    background: rgba(255,255,255,0.2);
    padding: 4px 8px;
    border-radius: 6px;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 主体 */
.admin-main {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 卡片 */
.card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.card h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px;
    color: #4a4a4a;
}

/* 表单 */
.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.field-row label {
    font-size: 14px;
    color: #555;
    flex-shrink: 0;
    margin-right: 12px;
}

.field-row input,
.field-row select {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
    background: #fafafa;
    color: #2d3436;
    -webkit-appearance: none;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
}

.btn-primary:active { opacity: 0.8; }

/* 掌握比例 */
.ratio-bars { display: flex; flex-direction: column; gap: 10px; }

.ratio-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ratio-label {
    font-size: 13px;
    font-weight: 600;
    width: 34px;
    flex-shrink: 0;
    text-align: center;
    padding: 2px 0;
    border-radius: 6px;
    color: #fff;
}

.ratio-track {
    flex: 1;
    height: 14px;
    background: #eee;
    border-radius: 7px;
    overflow: hidden;
}

.ratio-fill {
    height: 100%;
    border-radius: 7px;
    background: linear-gradient(90deg, #8b5cf6, #6366f1);
    transition: width 0.4s ease;
}

.ratio-num {
    font-size: 12px;
    color: #777;
    width: 70px;
    text-align: right;
    flex-shrink: 0;
}

/* 段位色 */
.lv-A1 { background: #60a5fa; }
.lv-A2 { background: #34d399; }
.lv-B1 { background: #fbbf24; }
.lv-B2 { background: #fb923c; }
.lv-C1 { background: #f87171; }
.lv-C2 { background: #a78bfa; }

.meta-line {
    margin-top: 12px;
    font-size: 13px;
    color: #888;
    text-align: center;
}

/* 词汇 */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.tab {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 8px;
    background: #eee;
    color: #666;
    font-size: 13px;
    cursor: pointer;
}

.tab.active {
    background: #6366f1;
    color: #fff;
}

.word-list {
    columns: 5 140px;          /* 多列：每列最小 140px，自动按宽度分列 */
    column-gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px 2px;
}

.word-chip {
    display: inline-block;     /* columns 布局下内联块避免断行 */
    width: 100%;
    margin-bottom: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    background: #f0f0f5;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.word-chip .wlv {
    font-size: 10px;
    color: #8b5cf6;
    margin-left: 4px;
    float: right;
}

.empty-hint { color: #aaa; font-size: 13px; }

/* 词汇分页 */
.word-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
}
.btn-mini {
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
}
.btn-mini:disabled { background: #ccc; cursor: not-allowed; }
.pager-info { font-size: 12px; color: #666; }

/* 会话 */
.session-list { display: flex; flex-direction: column; gap: 8px; }

.session-item {
    padding: 10px 12px;
    background: #f8f8fc;
    border-radius: 10px;
    font-size: 13px;
    color: #555;
}

.session-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.btn-view {
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-view:disabled { background: #bbb; }

.btn-play {
    background: #22c55e;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
}
.btn-play:hover { background: #16a34a; }

.conv-box {
    margin-top: 8px;
    border-top: 1px dashed #ddd;
    padding-top: 8px;
}

.conv-turn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}
.conv-child {
    background: #fff;
    border-left: 3px solid #7c3aed;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    color: #444;
}
.conv-ai {
    background: #efe9fb;
    border-left: 3px solid #a78bfa;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    color: #444;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 100;
}

.toast.show { opacity: 1; }
