/* ============================================================
   林晞蜂巢 · 公共样式 v3
   ============================================================ */

:root {
    --bg: #0d1117;
    --bg-elevated: #161b22;
    --bg-hover: #1c2129;
    --border: #30363d;
    --border-sub: #21262d;
    --text: #c9d1d9;
    --text-dim: #8b949e;
    --text-muted: #484f58;
    --accent: #f0a500;
    --accent-dark: #d49500;
    --green: #238636;
    --green-dark: #1a6b2b;
    --green-text: #3fb950;
    --red: #da3633;
    --red-dark: #b52b28;
    --red-text: #f85149;
    --yellow: #d29922;
    --blue: #58a6ff;
    --radius: 4px;
    --radius-lg: 10px;
    --transition: 0.2s;
    --brand-name: "林晞蜂巢";
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.brand-name::before { content: var(--brand-name); }

/* ---------- Header ---------- */
.header {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    margin: 0;
    border-radius: 0;
}

.header h1 {
    font-size: 16px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.header h1 > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.header h1 .brand-name {
    color: var(--text-dim);
    font-size: 12px;
    font-weight: normal;
    padding-left: 8px;
    border-left: 1px solid var(--border);
    margin-left: 4px;
    flex-shrink: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* 汉堡按钮 */
.menu-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    font-family: inherit;
}
.menu-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Container ---------- */
.container { max-width: 1040px; margin: 20px auto; padding: 0 16px; }

/* ---------- Card ---------- */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }

/* ---------- Button ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    font-family: inherit;
    border: 1px solid transparent;
    background: transparent;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1;
    -webkit-user-select: none;
    user-select: none;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-green { background: var(--green); color: #fff; border-color: var(--green); }
.btn-green:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn-red { background: var(--red); color: #fff; border-color: var(--red); }
.btn-red:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { height: 28px; padding: 0 12px; font-size: 11px; }

.btn .spinner {
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
    background: var(--bg);
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    color: var(--text-dim);
    border-bottom: 2px solid var(--border);
    font-weight: bold;
    white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border-sub); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--bg-hover); }

/* ---------- Badge ---------- */
.badge { padding: 2px 8px; border-radius: 8px; font-size: 10px; display: inline-block; font-weight: bold; }
.badge-green { background: #23863622; color: var(--green-text); }
.badge-red { background: #da363322; color: var(--red-text); }
.badge-yellow { background: #d2992222; color: var(--yellow); }

/* ---------- Empty / Loading ---------- */
.empty { text-align: center; color: var(--text-muted); padding: 32px 16px; font-size: 13px; }
.loading-row td {
    text-align: center;
    padding: 30px 0;
    color: var(--text-dim);
    font-size: 12px;
}
.loading-row .dot-loader { display: inline-flex; gap: 4px; margin-right: 8px; vertical-align: middle; }
.loading-row .dot-loader i {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: bounce 1s infinite ease-in-out;
}
.loading-row .dot-loader i:nth-child(2) { animation-delay: 0.15s; }
.loading-row .dot-loader i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Modal ---------- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(2px);
    padding: 16px;
}
.modal.show { display: flex; }
.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    width: 100%;
    max-width: 460px;
    max-height: 88vh;
    overflow-y: auto;
    animation: modalIn 0.18s ease-out;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to { opacity: 1; transform: none; }
}
.modal-content h3 {
    color: var(--accent);
    margin-bottom: 16px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ---------- Form ---------- */
.form-group { margin-bottom: 12px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--text-dim);
    font-weight: bold;
    letter-spacing: 0.3px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    height: 34px;
    padding: 0 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}
.form-group textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.12);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    top: 16px;
    right: 16px;
    padding: 10px 18px;
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    z-index: 999;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: 0.2s;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    gap: 6px;
}
.toast.show { opacity: 1; transform: none; }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }

/* ---------- Topbar Progress ---------- */
.topbar-progress {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    width: 0;
    background: var(--accent);
    z-index: 300;
    transition: width 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 0 6px var(--accent);
}

/* ============================================================
   侧拉菜单（从左侧滑出）
   ============================================================ */
.side-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.2s;
}
.side-mask.show { display: block; opacity: 1; }

.side-menu {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}
.side-menu.show { transform: translateX(0); }

/* 侧拉菜单头部：🐝 导航  👤 张三   ✕ */
.side-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.side-head h3 {
    font-size: 14px;
    color: var(--accent);
    margin: 0;
    font-weight: bold;
    flex-shrink: 0;
}
.side-head .side-user {
    font-size: 12px;
    color: var(--text-dim);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 4px;
}
.side-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    flex-shrink: 0;
}
.side-close:hover { color: var(--red-text); border-color: var(--red-text); }

/* 侧拉菜单操作区：🏠 返回  🚪 退出 */
.side-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}
.side-actions .side-action-btn {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
    padding: 0 12px;
    box-sizing: border-box;
}
.side-actions .side-action-back {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}
.side-actions .side-action-back:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.side-actions .side-action-logout {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}
.side-actions .side-action-logout:hover {
    background: var(--red-dark);
    border-color: var(--red-dark);
}

.side-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0 16px;
}

.side-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    transition: var(--transition);
    border-left: 3px solid transparent;
}
.side-item:hover { background: var(--bg-hover); color: var(--accent); }
.side-item.active {
    background: rgba(240, 165, 0, 0.1);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: bold;
}
.side-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }

.side-loading,
.side-empty,
.side-error {
    padding: 24px 18px;
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
}
.side-error { color: var(--red-text); }

body.side-open { overflow: hidden; }

/* ============================================================
   移动端
   ============================================================ */
@media (max-width: 768px) {
    .header { padding: 10px 14px; }
    .header h1 { font-size: 14px; }
    .header h1 .brand-name { font-size: 11px; padding-left: 6px; margin-left: 2px; }
    .container { padding: 0 12px; margin: 14px auto; }
    .hide-mobile { display: none !important; }

    .menu-btn { width: 36px; height: 36px; font-size: 18px; }

    /* 表格卡片化 */
    .card-table { display: block; }
    .card-table thead { display: none; }
    .card-table tbody { display: block; }
    .card-table tr {
        display: block;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    .card-table tbody tr:last-child { margin-bottom: 0; }
    .card-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px dashed var(--border-sub);
        font-size: 12px;
        text-align: left !important;
    }
    .card-table td:last-child { border-bottom: none; }
    .card-table td::before {
        content: attr(data-label);
        color: var(--text-dim);
        font-size: 11px;
        flex-shrink: 0;
        margin-right: 12px;
    }
    .card-table td .badge,
    .card-table td .btn { flex-shrink: 0; }
}

@media (max-width: 480px) {
    .header { padding: 8px 12px; }
    .header h1 { font-size: 13px; gap: 6px; }
    .header h1 .brand-name { font-size: 10px; padding-left: 5px; margin-left: 1px; }
    .container { padding: 0 10px; }
    .card { padding: 12px; }
    .modal-content { padding: 18px; }
    .menu-btn { width: 34px; height: 34px; font-size: 17px; }
    .btn { height: 32px; font-size: 11px; }
    .btn-sm { height: 26px; padding: 0 10px; font-size: 10px; }
}