/* ============= Root & Base ============= */
:root {
  --color-bg: #0a0a0f;
  --color-surface: #16161a;
  --color-surface-light: #1c1c21;
  --color-border: rgba(255,255,255,0.06);
  --color-text: #e5e7eb;
  --color-text-muted: #9ca3af;
  --color-accent: #f97316;
  --color-whatsapp: #25d366;
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

body { overflow-x: hidden; }

/* ============= Scrollbar ============= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }
.scrollbar-thin::-webkit-scrollbar { width: 6px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* ============= Animations ============= */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideOutRight { from { transform: translateX(0); } to { transform: translateX(100%); } }

.pulse-dot { animation: pulse 2s ease-in-out infinite; }
.fade-in { animation: fadeIn 0.3s ease-out; }

/* ============= Cards ============= */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.2s ease;
  animation: fadeIn 0.3s ease-out;
}

.card-hover { cursor: pointer; }
.card-hover:hover {
  transform: translateY(-2px);
  border-color: rgba(249,115,22,0.4);
  box-shadow: 0 0 20px rgba(249,115,22,0.08);
}

/* Status card variants */
.card-pendente { border-left: 3px solid #9ca3af; }
.card-chamado { border-left: 3px solid #4ade80; background: rgba(74,222,128,0.04); }
.card-chamado:hover { border-color: rgba(74,222,128,0.5) !important; box-shadow: 0 0 20px rgba(74,222,128,0.08) !important; }
.card-aceitou { border-left: 3px solid #60a5fa; background: rgba(96,165,250,0.04); }
.card-aceitou:hover { border-color: rgba(96,165,250,0.5) !important; box-shadow: 0 0 20px rgba(96,165,250,0.08) !important; }
.card-recusou { border-left: 3px solid #f87171; background: rgba(248,113,113,0.04); }
.card-recusou:hover { border-color: rgba(248,113,113,0.5) !important; box-shadow: 0 0 20px rgba(248,113,113,0.08) !important; }
.card-site_feito { border-left: 3px solid #a78bfa; background: rgba(167,139,250,0.04); }
.card-site_feito:hover { border-color: rgba(167,139,250,0.5) !important; box-shadow: 0 0 20px rgba(167,139,250,0.08) !important; }
.card-pago { border-left: 3px solid #fbbf24; background: rgba(251,191,36,0.04); }
.card-pago:hover { border-color: rgba(251,191,36,0.5) !important; box-shadow: 0 0 20px rgba(251,191,36,0.08) !important; }

/* ============= Status Badges ============= */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge-pendente { color: #9ca3af; background: rgba(156,163,175,0.12); border: 1px solid rgba(156,163,175,0.25); }
.status-badge-chamado { color: #4ade80; background: rgba(74,222,128,0.12); border: 1px solid rgba(74,222,128,0.25); }
.status-badge-aceitou { color: #60a5fa; background: rgba(96,165,250,0.12); border: 1px solid rgba(96,165,250,0.25); }
.status-badge-recusou { color: #f87171; background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.25); }
.status-badge-site_feito { color: #a78bfa; background: rgba(167,139,250,0.12); border: 1px solid rgba(167,139,250,0.25); }
.status-badge-pago { color: #fbbf24; background: rgba(251,191,36,0.12); border: 1px solid rgba(251,191,36,0.25); }

/* ============= Sidebar ============= */
.sidebar-bairro {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  background: transparent;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  font-size: 0.875rem;
}

.sidebar-bairro:hover {
  background: rgba(249,115,22,0.08);
  border-color: rgba(249,115,22,0.2);
}

.sidebar-bairro.active {
  background: rgba(249,115,22,0.12);
  border-color: rgba(249,115,22,0.4);
  color: #f97316;
  font-weight: 600;
}

/* ============= Filter Chips ============= */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  background: #16161a;
  border: 1px solid rgba(255,255,255,0.06);
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  border-color: rgba(255,255,255,0.12);
  background: #1c1c21;
}

.filter-chip.active {
  background: rgba(249,115,22,0.12);
  border-color: rgba(249,115,22,0.4);
  color: #f97316;
}

/* ============= View Tab Buttons ============= */
.view-tab-active {
  border-color: rgba(249,115,22,0.5) !important;
  background: rgba(249,115,22,0.1) !important;
  color: #f97316 !important;
}

/* ============= WhatsApp Button ============= */
.btn-whatsapp {
  background: var(--color-whatsapp);
  color: white;
  border: none;
  transition: all 0.15s ease;
}

.btn-whatsapp:hover {
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(37,211,102,0.3);
}

/* ============= Social Button ============= */
.social-btn { transition: all 0.15s ease; }
.social-btn:hover { transform: scale(1.08); }

/* ============= Panel Overlay & Slide-Over ============= */
.panel-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 40;
  backdrop-filter: blur(4px);
}

.panel-overlay.active { opacity: 1; pointer-events: auto; }

.slide-over {
  position: fixed;
  top: 0; right: 0;
  width: 500px;
  height: 100%;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: -4px 0 24px rgba(0,0,0,0.5);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 50;
  overflow-y: auto;
}

.slide-over.active { transform: translateX(0); }

.slide-over-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.slide-over-close {
  background: transparent;
  border: none;
  color: var(--color-text);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.slide-over-close:hover { background: rgba(255,255,255,0.06); }

.slide-over-body { padding: 1.5rem; }

/* ============= Toast ============= */
.toast {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  box-shadow: 0 12px 24px rgba(0,0,0,0.4);
  animation: slideInRight 0.3s ease-out;
  max-width: 400px;
  pointer-events: auto;
}

.toast.success { border-left: 4px solid #4ade80; }
.toast.error { border-left: 4px solid #f87171; }
.toast.info { border-left: 4px solid #60a5fa; }
.toast.closing { animation: slideOutRight 0.3s ease-out; }

/* ============= Leaflet Dark Theme ============= */
#map { background: #111114; }
.leaflet-container { background: #111114; }
.leaflet-tile-pane { filter: brightness(0.7) contrast(1.1) saturate(0.3) hue-rotate(180deg) invert(1); }
.leaflet-control-zoom a { background: #1c1c21 !important; color: #9ca3af !important; border-color: rgba(255,255,255,0.06) !important; }
.leaflet-control-zoom a:hover { background: #222228 !important; color: #f97316 !important; }
.leaflet-popup-content-wrapper { background: #16161a; color: #e5e7eb; border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.6); }
.leaflet-popup-tip { background: #16161a; }
.leaflet-popup-content { margin: 12px 16px; font-family: 'Inter', sans-serif; }
.leaflet-popup-content a { color: #f97316; }
.leaflet-control-attribution { background: rgba(17,17,20,0.8) !important; color: #6b7280 !important; }
.leaflet-control-attribution a { color: #9ca3af !important; }

/* ============= Mobile Sidebar ============= */
.sidebar-overlay { display: none; }

@media (max-width: 1023px) {
  .sidebar-overlay.visible {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 45;
    backdrop-filter: blur(4px);
  }
  .sidebar-panel {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 50;
    width: 300px;
  }
  .sidebar-panel.open { transform: translateX(0); }
}

/* ============= Mobile Responsive ============= */
@media (max-width: 768px) {
  .slide-over { width: 100%; }
  .toast { bottom: 1rem; right: 1rem; left: 1rem; max-width: none; }
}

/* ============= Utility ============= */
.hidden { display: none !important; }
input::placeholder { color: #5a5a66; }
