/* ========================================
   THE RESEARCH INSIDER — Admin Dashboard Styles
   ======================================== */

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

/* === Sidebar === */
.admin-sidebar {
  width: 256px;
  min-width: 256px;
  background: #0d1117;
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}
.sidebar__header {
  padding: 20px 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 28px;
}
.sidebar__logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #1a56db, #6c3fc5);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.sidebar__section {
  padding: 0 12px;
  margin-bottom: 24px;
}
.sidebar__section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 0 8px;
  margin-bottom: 6px;
}
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar__nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
  font-family: inherit;
  text-align: left;
  width: 100%;
  text-decoration: none;
}
.sidebar__nav-item:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.9); }
.sidebar__nav-item.active { background: rgba(26,86,219,0.2); color: #7aadff; }
.sidebar__nav-item i { width: 18px; text-align: center; font-size: 0.85rem; }
.sidebar__badge {
  margin-left: auto;
  background: #1a56db;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
}
.sidebar__footer {
  margin-top: auto;
  padding: 16px 12px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar__view-site {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  transition: all 0.2s;
  text-decoration: none;
}
.sidebar__view-site:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.8); }

/* === Main Content === */
.admin-main {
  flex: 1;
  margin-left: 256px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.admin-topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar__title { font-weight: 700; font-size: 0.9375rem; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.topbar__btn {
  padding: 7px 16px;
  border-radius: 99px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid #e9ecef;
  background: #fff;
  font-family: inherit;
  color: #4a5568;
}
.topbar__btn:hover { background: #f8f9fa; }
.topbar__btn.primary {
  background: #1a56db;
  color: #fff;
  border-color: #1a56db;
}
.topbar__btn.primary:hover { background: #1645b5; }

/* === Admin Content Area === */
.admin-content { flex: 1; padding: 32px 28px; }
.admin-page { display: none; }
.admin-page.active { display: block; }

/* === Dashboard Stats === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 14px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-card__label { font-size: 0.78rem; font-weight: 600; color: #868e96; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card__value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; color: #0d1117; line-height: 1; }
.stat-card__change { font-size: 0.78rem; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.stat-card__change.up { color: #0ca678; }
.stat-card__change.down { color: #e03131; }
.stat-card__icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-bottom: 4px;
}

/* === Admin Table === */
.admin-table-wrapper {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 14px;
  overflow: hidden;
  margin-top: 20px;
}
.admin-table-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e9ecef;
  flex-wrap: wrap;
}
.admin-table-header h3 { font-size: 0.9375rem; font-weight: 700; }
.admin-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 99px;
  padding: 7px 14px;
  font-size: 0.875rem;
}
.admin-search input { border: none; background: none; outline: none; font-family: inherit; font-size: 0.875rem; width: 180px; color: #0d1117; }
.admin-search i { color: #868e96; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  background: #f8f9fa;
  padding: 11px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #868e96;
  border-bottom: 1px solid #e9ecef;
}
.admin-table td {
  padding: 13px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid #f1f3f5;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f8f9fb; }
.admin-table__actions { display: flex; gap: 6px; }
.action-btn {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  font-family: inherit;
  transition: all 0.2s;
}
.action-btn.edit { background: #ebf0fe; color: #1a56db; border-color: #c7d9fc; }
.action-btn.edit:hover { background: #dae5fc; }
.action-btn.delete { background: #fff5f5; color: #e03131; border-color: #ffc9c9; }
.action-btn.delete:hover { background: #ffe8e8; }
.action-btn.view { background: #e6fcf5; color: #0ca678; border-color: #c3fae8; }
.action-btn.view:hover { background: #d3f9f0; }
.action-btn.feature { background: #fff9db; color: #f08c00; border-color: #ffe066; }
.action-btn.feature:hover { background: #fff3bf; }

/* === Platform Name in Table === */
.platform-row-name { display: flex; align-items: center; gap: 10px; }
.platform-row-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f1f3f5;
  border: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  overflow: hidden;
  flex-shrink: 0;
}
.platform-row-logo img { width: 100%; height: 100%; object-fit: contain; }
.platform-row-name-text { font-weight: 600; font-size: 0.875rem; }

/* === Status Badges === */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
}
.status-badge.published { background: #e6fcf5; color: #0ca678; }
.status-badge.draft { background: #f1f3f5; color: #868e96; }
.status-badge.featured { background: #fff9db; color: #f59f00; }
.status-badge.top-pick { background: #fff3bf; color: #e67700; }
.status-badge.recommended { background: #ebf0fe; color: #1a56db; }
.status-badge.not-recommended { background: #fff5f5; color: #e03131; }

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.2);
  animation: fadeInUp 0.25s ease;
}
.modal--lg { max-width: 820px; }
.modal-header {
  padding: 22px 28px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 99px;
  background: #f1f3f5;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #868e96;
  transition: all 0.2s;
}
.modal-close:hover { background: #e9ecef; color: #0d1117; }
.modal-body { padding: 24px 28px; }
.modal-footer { padding: 16px 28px 24px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid #e9ecef; }

/* === Form === */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.full { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-label { font-size: 0.8125rem; font-weight: 600; color: #374151; }
.form-label span { color: #e03131; margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  padding: 9px 13px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #0d1117;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #1a56db;
  box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.form-textarea.tall { min-height: 200px; }
.form-hint { font-size: 0.75rem; color: #868e96; }
.form-switch { display: flex; align-items: center; gap: 10px; }
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #dee2e6;
  border-radius: 99px;
  transition: 0.2s;
}
.switch-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .switch-slider { background: #1a56db; }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }
.form-switch-label { font-size: 0.875rem; font-weight: 500; color: #374151; }

/* === Rating Input === */
.rating-input { display: flex; gap: 4px; }
.rating-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: #dee2e6;
  transition: color 0.15s;
  padding: 2px;
}
.rating-star-btn.active, .rating-star-btn:hover { color: #f59f00; }

/* === Rich Text / Tip Tap area === */
.rich-editor {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
}
.rich-editor-toolbar {
  display: flex;
  gap: 2px;
  padding: 8px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  flex-wrap: wrap;
}
.rich-editor-toolbar button {
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: none;
  background: none;
  cursor: pointer;
  color: #4a5568;
  transition: all 0.15s;
}
.rich-editor-toolbar button:hover { background: #e9ecef; color: #0d1117; }
.rich-editor-content {
  padding: 12px;
  min-height: 120px;
  font-size: 0.9rem;
  line-height: 1.6;
  outline: none;
  color: #0d1117;
}
.rich-editor-content p { margin-bottom: 8px; }
.rich-editor-content p:last-child { margin-bottom: 0; }
.rich-editor-content ul, .rich-editor-content ol { padding-left: 20px; margin-bottom: 8px; }
.rich-editor-content li { margin-bottom: 4px; }

/* === Screenshot Upload === */
.screenshot-upload-area {
  border: 2px dashed #e9ecef;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.screenshot-upload-area:hover { border-color: #1a56db; background: #f0f4ff; }
.screenshot-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.screenshot-thumb {
  position: relative;
  width: 80px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e9ecef;
}
.screenshot-thumb img { width: 100%; height: 100%; object-fit: cover; }
.screenshot-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Toast === */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  padding: 13px 20px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  animation: fadeInUp 0.3s ease;
  white-space: nowrap;
}
.toast-success { background: #0d1117; color: #fff; }
.toast-error { background: #e03131; color: #fff; }

/* === Empty State === */
.empty-state {
  padding: 60px 40px;
  text-align: center;
  color: #868e96;
}
.empty-state__icon { font-size: 2.5rem; margin-bottom: 16px; }
.empty-state__title { font-size: 1rem; font-weight: 700; color: #4a5568; margin-bottom: 8px; }
.empty-state__desc { font-size: 0.875rem; margin-bottom: 20px; }

/* === Responsive === */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full-width { grid-column: auto; }
}
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-content { padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .admin-table { display: block; overflow-x: auto; }
}
