/* KFS Redesigned Layout - Mobile-First Approach */

:root {
  --kfs-orange: #ff6600;
  --kfs-dark-orange: #ff3300;
  --kfs-navy: #0A1F33;
  --kfs-dark-blue: #2e4063;
  --kfs-white: #ffffff;
  --kfs-gray-light: #f5f5f5;
  --kfs-gray: #666666;
  --kfs-danger-red: #dc3545;
  --kfs-success-green: #28a745;
  --kfs-info-blue: #007bff;
  --kfs-warning-yellow: #ffc107;
  --header-height: 56px;
  --bottom-nav-height: 60px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--kfs-gray-light);
  overflow-x: hidden;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--kfs-orange);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-icon {
  font-size: 24px;
}

.header-title {
  font-size: 16px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.2);
}

.icon-btn img {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
}

/* Main Container */
.app-container {
  padding-top: var(--header-height);
  padding-bottom: var(--bottom-nav-height);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Map Container */
.map-container {
  flex: 1;
  position: relative;
  background: #1a2332;
}

#map {
  width: 100%;
  height: 100%;
}

/* Map Overlay Controls - Fixed Position */
.map-overlay-controls {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 500;
}

.map-overlay-controls > * {
  pointer-events: auto;
}

/* Report Fire Button */
.report-fire-btn {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--kfs-dark-orange), #ff0000);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 24px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255,0,0,0.3);
  transition: transform 0.2s;
}

.report-fire-btn:active {
  transform: translateX(-50%) scale(0.95);
}

/* Layers Toggle Button */
.layers-toggle-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  background: white;
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.layers-icon {
  font-size: 20px;
  font-weight: bold;
}

/* Fire Danger Panel */
.fire-danger-panel {
  position: absolute;
  bottom: 20px;
  left: 16px;
  right: 16px;
  background: rgba(10, 31, 51, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 12px 16px;
  color: white;
}

.danger-label {
  font-size: 11px;
  opacity: 0.7;
  margin-bottom: 4px;
}

.danger-level {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.danger-level.extreme {
  color: #ff3333;
}

.danger-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
}

/* Layers Panel */
.layers-panel {
  position: absolute;
  top: 70px;
  right: 16px;
  width: 200px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 600;
  max-height: 70vh;
  overflow-y: auto;
}

.layers-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
}

.layers-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  line-height: 1;
}

.layers-content {
  padding: 8px;
}

.layer-item {
  display: flex;
  align-items: center;
  padding: 8px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
}

.layer-item:hover {
  background: #f5f5f5;
}

.layer-item input[type="checkbox"] {
  margin-right: 12px;
  width: 18px;
  height: 18px;
}

.layer-divider {
  margin: 8px 0;
  border: none;
  border-top: 1px solid #e0e0e0;
}

.layer-hydrants { color: #e11b1b; font-weight: 600; }
.layer-transformers { color: #f6c744; font-weight: 600; }
.layer-pools { color: #2b7cff; font-weight: 600; }
.layer-cisterns { color: #31b24b; font-weight: 600; }
.layer-watertanks { color: #7525ee; font-weight: 600; }
.layer-fires { color: #ff3300; font-weight: 600; }

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: white;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #999;
  padding: 8px 4px;
  cursor: pointer;
  border: none;
  background: none;
  transition: color 0.2s;
}

.nav-item.active {
  color: var(--kfs-orange);
}

.nav-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 4px;
  filter: grayscale(100%);
  opacity: 0.6;
}

.nav-item.active .nav-icon {
  filter: none;
  opacity: 1;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* More Menu */
.more-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
}

.more-menu-panel {
  position: absolute;
  top: 0;
  right: -100%;
  width: 85%;
  max-width: 320px;
  height: 100vh;
  background: white;
  transition: right 0.3s ease;
  overflow-y: auto;
}

.more-menu-panel.active {
  right: 0;
}

.more-menu-header {
  background: var(--kfs-navy);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-category {
  border-left: 4px solid #ddd;
  margin-bottom: 20px;
}

.menu-category.red { border-left-color: var(--kfs-danger-red); }
.menu-category.orange { border-left-color: var(--kfs-orange); }
.menu-category.blue { border-left-color: var(--kfs-info-blue); }

.menu-category h4 {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid #e0e0e0;
}

.menu-item-btn {
  width: 100%;
  padding: 14px 16px;
  background: white;
  border: none;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid #f5f5f5;
}

.menu-item-btn:hover {
  background: #f8f9fa;
}

.menu-icon {
  font-size: 20px;
  width: 28px;
}

.menu-text {
  flex: 1;
  text-align: left;
  font-size: 14px;
  color: #333;
}

.menu-arrow {
  color: #999;
  font-size: 18px;
}

/* Report Modal */
.report-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.report-modal-content {
  background: white;
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.report-header {
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.report-body {
  padding: 20px;
}

.alert-box {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: #333;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--kfs-orange);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary {
  padding: 8px 12px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  margin-top: 6px;
}

/* Desktop Adjustments */
@media (min-width: 768px) {
  .header-title {
    font-size: 20px;
  }
  
  .app-container {
    padding-bottom: 0;
  }
  
  .bottom-nav {
    display: none;
  }
  
  .fire-danger-panel {
    width: 280px;
    left: auto;
    right: 16px;
  }
  
  .report-fire-btn {
    left: 16px;
    transform: none;
  }
  
  /* Show desktop navigation in header */
  .header-right {
    gap: 16px;
  }
  
  .desktop-nav {
    display: flex;
    gap: 12px;
    margin-right: 16px;
  }
  
  .desktop-nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    transition: background 0.2s;
  }
  
  .desktop-nav a:hover {
    background: rgba(255,255,255,0.2);
  }
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Animations */
@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}