/* ===== OPERATIVO FORESTAL PRO — Google-Style Design System ===== */
:root {
  --primary: #1F6F4A;
  --primary-light: #E8F5EE;
  --primary-dark: #145236;
  --accent: #34A853;
  --danger: #EA4335;
  --warning: #FBBC04;
  --blue: #4285F4;

  /* Google-style surfaces */
  --bg: #FFFFFF;
  --bg-surface: #F8F9FA;
  --bg-hover: #F1F3F4;
  --border: #DADCE0;
  --border-light: #E8EAED;

  /* Text */
  --text-primary: #202124;
  --text-secondary: #5F6368;
  --text-hint: #9AA0A6;

  /* Sidebar */
  --sidebar-w: 68px;
  --sidebar-w-expanded: 240px;
  --sidebar-bg: #FFFFFF;
  --sidebar-border: #E8EAED;
  --sidebar-active: #E8F5EE;
  --sidebar-icon: #5F6368;
  --sidebar-icon-active: #1F6F4A;

  /* Bottom nav (mobile) */
  --bottomnav-h: 60px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(60, 64, 67, 0.10);
  --shadow-sm: 0 1px 3px rgba(60, 64, 67, 0.12), 0 1px 2px rgba(60, 64, 67, 0.10);
  --shadow-md: 0 4px 12px rgba(60, 64, 67, 0.15);
  --shadow-lg: 0 8px 24px rgba(60, 64, 67, 0.18);
}

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

body {
  font-family: "Public Sans", "Google Sans", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #BBBFC3;
}

/* ===== APP SHELL ===== */
.app-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ===== TOPBAR ===== */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1200;
  width: 100%;
  height: 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

/* ===== SIDEBAR (Desktop) ===== */
.sidebar {
  position: fixed;
  left: 0;
  top: 56px;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1100;
  box-shadow: var(--shadow-xs);
}

.sidebar.expanded {
  width: var(--sidebar-w-expanded);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  height: 52px;
  cursor: pointer;
  border-radius: 0 26px 26px 0;
  margin: 0 8px 2px 0;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  color: var(--text-secondary);
  text-decoration: none;
  user-select: none;
}

.sidebar-item:hover {
  background: var(--bg-hover);
}

.sidebar-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-icon-active);
  font-weight: 600;
}

.sidebar-item .sidebar-icon {
  flex-shrink: 0;
  font-size: 22px;
  color: inherit;
  transition: color 0.15s;
}

.sidebar-item .sidebar-label {
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.15s;
  color: inherit;
}

.sidebar.expanded .sidebar-label {
  opacity: 1;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: 56px;
  flex: 1;
  min-width: 0;
  transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-surface);
  min-height: calc(100vh - 56px);
}

.main-content.sidebar-expanded {
  margin-left: var(--sidebar-w-expanded);
}

/* Inner padding for non-map views */
.module-pad {
  padding: 20px 24px 32px;
}

/* ===== FAUNA ICON BADGE ===== */
.fauna-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

/* ===== CLIENT MAP VIEW ===== */
.clients-map-shell {
  position: relative;
  width: 100%;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.clients-map-container {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* Client side panel (desktop) */
.client-side-panel {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 300px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  z-index: 10;
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.client-side-panel.hidden {
  transform: translateX(-310px);
}

/* Client form panel (slides from right) */
.client-form-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 340px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 10;
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.client-form-panel.hidden {
  transform: translateX(360px);
}

/* Panel header */
.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
  flex-shrink: 0;
}

.panel-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

/* Client list in panel */
.client-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.client-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid var(--border-light);
}

.client-list-item:hover {
  background: var(--bg-hover);
}

.client-list-item.active {
  background: var(--primary-light);
}

.client-list-item .client-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.client-list-item .client-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

/* FAB for new client */
.fab {
  position: absolute;
  bottom: 20px;
  left: 316px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  z-index: 20;
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}

.fab:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-lg);
  transform: scale(1.06);
}

/* Toggle panel button */
.panel-toggle-btn {
  position: absolute;
  top: 16px;
  left: 14px;
  z-index: 20;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s;
}

.panel-toggle-btn:hover {
  background: var(--bg-hover);
}

/* ===== CUSTOM MAP POPUP ===== */
.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  box-shadow: var(--shadow-md) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  min-width: 200px;
}

.map-popup {
  padding: 14px 16px;
  font-family: "Public Sans", sans-serif;
}

.map-popup h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.map-popup p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 2px 0;
}

.map-popup-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.map-popup-btn {
  flex: 1;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--primary);
  transition: background 0.12s;
}

.map-popup-btn:hover {
  background: var(--primary-light);
}

.map-popup-btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.map-popup-btn.primary:hover {
  background: var(--primary-dark);
}

/* ===== MODULE CARDS (Google-style) ===== */
.g-card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.g-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 12px;
}

.g-card-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.g-card-body {
  padding: 16px 20px;
}

/* Module section header */
.section-hero {
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
  color: white;
  display: flex;
  align-items: center;
  gap: 16px;
}

.section-hero h2 {
  font-size: 20px;
  font-weight: 700;
}

.section-hero p {
  font-size: 13px;
  opacity: 0.88;
  margin-top: 2px;
}

/* ===== LEAFLET OVERRIDES ===== */
.leaflet-container {
  font-family: "Public Sans", sans-serif !important;
}

.leaflet-control-zoom {
  border-radius: 10px !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
}

.leaflet-control-zoom a {
  color: var(--text-primary) !important;
}

/* ===== MOBILE — Bottom Navigation ===== */
@media (max-width: 900px) {
  .sidebar {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    margin-bottom: var(--bottomnav-h);
    min-height: calc(100vh - 56px - var(--bottomnav-h));
  }

  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottomnav-h);
    background: var(--bg);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 8px rgba(60, 64, 67, 0.10);
    display: flex;
    align-items: center;
    z-index: 1100;
    padding: 0 4px;
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 100%;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.15s;
    font-size: 10px;
    font-weight: 500;
    border: none;
    background: none;
    padding: 0;
  }

  .bottom-nav-item .material-icons {
    font-size: 22px;
  }

  .bottom-nav-item.active {
    color: var(--primary);
  }

  .bottom-nav-item.active .material-icons {
    background: var(--primary-light);
    border-radius: 14px;
    padding: 4px 12px;
  }

  /* Clients map mobile */
  .clients-map-shell {
    height: calc(100vh - 56px - var(--bottomnav-h));
  }

  .client-side-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 55%;
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    transform: translateY(0);
    box-shadow: 0 -4px 20px rgba(60, 64, 67, 0.15);
  }

  .client-side-panel.hidden {
    transform: translateY(110%);
  }

  .client-form-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 90%;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    transform: translateY(0);
  }

  .client-form-panel.hidden {
    transform: translateY(110%);
  }

  .fab {
    left: auto;
    right: 16px;
    bottom: 16px;
  }

  .panel-toggle-btn {
    left: 10px;
    top: 10px;
  }

  .module-pad {
    padding: 10px 6px 20px;
  }
}

@media (min-width: 901px) {
  .bottom-nav {
    display: none !important;
  }
}

/* ===== FORM FIELDS Google style ===== */
.g-field {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 48px;
}

.g-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 74, 0.10);
}

.g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.15s, box-shadow 0.15s;
}

.g-btn-primary {
  background: var(--primary);
  color: white;
}

.g-btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

.g-btn-outlined {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.g-btn-outlined:hover {
  background: var(--primary-light);
}

/* ===== RADIAL MAP MENU ===== */
.radial-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: transparent;
}

.radial-menu {
  position: absolute;
  pointer-events: none;
}

.radial-menu-item {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  animation: radial-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  transform: scale(0.3);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  gap: 1px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.radial-menu-item:active {
  transform: scale(0.9) !important;
}

.radial-menu-item .radial-icon {
  font-size: 22px;
  line-height: 1;
}

.radial-menu-item .radial-label {
  font-size: 8px;
  line-height: 1;
  opacity: 0.9;
}

@keyframes radial-pop {
  to {
    opacity: 1;
    transform: scale(1);
  }
}