/* ============================================================
   CHEPELSKI GUINCHOS — Admin Panel CSS
   Tema: Preto / Amarelo-Dourado / Branco
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

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

:root {
  --gold:        #FFC400;
  --gold-dark:   #E5A800;
  --gold-light:  #FFD740;
  --bg-900:      #0A0A0A;
  --bg-800:      #111111;
  --bg-700:      #181818;
  --bg-600:      #222222;
  --bg-card:     rgba(255,255,255,0.04);
  --border:      rgba(255,196,0,0.15);
  --border-soft: rgba(255,255,255,0.07);
  --text-white:  #FFFFFF;
  --text-gray:   rgba(255,255,255,0.55);
  --text-muted:  rgba(255,255,255,0.35);
  --success:     #22C55E;
  --danger:      #EF4444;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --sidebar-w:   240px;
  --header-h:    60px;
  --transition:  all 0.2s ease;
}

html, body {
  height: 100%;
  font-family: 'Montserrat', sans-serif;
  background: var(--bg-900);
  color: var(--text-white);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-900);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255,196,0,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  background: var(--bg-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.login-logo img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 14px;
  border: 2px solid var(--border);
}

.login-logo .brand-name {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-white);
}

.login-logo .brand-name span { color: var(--gold); }

.login-logo .panel-label {
  font-size: 0.75rem;
  color: var(--text-gray);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-form { display: flex; flex-direction: column; gap: 18px; }

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

.form-group label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-gray);
}

.form-group .input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.form-group input {
  width: 100%;
  background: var(--bg-700);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-white);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus {
  border-color: var(--gold);
  background: var(--bg-600);
  box-shadow: 0 0 0 3px rgba(255,196,0,0.1);
}

.form-group input::placeholder { color: var(--text-muted); }

.toggle-pw {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-gray);
  display: flex;
  padding: 4px;
  transition: var(--transition);
}
.toggle-pw:hover { color: var(--gold); }

.btn-login {
  width: 100%;
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: var(--radius-md);
  padding: 13px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 4px;
}
.btn-login:hover { background: var(--gold-light); transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }

.back-link {
  text-align: center;
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--text-gray);
  transition: var(--transition);
}
.back-link:hover { color: var(--gold); }

.alert-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  color: #FCA5A5;
  padding: 10px 14px;
  font-size: 0.85rem;
}

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-800);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-soft);
}

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

.sidebar-brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.sidebar-brand .brand-text .name {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-white);
  line-height: 1;
}

.sidebar-brand .brand-text .name span { color: var(--gold); }

.sidebar-brand .brand-text .sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }

.nav-section { margin-bottom: 8px; }

.nav-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 20px;
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-gray);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-link:hover {
  color: var(--text-white);
  background: rgba(255,255,255,0.04);
}

.nav-link.active {
  color: var(--gold);
  background: rgba(255,196,0,0.08);
  border-left-color: var(--gold);
  font-weight: 700;
}

.nav-link svg { flex-shrink: 0; opacity: 0.8; }
.nav-link.active svg { opacity: 1; }

.nav-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 8px 16px;
}

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px; height: 34px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  color: #000;
  flex-shrink: 0;
}

.user-info .user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-white);
}

.user-info .user-email {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* MAIN CONTENT */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  height: var(--header-h);
  background: var(--bg-800);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-white);
}

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

.btn-topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-gray);
}

.btn-topbar:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-white);
}

.btn-topbar.danger { color: #FCA5A5; border-color: rgba(239,68,68,0.2); }
.btn-topbar.danger:hover { background: rgba(239,68,68,0.1); color: #FECACA; }

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

/* PAGE HEADER */
.page-header { margin-bottom: 28px; }

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header p {
  color: var(--text-gray);
  font-size: 0.9rem;
  margin-top: 6px;
  max-width: 640px;
}

/* CARDS */
.tracking-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

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

.tracking-card-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.tracking-icon {
  width: 42px; height: 42px;
  background: rgba(255,196,0,0.1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  flex-shrink: 0;
}

.tracking-icon img { width: 24px; height: 24px; }

.tracking-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-white);
}

.tracking-card-desc {
  font-size: 0.8rem;
  color: var(--text-gray);
  margin-top: 2px;
}

.tracking-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s infinite;
}

.status-dot.inactive {
  background: var(--text-muted);
  animation: none;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.8); }
}

.status-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--success);
}

.status-label.inactive { color: var(--text-muted); }

/* TOGGLE */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-input {
  width: 44px; height: 24px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-600);
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--border-soft);
  transition: var(--transition);
  flex-shrink: 0;
}

.toggle-input::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: var(--transition);
}

.toggle-input:checked {
  background: var(--gold);
  border-color: var(--gold);
}

.toggle-input:checked::after {
  left: 22px;
  background: #000;
}

/* TRACKING BODY */
.tracking-card-body { padding: 24px; }

.field-group { margin-bottom: 20px; }

.field-group label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-gray);
  margin-bottom: 4px;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.field-hint code {
  background: rgba(255,196,0,0.12);
  color: var(--gold);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.73rem;
}

.field-input {
  width: 100%;
  max-width: 380px;
  background: var(--bg-700);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 11px 16px;
  color: var(--text-white);
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  outline: none;
  transition: var(--transition);
}

.field-input:focus {
  border-color: var(--gold);
  background: var(--bg-600);
  box-shadow: 0 0 0 3px rgba(255,196,0,0.1);
}

.field-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0;
}

.tracking-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--border-soft);
  gap: 12px;
  flex-wrap: wrap;
}

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

.updated-at span { color: var(--text-gray); }

.btn-save {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 22px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-save:hover { background: var(--gold-light); transform: translateY(-1px); }
.btn-save:active { transform: translateY(0); }

.btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* SUCCESS / ERROR FEEDBACK */
.save-feedback {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.save-feedback.success {
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.25);
  color: #86EFAC;
  display: flex;
}

.save-feedback.error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.25);
  color: #FCA5A5;
  display: flex;
}

/* DASHBOARD OVERVIEW CARDS */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.overview-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.overview-card .ov-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.overview-card .ov-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-white);
}

.overview-card .ov-status {
  font-size: 0.78rem;
  margin-top: 4px;
}

.ov-status.active { color: var(--success); }
.ov-status.inactive { color: var(--text-muted); }

/* SEGURANCA PAGE */
.security-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}

.security-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.security-card p {
  color: var(--text-gray);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.badge-ok { background: rgba(34,197,94,0.15); color: #86EFAC; }
.badge-warn { background: rgba(255,196,0,0.15); color: var(--gold); }

/* TOAST */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-700);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  animation: slideIn 0.3s ease;
  min-width: 260px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.toast-item.success { border-color: rgba(34,197,94,0.3); color: #86EFAC; }
.toast-item.error { border-color: rgba(239,68,68,0.3); color: #FCA5A5; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .admin-main { margin-left: 0; }
  .admin-content { padding: 16px; }
}
