/* ===== MANABI GACHA - Admin Panel Stylesheet ===== */

:root {
  --gold: #FFD700;
  --gold-dark: #B8860B;
  --purple: #7B2FBE;
  --purple-light: #A855F7;
  --purple-dark: #5B21B6;
  --deep: #0D0D1A;
  --surface: #13132A;
  --card: #1A1A36;
  --card-hover: #22224A;
  --text: #E8E8FF;
  --text-dim: #B0B0D0;
  --muted: #7878AA;
  --teal: #00E5C8;
  --pink: #FF4FA3;
  --orange: #FF8C00;
  --red: #EF4444;
  --green: #10B981;
  --line-green: #06C755;
  --border: rgba(123,47,190,0.22);
  --border-light: rgba(255,255,255,0.07);
  --radius: 12px;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--deep);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: width .25s ease, transform .25s ease;
}
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .sidebar-nav span,
.sidebar.collapsed .sidebar-footer .admin-info,
.sidebar.collapsed .sidebar-header .sidebar-logo span,
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-link i { margin-right: 0; font-size: 18px; }

.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  min-height: 56px;
}
.sidebar-logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 900;
  background: linear-gradient(90deg, var(--gold), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.sidebar-logo span {
  font-size: 11px;
  margin-left: 4px;
  opacity: 0.7;
}
.sidebar-toggle {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 2px;
  position: relative;
}
.nav-link:hover { background: rgba(123,47,190,0.12); color: var(--text); }
.nav-link.active {
  background: rgba(123,47,190,0.2);
  color: var(--purple-light);
  font-weight: 700;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--purple-light);
  border-radius: 0 3px 3px 0;
}
.nav-link i { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-link.disabled { opacity: 0.3; pointer-events: none; }

.nav-badge {
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: auto;
}
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 8px;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.admin-user { display: flex; align-items: center; gap: 10px; }
.admin-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  flex-shrink: 0;
}
.admin-name { font-size: 13px; font-weight: 700; }
.admin-role { font-size: 10px; color: var(--muted); }

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  transition: margin-left .25s ease;
  min-height: 100vh;
}
body.sidebar-collapsed .main-content { margin-left: var(--sidebar-w-collapsed); }

/* ===== TOPBAR ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: rgba(13,13,26,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}
.menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}
.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.role-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.role-switcher select {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
}

/* ===== ADMIN SECTIONS ===== */
.admin-section {
  display: none;
  padding: 24px;
  animation: adminFadeIn .3s ease;
}
.admin-section.active { display: block; }
@keyframes adminFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== TOOLBAR ===== */
.section-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 0;
}
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search-box {
  position: relative;
}
.search-box i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
}
.search-box input {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px 8px 36px;
  border-radius: 10px;
  font-size: 13px;
  font-family: 'Noto Sans JP', sans-serif;
  width: 240px;
  outline: none;
  transition: border-color .2s;
}
.search-box input:focus { border-color: var(--purple-light); }
.search-box input::placeholder { color: var(--muted); }

.section-toolbar select {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
  box-shadow: 0 4px 12px rgba(123,47,190,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(123,47,190,0.4); }

.btn-secondary {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
}
.btn-secondary:hover { border-color: var(--purple); color: var(--text); }

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 8px;
  border: none;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-edit { background: rgba(59,130,246,0.15); color: #60A5FA; }
.btn-edit:hover { background: rgba(59,130,246,0.25); }
.btn-delete { background: rgba(239,68,68,0.15); color: #F87171; }
.btn-delete:hover { background: rgba(239,68,68,0.25); }
.btn-approve { background: rgba(16,185,129,0.15); color: #34D399; }
.btn-approve:hover { background: rgba(16,185,129,0.25); }
.btn-reject { background: rgba(239,68,68,0.15); color: #F87171; }
.btn-reject:hover { background: rgba(239,68,68,0.25); }

.btn-icon {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-light);
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
}
.btn-icon:hover { color: var(--text); background: rgba(255,255,255,0.1); }

/* ===== DATA TABLE ===== */
.table-wrapper { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: rgba(123,47,190,0.08);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: rgba(123,47,190,0.06); }

.role-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.role-admin { background: rgba(255,215,0,0.15); color: var(--gold); }
.role-staff { background: rgba(59,130,246,0.15); color: #60A5FA; }
.role-gt { background: rgba(168,85,247,0.15); color: var(--purple-light); }

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.status-active { background: rgba(16,185,129,0.15); color: #34D399; }
.status-inactive { background: rgba(239,68,68,0.15); color: #F87171; }
.status-pending { background: rgba(255,140,0,0.15); color: var(--orange); }

.action-btns { display: flex; gap: 4px; }

/* ===== CARD PANEL ===== */
.card-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.panel-header h3 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-header h3 i { color: var(--purple-light); }
.panel-hint { font-size: 11px; color: var(--muted); }

/* ===== INFO CARD ===== */
.info-card {
  background: rgba(0,229,200,0.06);
  border: 1px solid rgba(0,229,200,0.2);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--teal);
  line-height: 1.6;
}
.info-card i { font-size: 16px; flex-shrink: 0; margin-top: 2px; }

/* ===== TAB GROUP ===== */
.tab-group { display: flex; gap: 4px; }
.tab-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { border-color: var(--purple); }
.tab-btn.active {
  background: rgba(123,47,190,0.2);
  border-color: var(--purple-light);
  color: var(--purple-light);
}
.tab-badge {
  background: var(--red);
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
}

/* ===== PERMISSIONS TABLE ===== */
.perm-table td { text-align: center; }
.perm-table td:first-child { text-align: left; font-weight: 600; }
.perm-actions { margin-top: 16px; }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  transition: .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--purple-light); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ===== VIDEO REVIEW ===== */
.video-review-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: all .2s;
}
.video-review-card:hover { border-color: var(--purple); }
.video-thumb {
  width: 160px; height: 100px;
  background: linear-gradient(135deg, #1A0A4A, #0D0D2A);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}
.video-thumb i { font-size: 28px; color: rgba(255,215,0,0.7); }
.video-thumb .duration-badge {
  position: absolute;
  bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.7);
  color: var(--gold);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}
.video-review-info { flex: 1; }
.video-review-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.video-review-meta { font-size: 11px; color: var(--muted); line-height: 1.7; }
.video-review-meta span { margin-right: 12px; }
.video-review-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ===== GENRE ASSIGN ===== */
.genre-assign-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.genre-video-title { font-size: 13px; font-weight: 700; flex: 1; }
.genre-video-gt { font-size: 11px; color: var(--muted); }
.genre-checkboxes { display: flex; gap: 8px; flex-wrap: wrap; }
.genre-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
}
.genre-checkbox input { accent-color: var(--purple-light); cursor: pointer; }

/* ===== RARITY EDITOR ===== */
.rarity-editor-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.rarity-editor-row:last-child { border-bottom: none; }
.rarity-name {
  width: 120px;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rarity-color {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rarity-slider-wrap { flex: 1; }
.rarity-slider {
  width: 100%;
  -webkit-appearance: none;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  outline: none;
}
.rarity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--purple-light);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(123,47,190,0.5);
}
.rarity-pct-input {
  width: 60px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Noto Sans JP', sans-serif;
  text-align: center;
}
.rarity-total {
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.rarity-total.error { color: var(--red); }
.rarity-total.ok { color: var(--green); }

/* ===== FORM ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.form-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-family: 'Noto Sans JP', sans-serif;
  outline: none;
  transition: border-color .2s;
}
.form-input:focus { border-color: var(--purple-light); }
.form-input::placeholder { color: var(--muted); }

.input-with-copy { display: flex; gap: 4px; }
.input-with-copy .form-input { flex: 1; }

/* ===== SUBSCRIPTION EDITOR ===== */
.sub-plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  position: relative;
}
.sub-plan-card.recommended { border-color: var(--gold); }
.sub-plan-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sub-plan-name i { color: var(--gold); }
.sub-plan-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== COLLECTION MANAGE ===== */
.collection-manage-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.collection-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.collection-info { flex: 1; }
.collection-name { font-size: 14px; font-weight: 700; }
.collection-condition { font-size: 11px; color: var(--muted); margin-top: 2px; }
.collection-card-count { font-size: 11px; color: var(--teal); margin-top: 2px; }

/* ===== PAYMENT ===== */
.payment-status { margin-top: 16px; }
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 8px;
}
.status-indicator.connected { background: rgba(16,185,129,0.1); color: var(--green); }
.status-indicator.disconnected { background: rgba(239,68,68,0.1); color: var(--red); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(13,13,26,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  animation: adminFadeIn .25s ease;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ===== TOAST ===== */
.admin-toast {
  position: fixed;
  top: 20px; right: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  transform: translateX(120%);
  transition: transform .35s ease;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
}
.admin-toast.show { transform: translateX(0); }
.admin-toast.success { border-color: var(--green); color: var(--green); }
.admin-toast.warning { border-color: var(--orange); color: var(--orange); }
.admin-toast.error { border-color: var(--red); color: var(--red); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .menu-btn { display: block; }
  .section-toolbar { flex-direction: column; align-items: flex-start; }
  .search-box input { width: 100%; }
  .video-review-card { flex-direction: column; }
  .video-thumb { width: 100%; height: 160px; }
  .form-grid { grid-template-columns: 1fr; }
  .sub-plan-form { grid-template-columns: 1fr; }
}
