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

:root {
    /* Adwaita 色板 */
    --blue-1: #3584e4;
    --blue-2: #2a7de1;
    --blue-3: #1c71d8;
    --blue-4: #1a5fb4;
    --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);

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

    /* 阴影 — GNOME 用极轻阴影 */
    --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);

    /* 圆角 — GNOME 偏大圆角 */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
}

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

body {
    font-family: 'Noto Sans SC', Cantarell, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

/* ===== 导航栏 — GNOME Headerbar 风格 ===== */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    gap: 12px;
}

.navbar-brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    flex-wrap: wrap;
}

.navbar-nav a {
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.navbar-nav a:hover {
    background: rgba(53,132,228,0.08);
    color: var(--primary);
    text-decoration: none;
}

.navbar-nav a.active {
    background: rgba(53,132,228,0.12);
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.navbar-user .role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.role-badge.admin {
    background: #f8e8c8;
    color: #925f1a;
}
.role-badge.super_admin {
    background: #e8d8f0;
    color: #7a3ea0;
}
.role-badge.member {
    background: #d8e8f8;
    color: #1a5f92;
}

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

/* ===== 卡片 — 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-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
}

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* ===== 按钮 — 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;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    gap: 6px;
    line-height: 1.4;
    letter-spacing: -0.01em;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }

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

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

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

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

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

/* ===== 表单 — 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);
}

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;
}

/* ===== 表格 ===== */
.table-wrap {
    overflow-x: auto;
    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;
}

table th {
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg);
    white-space: nowrap;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

table tr:hover td {
    background: rgba(53,132,228,0.04);
}

/* ===== 状态标签 ===== */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-pending { background: #f8e8c8; color: #925f1a; }
.status-approved { background: #d4f0df; color: #1a7a42; }
.status-rejected { background: #f8d8d8; color: #a01c28; }

/* ===== 登录页 ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 44px 40px;
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 6px;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 0.9rem;
}

.login-card .form-group:last-of-type {
    margin-bottom: 24px;
}

/* ===== 模态框 ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    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: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 4px 6px;
    border-radius: var(--radius-xs);
    transition: background 0.15s;
}
.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
}

/* ===== Toast 通知 ===== */
.toast-container {
    position: fixed;
    top: 20px;
    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% - 40px);
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    font-size: 0.9rem;
    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;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: #fff;
}

.toast-success .toast-icon { background: var(--success); }
.toast-error .toast-icon { background: var(--danger); }
.toast-warning .toast-icon { background: var(--warning); color: var(--text); }

.toast-message {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.2rem;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 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; }
}

/* ===== 自定义确认/输入弹窗 ===== */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 24px;
    animation: fadeIn 0.15s ease;
}

.dialog-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.2s ease;
    overflow: hidden;
}

.dialog-body {
    padding: 28px 28px 20px;
}

.dialog-icon-wrap {
    text-align: center;
    margin-bottom: 16px;
}

.dialog-icon-wrap .dialog-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
}

.dialog-icon.warning { background: var(--warning); color: var(--text); }
.dialog-icon.danger { background: var(--danger); }
.dialog-icon.question { background: var(--primary); }
.dialog-icon.input { background: var(--primary); }

.dialog-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.dialog-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.dialog-input-wrap {
    margin-top: 16px;
}

.dialog-input-wrap .form-control {
    text-align: center;
    font-size: 0.95rem;
}

.dialog-footer {
    display: flex;
    gap: 0;
    border-top: 1px solid var(--border-light);
}

.dialog-footer .dialog-btn {
    flex: 1;
    padding: 14px;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    color: var(--text-secondary);
}

.dialog-footer .dialog-btn:not(:last-child) {
    border-right: 1px solid var(--border-light);
}

.dialog-footer .dialog-btn:hover {
    background: var(--bg);
}

.dialog-footer .dialog-btn.primary {
    color: var(--primary);
}
.dialog-footer .dialog-btn.primary:hover {
    background: rgba(53,132,228,0.08);
}

.dialog-footer .dialog-btn.danger-btn {
    color: var(--danger);
}
.dialog-footer .dialog-btn.danger-btn:hover {
    background: rgba(224,27,36,0.06);
}

/* ===== 旧版 alert 兼容（将逐步移除） ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 16px;
}
.alert-error { background: #f8d8d8; color: #a01c28; border: 1px solid #f0c0c0; }
.alert-success { background: #d4f0df; color: #1a7a42; border: 1px solid #b8e0c8; }

/* ===== 首页网格 ===== */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
}

/* ===== 列表项 ===== */
.list-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}
.list-item:last-child { border-bottom: none; }
.list-item .item-title { font-weight: 600; margin-bottom: 4px; }
.list-item .item-preview { color: var(--text-secondary); font-size: 0.85rem; }
.list-item .item-meta { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-dim);
}
.empty-state p { font-size: 0.92rem; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .navbar-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 8px;
    }
    .navbar-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }
    .navbar-nav a { padding: 6px 10px; font-size: 0.82rem; }
    .navbar-user { font-size: 0.8rem; gap: 8px; }
    .container { padding: 16px 14px; }
    .card { padding: 18px; }
    .home-grid { grid-template-columns: 1fr; }
    .login-card { padding: 28px 24px; }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    table th, table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
}

/* ===== 工具类 ===== */
.hidden { display: none !important; }

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.breadcrumb a { color: var(--primary); }

/* ===== 维度标签 ===== */
.dimension-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    font-weight: 600;
}
.dimension-overworld { background: #d4f0df; color: #1a7a42; }
.dimension-nether { background: #f8d8d8; color: #a01c28; }
.dimension-end { background: #d8d8f8; color: #3a3aa0; }

/* ===== 操作按钮组 ===== */
.action-group {
    display: flex;
    gap: 6px;
}

/* ===== 页面标题 ===== */
.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 22px;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* ===== Tab 导航 — GNOME 分页 ===== */
.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab-btn {
    padding: 11px 22px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s;
    white-space: nowrap;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
}
.tab-btn.super-admin-only { color: var(--purple-1); }
.tab-btn.super-admin-only.active { color: var(--purple-1); border-bottom-color: var(--purple-1); }
