/* =========================================================
   ADMIN PANEL — admin.css
   ========================================================= */

/* ─── Layout ──────────────────────────────────────────────── */

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar-logo h1 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.sidebar-logo p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  width: 100%;
  text-align: left;
  transition: all var(--transition);
  text-decoration: none;
}
.nav-item:hover {
  background: var(--bg-3);
  color: var(--text);
}
.nav-item.active {
  background: var(--bg-3);
  color: var(--text);
}
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 10px 0;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Main content */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
  gap: 16px;
}

.admin-topbar-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-content {
  padding: 32px;
  flex: 1;
}

.panel {
  display: none;
}
.panel.active {
  display: block;
}

.auth-panel {
  display: none;
}
.auth-panel.active {
  display: flex;
}

.admin-panel {
  display: none;
}
.admin-panel.active {
  display: block;
}

/* ─── Login ───────────────────────────────────────────────── */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo h1 {
  font-size: 1.3rem;
  font-weight: 700;
}
.login-logo p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }

/* ─── Section Cards ───────────────────────────────────────── */

.section-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color var(--transition);
}
.section-card:hover {
  border-color: var(--border-hover);
}
.section-card.dragging {
  opacity: 0.5;
  border-style: dashed;
}

.section-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}

.section-card-header:hover .section-title-text {
  color: var(--text);
}

.section-expand-icon {
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: transform var(--transition);
  margin-left: auto;
}
.section-card.expanded .section-expand-icon {
  transform: rotate(180deg);
}

.section-title-text {
  font-weight: 600;
  font-size: 0.95rem;
  flex: 1;
  color: var(--text);
}

.section-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.section-card-body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 16px;
}
.section-card.expanded .section-card-body {
  display: block;
}

/* ─── Link Items ──────────────────────────────────────────── */

.link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: all var(--transition);
}
.link-item:last-child { margin-bottom: 0; }
.link-item:hover { border-color: var(--border-hover); }
.link-item.dragging { opacity: 0.4; }

.link-item-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
}

.link-item-logo-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.link-item-info {
  flex: 1;
  min-width: 0;
}
.link-item-label {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-item-url {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1;
  transition: all var(--transition);
  font-family: inherit;
}
.icon-btn:hover { color: var(--text); background: var(--bg-3); }
.icon-btn.danger:hover { color: var(--danger); }

.add-link-area {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

/* ─── Platform Picker (modal) ─────────────────────────────── */

.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.platform-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  color: var(--text);
}
.platform-btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-3);
  transform: translateY(-1px);
}
.platform-btn img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: contain;
}
.platform-btn span {
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
}

/* ─── Profile page ────────────────────────────────────────── */

.avatar-preview-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}
.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 2px solid var(--border);
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-muted);
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ─── Settings page ───────────────────────────────────────── */

.settings-group {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.settings-group-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label {
  font-size: 0.9rem;
  font-weight: 500;
}
.settings-row-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Empty states ────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }
.empty-state .btn { margin-top: 16px; }

/* ─── Password strength ───────────────────────────────────── */

.pw-strength {
  height: 3px;
  border-radius: 2px;
  background: var(--bg-3);
  margin-top: 6px;
  overflow: hidden;
}
.pw-strength-bar {
  height: 100%;
  transition: width 0.3s, background 0.3s;
  border-radius: 2px;
}

/* ─── Responsive ──────────────────────────────────────────── */

@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    padding: 10px 16px;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-logo { display: none; }
  .sidebar-nav {
    flex-direction: row;
    padding: 0;
    gap: 4px;
  }
  .sidebar-footer { display: none; }
  .nav-item { white-space: nowrap; }

  .admin-content { padding: 20px 16px; }
  .admin-topbar { padding: 12px 16px; }

  .platform-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
