/* ============================================
   YXxx 影像云 · 样式
   ============================================ */

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

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --bg: #f5f7fa;
  --card: #ffffff;
  --border: #e8eaed;
  --text: #202124;
  --text-secondary: #5f6368;
  --text-muted: #9aa0a6;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-hover: 0 4px 16px rgba(0,0,0,.12);
  --radius: 10px;
  --sidebar-width: 280px;
  --topbar-height: 56px;
  --vip: #ff9800;
  --admin: #e53935;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 通用 ---------- */
.hidden { display: none !important; }

.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  font-weight: 500;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-danger {
  background: #fff;
  color: var(--admin);
  border: 1px solid #ef9a9a;
}
.btn-danger:hover { background: #ffebee; }

/* ---------- 登录/注册页 ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo .logo-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1a73e8, #7c4dff);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.auth-logo h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.auth-logo p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all .15s;
}

.auth-tab.active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}

.auth-submit {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  font-size: 15px;
}

.auth-error {
  background: #ffebee;
  color: #c62828;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.auth-error.show { display: block; }

.auth-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 20px;
}

/* ---------- 会员提示页 ---------- */
.vip-banner {
  background: linear-gradient(135deg, #ff9800, #ff5722);
  color: #fff;
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.vip-banner .vip-icon {
  font-size: 36px;
}

.vip-banner h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.vip-banner p {
  font-size: 13px;
  opacity: .9;
}

.vip-banner .btn {
  margin-left: auto;
  background: #fff;
  color: #ff5722;
  flex-shrink: 0;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  background: var(--card);
  height: var(--topbar-height);
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1a73e8, #4a90d9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  background: linear-gradient(135deg, #1a73e8, #7c4dff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.search-box {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 8px 16px 8px 38px;
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  background: var(--bg);
}

.search-box input:focus {
  border-color: var(--primary);
  background: #fff;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.user-badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.user-badge.vip { background: #fff3e0; color: var(--vip); }
.user-badge.admin { background: #ffebee; color: var(--admin); }
.user-badge.trial { background: #f5f5f5; color: var(--text-muted); }

/* ---------- 主布局 ---------- */
.main {
  display: flex;
  height: calc(100vh - var(--topbar-height));
}

/* ---------- 左侧分类栏 ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

.cat-section { border-bottom: 1px solid #f0f0f0; }

.cat-header {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .15s;
  user-select: none;
}

.cat-header:hover { background: #f8f9fb; }

.cat-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f0f4ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.cat-info { flex: 1; min-width: 0; }

.cat-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-count {
  font-size: 11px;
  color: var(--text-muted);
  background: #f1f3f4;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.cat-arrow {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform .2s;
  flex-shrink: 0;
}

.cat-section.open .cat-arrow { transform: rotate(90deg); }

.sub-list { display: none; padding: 2px 0 6px; }
.cat-section.open .sub-list { display: block; }

.sub-item {
  padding: 7px 16px 7px 60px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .12s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sub-item:hover { background: #f5f6fa; color: var(--text); }
.sub-item.active { color: var(--primary); font-weight: 500; background: var(--primary-light); }

.sub-count { font-size: 11px; color: var(--text-muted); }

/* ---------- 右侧内容区 ---------- */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.content-header { margin-bottom: 16px; }
.content-header h2 { font-size: 17px; font-weight: 600; margin-bottom: 2px; }
.content-header p { font-size: 12px; color: var(--text-muted); }

/* 图片网格 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.cell {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}

.cell:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.cell img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
  background: #f0f0f0;
}

.cell-title {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 加载更多 */
.load-more { text-align: center; padding: 24px; margin-top: 10px; }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; }

/* ---------- 大图查看器 ---------- */
.viewer {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.viewer.open { display: flex; }

.viewer img {
  max-width: 92%;
  max-height: 82%;
  object-fit: contain;
  border-radius: 4px;
}

.viewer-caption {
  color: #fff;
  margin-top: 14px;
  font-size: 14px;
  text-align: center;
  max-width: 80%;
}

.viewer-close {
  position: absolute;
  top: 20px;
  right: 28px;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  background: none;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.viewer-nav {
  position: absolute;
  bottom: 28px;
  display: flex;
  gap: 16px;
}

.viewer-nav button {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  padding: 8px 24px;
  border-radius: 24px;
  cursor: pointer;
  font-size: 14px;
}

/* ---------- 管理员后台 ---------- */
.admin-panel {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.admin-panel h2 {
  font-size: 18px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.user-table {
  width: 100%;
  border-collapse: collapse;
}

.user-table th,
.user-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.user-table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 13px;
  background: var(--bg);
}

.role-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.device-input {
  width: 60px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.status-badge.active { background: #e8f5e9; color: #2e7d32; }
.status-badge.locked { background: #ffebee; color: #c62828; }

.user-table td .btn {
  margin-right: 6px;
  padding: 5px 12px;
  font-size: 12px;
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #bbb; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .sidebar { width: 220px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .cell img { height: 110px; }
  .brand-name { display: none; }
}

@media (max-width: 560px) {
  .sidebar { display: none; }
  .content { padding: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  .cell img { height: 90px; }
}
