/* ===== GNOME / Adwaita 风格全局样式 ===== */

:root {
    /* Adwaita 色板 */
    --blue-1: #3584e4;
    --blue-2: #2a7de1;
    --blue-3: #1c71d8;
    --blue-4: #1a5fb4;
    --blue-light: #dceaf9;
    --red-1: #e01b24;
    --red-2: #c01c28;
    --green-1: #2ec27e;
    --green-2: #26a269;
    --yellow-1: #e5a50a;
    --orange-1: #e66100;
    --purple-1: #9141ac;
    --teal-1: #0d9488;

    /* 语义色 */
    --primary: var(--blue-1);
    --primary-hover: var(--blue-3);
    --danger: var(--red-1);
    --danger-hover: var(--red-2);
    --success: var(--green-1);
    --success-hover: var(--green-2);
    --warning: var(--yellow-1);

    /* 维度色 */
    --dim-overworld: var(--green-1);
    --dim-nether: var(--red-1);
    --dim-end: var(--purple-1);

    /* 中性色 — Adwaita Light */
    --bg: #f6f5f4;
    --card-bg: #ffffff;
    --border: #d5d1cc;
    --border-light: #e8e6e3;
    --text: #2e3436;
    --text-secondary: #77767b;
    --text-dim: #a7a5a4;

    /* 阴影 */
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 3px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 6px 24px rgba(0,0,0,0.12);

    /* 圆角 */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    /* 顶部栏高度 */
    --topbar-h: 36px;

    /* 字体 */
    --font: 'Noto Sans SC', Cantarell, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Ubuntu Mono', Menlo, Consolas, monospace;
}

/* ===== 重置 ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
}

body { padding-top: var(--topbar-h); }

a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--blue-4); text-decoration: none; }

/* ========================================
   顶部面板 — GNOME Panel 风格
   ======================================== */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: #1d1d1d;
    color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    z-index: 200;
    font-size: 0.8rem;
    user-select: none;
}

.topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-brand {
    color: #f0f0f0;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-dot {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(53,132,228,0.25);
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.topbar-nav a, .topbar-nav button {
    color: #d0d0d0;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 0.82rem;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    font-weight: 500;
}
.topbar-nav a:hover, .topbar-nav button:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    text-decoration: none;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 8px;
    border-left: 1px solid rgba(255,255,255,0.15);
    margin-left: 4px;
}

/* 角色徽章 */
.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: rgba(255,255,255,0.15);
    color: #fff;
}
.role-badge.admin { background: #f8e8c8; color: #925f1a; }
.role-badge.guest { background: rgba(255,255,255,0.22); color: #fff; }
.role-badge.user  { background: #d8e8f8; color: #1a5f92; }

/* ========================================
   主容器
   ======================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px 80px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    margin: 0 0 4px;
}
.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}
.page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ========================================
   卡片 — GNOME Card
   ======================================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
    transition: box-shadow 0.2s;
}
.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    margin: 0 0 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========================================
   按钮 — GNOME Pill/Flat
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    gap: 6px;
    line-height: 1.4;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--bg);
    border-color: var(--text-secondary);
}

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--success-hover); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }

.btn-sm { padding: 5px 12px; font-size: 0.82rem; border-radius: var(--radius-xs); }

/* ========================================
   表单 — GNOME Entry
   ======================================== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    font-family: inherit;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(53,132,228,0.15);
}
.form-control::placeholder { color: var(--text-dim); }

textarea.form-control { min-height: 100px; resize: vertical; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%2377767b' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-hint {
    margin-top: 5px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

/* ========================================
   表格
   ======================================== */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}
table { width: 100%; border-collapse: collapse; }
table th, table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
    vertical-align: middle;
}
table th {
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg);
    white-space: nowrap;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: rgba(53,132,228,0.04); }

.table-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ========================================
   状态/标签 chip
   ======================================== */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.tag-chip::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}

/* 维度徽章 */
.dim-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.dim-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}
.dim-badge.overworld { background: #d4f0df; color: #1a7a42; }
.dim-badge.nether    { background: #f8d8d8; color: #a01c28; }
.dim-badge.end       { background: #ecd8f5; color: #7a3ea0; }

/* ========================================
   模态框
   ======================================== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 24px;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 500px;
    max-height: 90vh; overflow-y: auto;
    animation: slideUp 0.2s ease;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
}
.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    margin: 0;
}
.modal-close {
    background: none; border: none; font-size: 1.3rem;
    cursor: pointer; color: var(--text-secondary);
    line-height: 1; padding: 4px 8px;
    border-radius: var(--radius-xs);
    transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 22px; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
}

/* ========================================
   Toast 通知 — 顶部弹窗
   ======================================== */
.toast-container {
    position: fixed;
    top: calc(var(--topbar-h) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    pointer-events: none;
    max-width: 480px; width: calc(100% - 32px);
}
.toast {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    font-size: 0.88rem; font-weight: 500; color: var(--text);
    pointer-events: auto;
    animation: toastIn 0.25s ease;
    transition: all 0.3s ease;
    width: 100%;
}
.toast.toast-out { animation: toastOut 0.25s ease forwards; }
.toast-icon {
    flex-shrink: 0; font-size: 1.05rem;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
}
.toast-success .toast-icon { color: #fff; background: var(--success); }
.toast-error   .toast-icon { color: #fff; background: var(--danger); }
.toast-warning .toast-icon { color: #fff; background: var(--warning); }
.toast-info    .toast-icon { color: #fff; background: var(--primary); }

.toast-success .toast-icon::before { content: '✓'; font-size: 0.85rem; font-weight: 700; }
.toast-error   .toast-icon::before { content: '✕'; font-size: 0.85rem; font-weight: 700; }
.toast-warning .toast-icon::before { content: '!'; font-size: 0.9rem; font-weight: 700; }
.toast-info    .toast-icon::before { content: 'i'; font-size: 0.85rem; font-weight: 700; font-style: italic; }

.toast-message { flex: 1; min-width: 0; word-break: break-word; line-height: 1.4; }
.toast-close {
    flex-shrink: 0; background: none; border: none;
    cursor: pointer; color: var(--text-secondary);
    font-size: 1rem; line-height: 1;
    padding: 4px; border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.toast-close:hover { background: var(--bg); color: var(--text); }

@keyframes toastIn  { from { transform: translateY(-16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-16px); opacity: 0; } }

/* ========================================
   Spinner
   ======================================== */
.spinner {
    width: 24px; height: 24px;
    border: 2.5px solid rgba(53,132,228,0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner-ring {
    width: 36px; height: 36px;
    border: 3px solid rgba(53,132,228,0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto;
}

/* ========================================
   Captcha 弹窗主机
   ======================================== */
.captcha-host {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 12px 0;
}

/* ========================================
   空状态
   ======================================== */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-secondary);
}
.empty-state-icon {
    width: 56px; height: 56px;
    margin: 0 auto 12px;
    background: var(--bg);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    color: var(--text-dim);
}

/* ========================================
   工具类
   ======================================== */
.text-muted { color: var(--text-secondary); }
.text-dim   { color: var(--text-dim); }
.text-mono  { font-family: var(--font-mono); }
.flex-row   { display: flex; gap: 12px; align-items: center; }
.flex-end   { display: flex; justify-content: flex-end; gap: 8px; }
.hidden     { display: none !important; }

code {
    font-family: var(--font-mono);
    background: var(--bg);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--text);
}
