/* ================================================
   RB-WPLAYER — Admin Panel Styles
   ================================================ */

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

:root {
  --bg:         #0d0d0d;
  --bg-sidebar: #0a0a0a;
  --bg-card:    #141414;
  --bg-input:   #1a1a1a;
  --accent:     #e50914;
  --text-primary:  #ffffff;
  --text-secondary:#b3b3b3;
  --text-muted:    #666;
  --border:     #222;
  --success:    #46d369;
  --warning:    #f5a623;
  --danger:     #e50914;
  --info:       #3399ff;
  --sidebar-w:  240px;
  --header-h:   60px;
  --radius:     8px;
}

body {
  font-family: 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
}

/* LOGIN DO ADMIN */
#adminLoginScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.admin-login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
  width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

.admin-login-card .admin-logo {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 4px;
}

.admin-login-card .admin-logo span { color: var(--text-primary); }

.admin-login-card p.subtitle {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 28px;
}

/* LAYOUT ADMIN */
#adminApp { display: flex; height: 100vh; }

/* SIDEBAR */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  z-index: 40;
}

.admin-logo-bar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--accent);
  flex-shrink: 0;
}

.admin-logo-bar span { color: var(--text-primary); }
.admin-logo-bar small { font-size: 0.6rem; letter-spacing: 2px; color: var(--text-muted); margin-left: 6px; font-weight: 400; }

.admin-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: all 0.15s;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.admin-nav-item:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.admin-nav-item.active {
  color: var(--text-primary);
  background: rgba(229,9,20,0.12);
  border-left: 3px solid var(--accent);
}

.nav-icon { font-size: 0.875rem; width: 10px;  }

.admin-nav-section {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 16px 12px 8px;
}

.admin-sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.admin-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* CONTEÚDO PRINCIPAL */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-header {
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}

.admin-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  flex: 1;
}

.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.admin-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.admin-sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.admin-mobile-toggle { display: none; }

.header-inline-actions,
.form-actions,
.field-inline,
.table-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.field-inline .form-control { flex: 1; min-width: 220px; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.checkbox-inline input { accent-color: var(--accent); }

.color-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-picker {
  width: 48px;
  min-width: 48px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  padding: 3px;
}

.admin-table-scroll {
  width: 100%;
  overflow-x: auto;
}

.actions-col { text-align: right; white-space: nowrap; }

.mono-cell {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 0.76rem;
}

.password-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-subtext {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.muted-small {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.empty-state {
  padding: 28px 24px;
  color: var(--text-muted);
  text-align: center;
}

.error-state { color: #ff8a8a; }

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

/* STATS CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.stat-card.accent::before  { background: var(--accent); }
.stat-card.success::before { background: var(--success); }
.stat-card.info::before    { background: var(--info); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before  { background: var(--danger); }

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-sub { font-size: 0.75rem; color: var(--text-muted); }

/* TABELAS */
.admin-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-table-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.admin-table-header h2 { font-size: 1rem; font-weight: 700; }

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

th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-secondary);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: rgba(255,255,255,0.02); color: var(--text-primary); }

/* Badges de status */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: 0.3px;
}

.badge-success { background: rgba(70,211,105,0.15); color: var(--success); }
.badge-danger  { background: rgba(229,9,20,0.15);   color: var(--danger); }
.badge-warning { background: rgba(245,166,35,0.15); color: var(--warning); }
.badge-info    { background: rgba(51,153,255,0.15); color: var(--info); }
.badge-muted   { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* FORMULÁRIOS */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.form-section h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-row.three { grid-template-columns: 1fr 1fr 80px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }

/* BOTÕES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #f40612; }

.btn-secondary { background: rgba(255,255,255,0.08); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: rgba(255,255,255,0.12); }

.btn-success { background: rgba(70,211,105,0.15); color: var(--success); border: 1px solid rgba(70,211,105,0.3); }
.btn-success:hover { background: rgba(70,211,105,0.25); }

.btn-danger { background: rgba(229,9,20,0.15); color: var(--danger); border: 1px solid rgba(229,9,20,0.3); }
.btn-danger:hover { background: rgba(229,9,20,0.25); }

.btn-icon { padding: 7px; width: 32px; height: 32px; }

.btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.btn-lg { padding: 11px 24px; font-size: 0.9rem; }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* TOGGLE SWITCH */
.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-track::before {
  content: '';
  position: absolute;
  left: 2px; top: 2px;
  width: 16px; height: 16px;
  background: #b3b3b3;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-track { background: var(--success); background: #46d369e3;}
.toggle-switch input:checked + .toggle-track::before { transform: translateX(16px); background: #46d369e3; }

/* MODAL */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.admin-modal-overlay.open { opacity: 1; pointer-events: all; }

.admin-modal {
  background: #181818;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 90%;
  max-width: 500px;
  max-height: min(90vh, 760px);
  overflow-y: auto;
  animation: modalIn 0.2s ease;
  position: relative;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.admin-modal h2 { font-size: 1.1rem; margin-bottom: 4px; }
.admin-modal .modal-sub { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 24px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ALERT INLINE */
.alert-inline {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  margin-top: 12px;
  display: none;
}

.alert-inline.show { display: flex; align-items: center; gap: 8px; }
.alert-inline.error   { background: rgba(229,9,20,0.12); border: 1px solid rgba(229,9,20,0.3); color: #ff6b6b; }
.alert-inline.success { background: rgba(70,211,105,0.12); border: 1px solid rgba(70,211,105,0.3); color: var(--success); }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #222;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.8rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }

/* Responsive */
@media (max-width: 980px) {
  .admin-mobile-toggle { display: inline-flex; }
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { width: 100%; }
  .admin-header {
    padding: 0 16px;
  }
  .admin-content {
    padding: 16px;
  }
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row.three { grid-template-columns: 1fr; }
  .admin-login-card {
    width: min(92vw, 420px);
    padding: 30px 22px;
  }
  .admin-table-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .header-inline-actions,
  .form-actions,
  .field-inline,
  .table-actions {
    width: 100%;
  }
  .header-inline-actions .btn,
  .form-actions .btn,
  .field-inline .btn {
    width: 100%;
  }
  .field-inline .form-control {
    min-width: 0;
  }
  .stats-grid,
  .compact-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .toast { min-width: 0; width: 100%; }
  .admin-modal {
    width: calc(100vw - 24px);
    padding: 22px 18px;
  }
}
