/* int64.io App Shell — 侧边栏布局 */

/* ── 字体 ─────────────────────────────────── */
@font-face {
  font-family: 'AlibabaSans';
  src: url('https://assets-persist.lovart.ai/agent-static-assets/AlibabaSans-Regular.otf') format('opentype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'AlibabaSans';
  src: url('https://assets-persist.lovart.ai/agent-static-assets/AlibabaSans-Medium.otf') format('opentype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'MiSans';
  src: url('https://assets-persist.lovart.ai/agent-static-assets/MiSans-Semibold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'MiSans';
  src: url('https://assets-persist.lovart.ai/agent-static-assets/MiSans-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

/* ── 页面基础 ───────────────────────────────── */
body.app-page {
  margin: 0;
  min-height: 100vh;
  background: #070b16;
  color: var(--text-main, #f9fafb);
  font-family: "AlibabaSans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  position: relative;
}

body.app-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(7, 11, 22, 0.72), rgba(7, 11, 22, 0.72)),
    url("/img/blackhole.webp") center / cover no-repeat;
  filter: blur(22px);
  transform: scale(1.06);
  opacity: 0.14;
  z-index: -1;
  pointer-events: none;
}

/* ── 全局加载遮罩 ────────────────────────────── */
.app-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-bg, #030712);
  color: #6b7280;
  font-size: 14px;
  z-index: 9999;
}

/* ── App 外壳 ───────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── 侧边栏 ─────────────────────────────────── */
.sidebar {
  width: 224px;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  background: rgba(7, 11, 22, 0.97);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Logo 区域 */
.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.logo-link:hover {
  text-decoration: none;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  font-family: "Courier New", monospace;
  letter-spacing: -0.5px;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.35);
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  color: #f9fafb;
  letter-spacing: -0.03em;
  font-family: "MiSans", system-ui, sans-serif;
}

/* 导航区域 */
.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 10px 4px;
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: #9ca3af;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  box-sizing: border-box;
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e5e7eb;
  text-decoration: none;
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.14);
  color: #60a5fa;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: #3b82f6;
  border-radius: 0 3px 3px 0;
}

.nav-item i {
  font-size: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active i {
  opacity: 1;
}

/* 折叠箭头 */
.nav-arrow {
  margin-left: auto;
  font-size: 16px !important;
  opacity: 0.7;
  transition: transform 0.22s ease;
}

.nav-group.open .nav-arrow {
  transform: rotate(180deg);
}

/* 子菜单 */
.nav-sub {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

.nav-group.open .nav-sub {
  max-height: 300px;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px 8px 38px;
  border-radius: 9px;
  color: #9ca3af;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  margin-bottom: 2px;
}

.nav-sub-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #d1d5db;
  text-decoration: none;
}

.nav-sub-item.active {
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.1);
}

.nav-sub-item i {
  font-size: 15px;
  flex-shrink: 0;
}

/* 管理功能区 */
.admin-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-dialog {
  width: min(680px, calc(100vw - 32px));
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 0;
  color: var(--text-main);
  background: #07111f;
}

.admin-dialog::backdrop {
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(4px);
}

.dialog-body {
  padding: 22px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.dialog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
}

/* 侧边栏底部 */
.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

/* ── 主内容区 ────────────────────────────────── */
.app-main {
  margin-left: 224px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── 顶部导航栏 ──────────────────────────────── */
.topbar {
  height: 60px;
  background: rgba(7, 11, 22, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: #f9fafb;
  flex: 1;
  white-space: nowrap;
}

/* 用户信息胶囊 */
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 13px 5px 5px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.user-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.16);
  text-decoration: none;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-email-display {
  font-size: 13px;
  color: #d1d5db;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 内容区域 ────────────────────────────────── */
.content-area {
  flex: 1;
  padding: 32px;
  overflow-x: hidden;
}

/* ── 工具卡片网格 ─────────────────────────────── */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.tool-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  text-decoration: none;
  color: inherit;
}

.tool-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #60a5fa;
}

.tool-card-name {
  font-size: 15px;
  font-weight: 600;
  color: #f9fafb;
}

.tool-card-desc {
  font-size: 13px;
  color: #9ca3af;
  line-height: 1.5;
}

.badge-soon {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.2);
  width: fit-content;
}

/* ── 个人资料页 ──────────────────────────────── */
.profile-card {
  max-width: 520px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.3);
}

.profile-info-name {
  font-size: 20px;
  font-weight: 700;
  color: #f9fafb;
  margin-bottom: 4px;
  word-break: break-all;
}

.profile-info-meta {
  font-size: 13px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.profile-badge.admin {
  background: rgba(139, 92, 246, 0.12);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.2);
}

.profile-section {
  margin-bottom: 24px;
}

.profile-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 14px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.profile-field label {
  font-size: 13px;
  color: #9ca3af;
}

.profile-field-value {
  font-size: 14px;
  color: #e5e7eb;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  word-break: break-all;
}

.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 24px 0;
}

/* ── 响应式 ──────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .topbar {
    padding: 0 16px;
  }

  .content-area {
    padding: 20px 16px;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 199;
  }

  .sidebar-overlay.visible {
    display: block;
  }

  .topbar-menu-btn {
    display: flex !important;
  }
}

.topbar-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #9ca3af;
  cursor: pointer;
  font-size: 20px;
  flex-shrink: 0;
  margin-right: 4px;
}

.topbar-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f9fafb;
}
