/* =====================================================
   Sistema Técnicos de Campo — Dark Theme
   ===================================================== */

/* ── Variáveis Bootstrap 5.3 dark mode ── */
[data-bs-theme="dark"] {
  --bs-body-bg:              #0b0f1a;
  --bs-body-color:           #c9d1d9;
  --bs-card-bg:              #111827;
  --bs-card-border-color:    transparent;
  --bs-border-color:         #1e293b;
  --bs-secondary-bg:         #1a2235;
  --bs-tertiary-bg:          #141e30;
  --bs-table-bg:             transparent;
  --bs-table-hover-bg:       rgba(255,255,255,.04);
  --bs-table-striped-bg:     rgba(255,255,255,.02);
  --bs-modal-bg:             #111827;
  --bs-modal-header-border-color: #1e293b;
  --bs-modal-footer-border-color: #1e293b;
  --bs-input-bg:             #1a2235;
  --bs-input-border-color:   #2d3748;
  --bs-input-focus-border-color: #4f83f7;
  --bs-list-group-bg:        #111827;
  --bs-list-group-border-color: #1e293b;
  --bs-nav-tabs-border-color: #1e293b;
  --bs-nav-tabs-link-active-bg: #111827;
  --bs-nav-tabs-link-active-border-color: #1e293b #1e293b #111827;
  --bs-nav-link-color:       #8b9bb4;
  --bs-nav-link-hover-color: #e2e8f0;
  --bs-accordion-bg:         #111827;
  --bs-accordion-border-color: #1e293b;
  --bs-accordion-btn-bg:     #111827;
  --bs-accordion-active-bg:  #1a2235;

  /* Custom */
  --accent:        #4f83f7;
  --accent-2:      #8b5cf6;
  --accent-glow:   rgba(79, 131, 247, .2);
  --sidebar-bg:    #080d18;
  --sidebar-width: 220px;
  --card-radius:   .75rem;
}

/* ── Tipografia base ── */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: .9375rem;
  letter-spacing: -.01em;
}

/* ── Scrollbar escura ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: #0b0f1a; }
::-webkit-scrollbar-thumb  { background: #2d3748; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4a5568; }

/* ── Gradiente do acento ── */
.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ====================================================
   NAVBAR TÉCNICO
   ==================================================== */
.navbar-tecnico {
  background: linear-gradient(90deg, #080d18 0%, #0f1629 100%);
  border-bottom: 1px solid #1e293b;
  padding: .75rem 0;
}
.navbar-tecnico .navbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: #e2e8f0 !important;
  letter-spacing: -.02em;
}
.navbar-tecnico .navbar-brand i {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.navbar-tecnico .btn-sair {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: #94a3b8;
  font-size: .8rem;
  padding: .3rem .8rem;
  border-radius: .5rem;
  transition: all .2s;
}
.navbar-tecnico .btn-sair:hover {
  background: rgba(255,255,255,.1);
  color: #e2e8f0;
}

/* ── Breadcrumb ── */
.breadcrumb-item a { color: var(--accent); text-decoration: none; }
.breadcrumb-item.active { color: #64748b; }
.breadcrumb-item + .breadcrumb-item::before { color: #334155; }

/* ====================================================
   CARDS CLICÁVEIS (área técnico)
   ==================================================== */
.card-click {
  background: #111827;
  border: 1px solid #1e293b !important;
  border-radius: var(--card-radius) !important;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.card-click:hover {
  transform: translateY(-4px);
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent), 0 12px 30px rgba(0,0,0,.4) !important;
  color: inherit;
}
.card-click .icon-circle {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ====================================================
   ADMIN LAYOUT — FLEXBOX SIDEBAR
   ==================================================== */
:root {
  --topbar-h: 56px;
}

/* Body for admin pages */
.admin-body {
  background: #0b0f1a;
  overflow-x: hidden;
}

/* ── Top bar ── */
.admin-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 1040;
  background: #080d18;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}

/* ── Wrapper: sidebar + main side-by-side ── */
.admin-wrapper {
  display: flex;
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
}

/* ── Sidebar ── */
.admin-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid #1e293b;
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  transition: transform .25s ease;
}

/* ── Main content ── */
.admin-main {
  flex: 1;
  min-width: 0;
  padding: 1.75rem 2rem;
  overflow-x: auto;
}

/* ── Sidebar nav items ── */
.sidebar-nav {
  padding: .75rem 0;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .85rem;
  margin: .1rem .5rem;
  border-radius: .5rem;
  color: #64748b;
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.sidebar-link i { font-size: .95rem; flex-shrink: 0; }
.sidebar-link:hover {
  background: rgba(79,131,247,.08);
  color: #c9d1d9;
}
.sidebar-link.active {
  background: rgba(79,131,247,.15);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar-section {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #334155;
  padding: .9rem 1.35rem .3rem;
}

/* ── Topbar buttons ── */
.admin-toggle {
  background: transparent;
  border: 1px solid #1e293b;
  color: #64748b;
  border-radius: .45rem;
  padding: .3rem .55rem;
  line-height: 1;
  transition: all .15s;
}
.admin-toggle:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.admin-sair {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  padding: .3rem .75rem;
  border-radius: .5rem;
  transition: all .15s;
}
.admin-sair:hover { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); color: #f87171; }

/* ── Mobile sidebar overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1039;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ── Mobile: sidebar slides in from left ── */
@media (max-width: 767.98px) {
  .admin-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    height: auto;
    z-index: 1040;
    transform: translateX(-100%);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { padding: 1.25rem 1rem; }
}

/* Legacy navbar-admin (kept for compat) */
.navbar-admin {
  background: #080d18;
  border-bottom: 1px solid #1e293b;
  height: 56px;
}
.navbar-admin .navbar-brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -.02em;
}
.navbar-admin .navbar-brand i { color: #f59e0b; }

/* ====================================================
   CARDS GERAIS (admin)
   ==================================================== */
.card {
  border-radius: var(--card-radius) !important;
  border: 1px solid #1e293b !important;
}
.card-header {
  background: transparent !important;
  border-bottom: 1px solid #1e293b !important;
  padding: .85rem 1.25rem;
  font-weight: 600;
  font-size: .9rem;
  color: #e2e8f0;
}

/* ── Stat cards (dashboard) ── */
.stat-card {
  background: #111827;
  border: 1px solid #1e293b !important;
  border-radius: var(--card-radius) !important;
  transition: transform .15s, border-color .15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent) !important;
  color: inherit;
}
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}

/* ====================================================
   TABELAS
   ==================================================== */
.table { --bs-table-color: #c9d1d9; }
.table thead th {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
  border-bottom: 1px solid #1e293b !important;
  white-space: nowrap;
  padding: .65rem .85rem;
}
.table tbody td {
  border-color: #1a2235;
  padding: .65rem .85rem;
  color: #c9d1d9;
}
.table-hover tbody tr:hover td { background: rgba(79,131,247,.05); }

/* ====================================================
   FORMULÁRIOS
   ==================================================== */
.form-control, .form-select {
  background-color: #1a2235;
  border-color: #2d3748;
  color: #e2e8f0;
  border-radius: .5rem;
}
.form-control:focus, .form-select:focus {
  background-color: #1e2a42;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  color: #e2e8f0;
}
.form-control::placeholder { color: #3d4f6a; }
.input-group-text {
  background: #1e2a3a;
  border-color: #2d3748;
  color: #64748b;
}

/* ====================================================
   BADGES personalizados
   ==================================================== */
.badge { font-weight: 600; letter-spacing: .03em; }

/* ====================================================
   BOTÕES
   ==================================================== */
.btn-primary {
  background: linear-gradient(135deg, #3b6fd4, #4f46e5);
  border: none;
  font-weight: 600;
  letter-spacing: .01em;
}
.btn-primary:hover { background: linear-gradient(135deg, #4f83f7, #6366f1); }
.btn-primary:focus { box-shadow: 0 0 0 3px var(--accent-glow); }

.btn-outline-secondary { border-color: #2d3748; color: #8b9bb4; }
.btn-outline-secondary:hover { background: #1e2a3a; border-color: #4a5568; color: #e2e8f0; }
.btn-outline-danger  { border-color: #4a1e1e; color: #f87171; }
.btn-outline-danger:hover { background: #2d1515; border-color: #f87171; color: #fca5a5; }

/* ====================================================
   TABS
   ==================================================== */
.nav-tabs {
  border-bottom: 1px solid #1e293b;
  gap: .25rem;
}
.nav-tabs .nav-link {
  border: 1px solid transparent;
  border-radius: .5rem .5rem 0 0;
  color: #64748b;
  font-size: .875rem;
  font-weight: 500;
  padding: .5rem 1rem;
}
.nav-tabs .nav-link:hover { color: #e2e8f0; background: rgba(255,255,255,.04); }
.nav-tabs .nav-link.active {
  color: var(--accent);
  background: #111827;
  border-color: #1e293b #1e293b #111827;
}

/* ====================================================
   LIST GROUP (coletores área técnico)
   ==================================================== */
.list-group-item {
  background: #111827;
  border-color: #1e293b;
  color: #c9d1d9;
  transition: background .12s;
}
.list-group-item:hover { background: #1a2235; }
.list-group-item-action:active { background: #1e2a42; }

/* ====================================================
   ACCORDION (câmeras admin)
   ==================================================== */
.accordion-button {
  font-weight: 600;
  font-size: .9rem;
}
.accordion-button:not(.collapsed) { color: var(--accent); }
.accordion-button::after { filter: invert(.5) sepia(1) saturate(3) hue-rotate(190deg); }

/* ====================================================
   GALERIA DE CÂMERAS
   ==================================================== */
.camera-gallery img {
  object-fit: cover;
  width: 100%; height: 180px;
  border-radius: .5rem;
  cursor: zoom-in;
  transition: opacity .15s, transform .15s;
  border: 1px solid #1e293b;
}
.camera-gallery img:hover { opacity: .85; transform: scale(1.02); }

/* ====================================================
   LOGIN PAGES
   ==================================================== */
.login-bg {
  min-height: 100vh;
  background: #0b0f1a;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(79,131,247,.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(139,92,246,.1) 0%, transparent 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  background: rgba(17, 24, 39, .85);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.07) !important;
  border-radius: 1.25rem !important;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0,0,0,.5);
}
.login-logo {
  width: 64px; height: 64px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, rgba(79,131,247,.2), rgba(139,92,246,.2));
  border: 1px solid rgba(79,131,247,.3);
}

/* ====================================================
   MISC
   ==================================================== */
code {
  background: rgba(79,131,247,.12);
  color: #93c5fd;
  padding: .1em .4em;
  border-radius: .3rem;
  font-size: .85em;
}
.alert { border-radius: .75rem; border: none; }
.alert-success { background: rgba(34,197,94,.1);  color: #86efac; border: 1px solid rgba(34,197,94,.2) !important; }
.alert-danger  { background: rgba(239,68,68,.1);  color: #fca5a5; border: 1px solid rgba(239,68,68,.2) !important; }
.alert-warning { background: rgba(245,158,11,.1); color: #fcd34d; border: 1px solid rgba(245,158,11,.2) !important; }
.alert-info    { background: rgba(59,130,246,.1); color: #93c5fd; border: 1px solid rgba(59,130,246,.2) !important; }
.modal-content { border: 1px solid #1e293b !important; border-radius: var(--card-radius) !important; }
.dropdown-menu { background: #111827; border-color: #1e293b; }

pre code { background: transparent; color: #93c5fd; padding: 0; font-size: .82rem; }
pre { background: #0d1117; border: 1px solid #1e293b; border-radius: .75rem; }

/* ── Responsivo geral ── */
@media (max-width: 767.98px) {
  .navbar-admin { height: auto; }
}
