:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #6b7280;
  --success-color: #059669;
  --warning-color: #d97706;
  --error-color: #dc2626;
  --background: #ffffff;
  --surface: #f8fafc;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --border-radius: 8px;
  --transition: all 0.2s ease-in-out;
}

[data-theme="dark"] {
  --background: #1f2937;
  --surface: #374151;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --border-color: #4b5563;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
}

.header h1 i {
  margin-right: 0.5rem;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

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

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

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-voice {
  background: var(--success-color);
  color: white;
}

.btn-voice:hover {
  background: #047857;
}

.btn-voice.recording {
  background: var(--error-color);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Main Content */
.main-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-header h2 i {
  margin-right: 0.5rem;
  color: var(--primary-color);
}

/* Map Section */
.map-section {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.map-wrapper {
  border-radius: var(--border-radius);
  overflow: hidden;
  min-height: 400px;
}

.map-controls {
  display: flex;
  gap: 0.5rem;
}

/* AI Section */
.ai-section {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.chat-container {
  height: 400px;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--background);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.message {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.ai-message .message-avatar {
  background: var(--primary-color);
  color: white;
}

.user-message .message-avatar {
  background: var(--success-color);
  color: white;
}

.message-content {
  flex: 1;
}

.message-content p {
  margin-bottom: 0.25rem;
}

.message-time {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

.input-group input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--background);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

/* Quick Actions */
.quick-actions {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.quick-actions h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.quick-actions h3 i {
  margin-right: 0.5rem;
  color: var(--warning-color);
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.action-card {
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.action-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

.action-card i {
  font-size: 1.5rem;
  color: var(--primary-color);
}

.action-card span {
  font-weight: 500;
  color: var(--text-primary);
}

/* Documentation */
.docs-section {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.docs-content {
  overflow: hidden;
  transition: var(--transition);
}

.docs-content.collapsed {
  max-height: 0;
  opacity: 0;
}

.docs-content:not(.collapsed) {
  max-height: 1000px;
  opacity: 1;
}

.docs-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel ul {
  list-style: none;
  padding-left: 0;
}

.tab-panel li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.tab-panel li:last-child {
  border-bottom: none;
}

kbd {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 0.1rem 0.3rem;
  font-family: monospace;
  font-size: 0.75rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  color: white;
}

.loading-overlay.hidden {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease-out;
  min-width: 300px;
}

.toast.success {
  border-left: 4px solid var(--success-color);
}

.toast.error {
  border-left: 4px solid var(--error-color);
}

.toast.warning {
  border-left: 4px solid var(--warning-color);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive Design */
@media (min-width: 768px) {
  .main-content {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto auto;
  }
  
  .map-section {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
  }
  
  .ai-section {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
  }
  
  .quick-actions {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
  }
  
  .docs-section {
    grid-column: 1 / -1;
  }
}

@media (max-width: 767px) {
  .container {
    padding: 0 15px;
  }
  
  .header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .header h1 {
    font-size: 1.5rem;
  }
  
  .actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .chat-container {
    height: 300px;
  }
  
  .docs-tabs {
    flex-wrap: wrap;
  }
  
  .section-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .toast {
    min-width: auto;
    left: 20px;
    right: 20px;
  }
}

@media (max-width: 480px) {
  .actions-grid {
    grid-template-columns: 1fr;
  }
  
  .input-group {
    flex-direction: column;
  }
  
  .map-controls {
    justify-content: center;
  }
}