/* ===== 学农乐园 (EduFarm) 全局样式 ===== */
:root {
    --green: #4caf50;
    --green-dark: #388e3c;
    --green-light: #e8f5e9;
    --amber: #ffb300;
    --amber-dark: #ff8f00;
    --brown: #795548;
    --brown-dark: #5d4037;
    --text: #2d3436;
    --text-light: #8b8b8b;
    --bg: #f5f9f2;
    --card: #ffffff;
    --shadow: 0 4px 16px rgba(0,0,0,0.08);
    --radius: 14px;
}

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

body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.app { display: flex; flex-direction: column; min-height: 100vh; }

/* ===== 顶部导航 ===== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 60px;
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    position: sticky;
    top: 0;
    z-index: 100;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { font-size: 26px; }
.brand-name { font-size: 20px; font-weight: 700; }
.brand-name small { font-weight: 400; font-size: 12px; opacity: 0.85; margin-left: 4px; }
.topbar-nav { display: flex; gap: 6px; }
.topbar-nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    transition: background 0.2s;
}
.topbar-nav a:hover { background: rgba(255,255,255,0.15); }
.topbar-nav a.active { background: rgba(255,255,255,0.25); font-weight: 600; }
.topbar-user { font-size: 14px; opacity: 0.95; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar-user .weather-chip,
.topbar-user .streak-chip {
    background: rgba(255,255,255,0.22);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.topbar-user .admin-badge {
    background: rgba(255,255,255,0.16);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.farm-type-badge {
    background: rgba(255,255,255,0.16);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* ===== 主内容 ===== */
.main { flex: 1; max-width: 1080px; width: 100%; margin: 0 auto; padding: 28px 20px 48px; }

.page-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; color: var(--brown-dark); }
.page-head p { color: var(--text-light); font-size: 14px; }

/* ===== 提示 ===== */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 14px;
}
.alert-error { background: #fdecea; color: #c62828; border: 1px solid #f5c6c6; }

/* ===== 学生卡片网格 ===== */
.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}
.student-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 2px solid transparent;
}
.student-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.12);
    border-color: var(--green-light);
}
.student-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--amber), var(--amber-dark));
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.student-info { flex: 1; min-width: 0; }
.student-name { font-size: 17px; font-weight: 700; margin-bottom: 3px; }
.student-id { font-size: 12px; color: var(--text-light); }
.student-coins {
    display: flex; align-items: center; gap: 4px;
    background: var(--green-light);
    padding: 6px 12px;
    border-radius: 20px;
}
.coin-icon { font-size: 16px; }
.coin-num { font-weight: 700; font-size: 17px; color: var(--green-dark); }
.coin-label { font-size: 12px; color: var(--text-light); }

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 70px 20px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.empty-icon { font-size: 60px; margin-bottom: 14px; }
.empty-state h2 { font-size: 22px; color: var(--brown-dark); margin-bottom: 8px; }
.empty-state p { color: var(--text-light); font-size: 14px; }

/* ===== 按钮 / 输入框 ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    border: none; cursor: pointer;
    font-size: 14px; font-weight: 600;
    padding: 10px 20px; border-radius: 10px;
    transition: filter 0.15s, transform 0.1s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--green), var(--green-dark)); color: #fff; }
.btn-danger { background: #ef5350; color: #fff; }
.btn-danger:hover { background: #e53935; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
a.btn { text-decoration: none; color: #fff; display: inline-flex; }
.student-right .btn-sm { width: 100%; }
.input {
    padding: 11px 14px; border: 2px solid #e3e8e3; border-radius: 10px;
    font-size: 14px; width: 100%;
    background: #fff; color: var(--text);
    transition: border-color 0.15s;
}
.input:focus { outline: none; border-color: var(--green); }

/* ===== 绑定面板 ===== */
.bind-panel {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 24px;
    border: 1px dashed var(--green);
}
.bind-title { font-size: 16px; color: var(--green-dark); margin-bottom: 14px; }
.bind-form { display: flex; gap: 10px; flex-wrap: wrap; }
.bind-form .input { flex: 1; min-width: 160px; }
.bind-tip { font-size: 12px; color: var(--text-light); margin-top: 10px; }

/* ===== 学生卡片（含操作区）===== */
.student-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.unbind-btn { white-space: nowrap; }

/* ===== Toast ===== */
.toast {
    position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
    padding: 12px 24px; border-radius: 10px; color: #fff;
    font-size: 14px; font-weight: 600; z-index: 1000;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}
.toast-ok { background: #43a047; }
.toast-err { background: #e53935; }

/* ===== 登录页 ===== */
.login-body {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 60%, #a5d6a7 100%);
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
}
.login-wrap { width: 100%; max-width: 380px; padding: 20px; }
.login-card {
    background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
    padding: 34px 30px;
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-icon { font-size: 52px; display: block; margin-bottom: 8px; }
.login-brand h1 { font-size: 26px; color: var(--brown-dark); }
.login-brand p { color: var(--text-light); font-size: 13px; margin-top: 4px; }
.login-form .field { display: block; margin-bottom: 16px; }
.login-form .field span { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 6px; }
.login-form .btn { padding: 12px; font-size: 16px; }
.login-foot { text-align: center; color: rgba(0,0,0,0.45); font-size: 13px; margin-top: 18px; }

/* ===== 退出链接 ===== */
.logout-link {
    color: rgba(255,255,255,0.85); text-decoration: none;
    font-size: 13px; margin-left: 14px;
    border: 1px solid rgba(255,255,255,0.5);
    padding: 4px 12px; border-radius: 16px;
}
.logout-link:hover { background: rgba(255,255,255,0.2); }
