/* ═══════════════════════════════════════════════════════════════
   GIS-Điện Bàn Bắc — GeoAI Assistant Styles
   ═══════════════════════════════════════════════════════════════ */

/* ─── FAB Button ─── */
.geoai-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: linear-gradient(135deg, #006D5B 0%, #17A7B8 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 109, 91, 0.45), 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s var(--md-sys-motion-easing-emphasized),
    box-shadow 0.2s ease;
  overflow: visible;
}

.geoai-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 109, 91, 0.55), 0 4px 12px rgba(0, 0, 0, 0.25);
}

.geoai-fab.active {
  background: linear-gradient(135deg, #004D3F 0%, #0D8A99 100%);
  transform: scale(0.96);
}

.geoai-fab .material-symbols-outlined {
  color: #fff;
  font-size: 26px;
  transition: transform 0.2s ease;
}

.geoai-fab-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: linear-gradient(135deg, #F9A825, #FF6B00);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 99px;
  border: 2px solid #fff;
  pointer-events: none;
}

/* ─── Chat Panel ─── */
.geoai-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 8999;
  width: 420px;
  max-height: 600px;
  border-radius: 20px;
  background: var(--md-sys-color-surface-container-lowest);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18), 0 2px 12px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--md-sys-color-outline-variant);
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s var(--md-sys-motion-easing-emphasized-decelerate),
    opacity 0.25s ease;
}

.geoai-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ─── Panel Header ─── */
.geoai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #006D5B 0%, #0E8A99 100%);
  flex-shrink: 0;
}

.geoai-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.geoai-header-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.geoai-header-avatar .material-symbols-outlined {
  color: #fff;
  font-size: 22px;
}

.geoai-online-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #4CAF50;
  border-radius: 50%;
  border: 2px solid #006D5B;
  animation: onlinePulse 2s infinite;
}

@keyframes onlinePulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.geoai-header-title {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}

.geoai-header-sub {
  color: rgba(255, 255, 255, 0.75);
  font-size: 11px;
  line-height: 1.4;
}

.geoai-header-actions {
  display: flex;
  gap: 4px;
}

.geoai-hdr-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.9);
  transition: background 0.15s;
}

.geoai-hdr-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.geoai-hdr-btn .material-symbols-outlined {
  font-size: 18px;
}

/* ─── Chat Body ─── */
.geoai-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--md-sys-color-surface-container-low);
}

/* ─── Messages ─── */
.ai-chat-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.ai-chat-msg.visible {
  opacity: 1;
  transform: translateY(0);
}

.ai-chat-msg.user {
  flex-direction: row-reverse;
}

.ai-chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
}

.ai-chat-avatar.ai {
  background: linear-gradient(135deg, #006D5B, #17A7B8);
}

.ai-chat-avatar.ai .material-symbols-outlined {
  color: #fff;
  font-size: 16px;
}

.ai-chat-avatar.user {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.ai-chat-bubble {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid transparent;
}

.ai-chat-msg.ai .ai-chat-bubble {
  background: var(--md-sys-color-surface-container-lowest);
  border-color: var(--md-sys-color-outline-variant);
  border-radius: 4px 16px 16px 16px;
}

.ai-chat-msg.user .ai-chat-bubble {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-radius: 16px 4px 16px 16px;
}

/* ─── Typing indicator ─── */
.ai-typing-dots {
  display: flex;
  gap: 4px;
  padding: 4px 2px;
  align-items: center;
}

.ai-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--md-sys-color-outline);
  animation: typingBounce 1.2s infinite;
}

.ai-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }

  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.ai-typing-step {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--md-sys-color-on-surface-variant);
  font-style: italic;
}

/* ─── Result Cards ─── */
.ai-result-card {
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  padding: 10px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-result-card.warning {
  border-color: rgba(186, 26, 26, 0.25);
  background: rgba(255, 218, 214, 0.15);
}

.ai-result-card.info {
  border-color: rgba(23, 167, 184, 0.25);
  background: rgba(23, 167, 184, 0.06);
}

.ai-result-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.ai-result-badge {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  flex-shrink: 0;
  margin-top: 1px;
}

.ai-result-badge.danger {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.ai-result-badge.warning-badge {
  background: #FFF3CD;
  color: #856404;
}

.ai-result-badge.ok-badge {
  background: #D4EDDA;
  color: #155724;
}

.ai-result-detail {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--md-sys-color-on-surface);
}

.ai-list {
  padding-left: 16px;
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.8;
}

.ai-tip {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container);
  padding: 6px 10px;
  border-radius: 8px;
}

/* ─── Action Button ─── */
.ai-action-btn {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: none;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  font-family: inherit;
}

.ai-action-btn:hover {
  background: #00574A;
  transform: translateY(-1px);
}

.ai-action-btn:disabled {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
  cursor: default;
  transform: none;
}

.ai-action-btn .material-symbols-outlined {
  font-size: 16px;
}

/* ─── Suggestions ─── */
.ai-suggestions-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.ai-suggestions-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--md-sys-color-on-surface-variant);
  padding: 0 2px;
}

.ai-suggestion-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.15s;
}

.ai-suggestion-chip:hover {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: var(--md-sys-color-primary);
  transform: translateX(3px);
}

.ai-suggestion-chip .material-symbols-outlined {
  font-size: 16px;
  color: var(--md-sys-color-primary);
  flex-shrink: 0;
}

.ai-suggestion-chip:hover .material-symbols-outlined {
  color: var(--md-sys-color-on-primary-container);
}

/* ─── Input Area ─── */
.geoai-input-area {
  padding: 12px 14px 10px;
  background: var(--md-sys-color-surface-container-lowest);
  border-top: 1px solid var(--md-sys-color-outline-variant);
  flex-shrink: 0;
}

.geoai-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.geoai-input {
  flex: 1;
  padding: 10px 13px;
  background: var(--md-sys-color-surface-container-low);
  border: 1.5px solid var(--md-sys-color-outline-variant);
  border-radius: 14px;
  font-family: var(--md-sys-typescale-font-family-text);
  font-size: 13px;
  color: var(--md-sys-color-on-surface);
  resize: none;
  outline: none;
  max-height: 120px;
  transition: border-color 0.2s;
  line-height: 1.5;
}

.geoai-input:focus {
  border-color: var(--md-sys-color-primary);
  background: var(--md-sys-color-surface-container-lowest);
}

.geoai-input::placeholder {
  color: var(--md-sys-color-on-surface-variant);
  opacity: 0.7;
}

.geoai-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.geoai-send-btn:hover {
  background: #00574A;
  transform: scale(1.05);
}

.geoai-send-btn .material-symbols-outlined {
  font-size: 20px;
}

.geoai-input-footer {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--md-sys-color-on-surface-variant);
  opacity: 0.75;
}

/* ─── Map markers ─── */
.ai-map-marker {
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 0;
  background: #fff;
  border: 2.5px solid #006D5B;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

.ai-map-marker .material-symbols-outlined {
  transform: rotate(45deg);
  font-size: 18px;
  color: #006D5B;
}

.ai-map-popup {
  font-family: 'Inter', sans-serif;
  min-width: 180px;
}

.ai-map-popup-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #006D5B;
  margin-bottom: 4px;
}

.ai-map-popup-header .material-symbols-outlined {
  font-size: 16px;
}

.ai-map-popup-body {
  font-size: 12px;
  color: #3F4945;
  line-height: 1.5;
}

/* ─── Pulse animation for AI layers ─── */
@keyframes aiLayerPulse {

  0%,
  100% {
    opacity: 0.25;
  }

  50% {
    opacity: 0.55;
  }
}

.ai-pulse-layer {
  animation: aiLayerPulse 2s ease-in-out infinite;
}

/* ─── Responsive: narrow screens ─── */
@media (max-width: 480px) {
  .geoai-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 90px;
  }

  .geoai-fab {
    bottom: 20px;
    right: 16px;
  }
}