/* Mobile UI Styles - All scoped under body.is-mobile */

/* Hide desktop-only elements */
body.is-mobile .sidebar,
body.is-mobile .main-wrapper,
body.is-mobile .content-area,
body.is-mobile .agent-divider,
body.is-mobile #graph-container,
body.is-mobile #map-container,
body.is-mobile .node-legend,
body.is-mobile .map-legend,
body.is-mobile #alerts-dropdown-container,
body.is-mobile #header-stats,
body.is-mobile #loading-indicator,
body.is-mobile #error-message,
body.is-mobile #documentModal,
body.is-mobile #nodeModal {
  display: none !important;
}

/* Header adjustments for mobile */
body.is-mobile .app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 50px;
  padding: 0 12px;
  display: flex;
  align-items: center;
}

body.is-mobile .app-header h1 {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.is-mobile .app-container {
  display: block;
}

/* Mobile Tab Bar */
.mobile-tab-bar {
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  height: 48px;
  background: var(--bg-primary, #ffffff);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  z-index: 999;
}

.mobile-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none !important;
  background: transparent !important;
  color: var(--text-secondary, #64748b) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  padding: 0 8px !important;
  margin: 0 !important;
  width: auto !important;
  outline: none !important;
  box-shadow: none !important;
  transform: none !important;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.mobile-tab-btn:hover,
.mobile-tab-btn:focus,
.mobile-tab-btn:active {
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  outline: none !important;
}

.mobile-tab-btn.active {
  color: var(--accent-color, #4f46e5) !important;
  border-bottom-color: var(--accent-color, #4f46e5) !important;
}

.mobile-tab-btn svg {
  width: 18px;
  height: 18px;
}

/* Panel Viewport */
.mobile-panel-viewport {
  position: fixed;
  top: 98px; /* 50px header + 48px tab bar */
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 1;
  touch-action: pan-y;
}

.mobile-panel-track {
  display: flex;
  width: 300%;
  height: 100%;
  transition: transform 0.3s ease;
  touch-action: pan-y;
}

.mobile-panel-track.swiping {
  transition: none;
}

.mobile-panel {
  width: 100vw;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* Alerts Panel */
.mobile-panel-alerts {
  padding: 12px;
  background: var(--bg-secondary, #f8fafc);
}

.mobile-alerts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 12px;
}

.mobile-alerts-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  margin: 0;
}

.mobile-alerts-refresh {
  display: flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--accent-color, #4f46e5);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
}

.mobile-alerts-refresh:active {
  background: var(--bg-hover, #e2e8f0);
}

.mobile-alerts-refresh svg {
  width: 16px;
  height: 16px;
}

/* Alerts list styling inside mobile panel */
.mobile-panel-alerts #alerts-dropdown-content {
  display: block;
}

.mobile-panel-alerts #alerts-dropdown-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary, #64748b);
  font-size: 14px;
}

.mobile-panel-alerts .me-event {
  margin-bottom: 10px;
  border-radius: 8px;
}

/* GraphAgent Panel - override modal styles for embedded mode */
.mobile-panel-agent #graph-agent-modal {
  position: static !important;
  display: flex !important;
  flex-direction: column;
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  max-height: none !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: var(--bg-primary, #ffffff);
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
}

.mobile-panel-agent #graph-agent-modal .ga-header {
  flex-shrink: 0;
}

.mobile-panel-agent #graph-agent-modal .ga-close {
  display: none !important;
}

.mobile-panel-agent #graph-agent-modal #ga-messages {
  flex: 1;
  overflow-y: auto;
}

.mobile-panel-agent #graph-agent-modal .ga-actions {
  flex-shrink: 0;
}

.mobile-panel-agent #graph-agent-modal .ga-input-area {
  flex-shrink: 0;
}

/* Session History Panel - override modal styles for embedded mode */
.mobile-panel-history #session-history-modal {
  position: static !important;
  display: flex !important;
  flex-direction: column;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: var(--bg-primary, #ffffff);
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
}

.mobile-panel-history #session-history-modal .ga-close {
  display: none !important;
}

.mobile-panel-history #session-history-modal .sh-sessions {
  flex: 1;
  overflow-y: auto;
}

/* Dark mode support */
[data-theme="dark"] .mobile-tab-bar {
  background: var(--bg-primary, #1e293b);
  border-bottom-color: var(--border-color, #334155);
}

[data-theme="dark"] .mobile-panel-alerts {
  background: var(--bg-secondary, #0f172a);
}

/* PDF export button - always visible on mobile (no hover state) */
body.is-mobile .ga-pdf-icon {
  opacity: 0.5 !important;
}

body.is-mobile .ga-pdf-icon:active {
  opacity: 1 !important;
}
