/**
 * Collaborative Analytics Canvas - Styles
 * Modern dark theme with collaboration-focused design
 */

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

#container {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  min-height: 500px;
  position: relative;
  overflow: hidden;
}

/* Chart Container */
.chart-container {
  background: #1e293b;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #334155;
  position: relative;
}

#chart {
  width: 100%;
  position: relative;
}

/* Grid Styling */
.grid line {
  stroke: #334155;
  stroke-width: 1;
  stroke-opacity: 0.5;
}

/* Annotations */
.annotation-container {
  margin-bottom: 1rem;
}

.add-annotation-btn {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.add-annotation-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.annotation {
  cursor: pointer;
  transition: all 0.2s;
}

.annotation:hover circle {
  r: 8;
  fill: #60a5fa;
}

.annotation text {
  pointer-events: none;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

/* Forecast Overlay */
.forecast-container {
  margin-bottom: 1rem;
}

.forecast-overlay {
  pointer-events: none;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: #1e293b;
  border-radius: 0.375rem;
  border: 1px solid #334155;
  color: #94a3b8;
  animation: pulse 2s infinite;
}

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

/* Live Cursors */
.cursor-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

.remote-cursor {
  position: absolute;
  transition: all 0.1s ease-out;
  pointer-events: none;
  z-index: 1001;
}

.cursor-dot {
  width: 12px;
  height: 12px;
  background: #3b82f6;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.cursor-label {
  position: absolute;
  top: 18px;
  left: 18px;
  background: #3b82f6;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* SQL Editor */
.sql-editor-container {
  background: #1e293b;
  border-radius: 0.75rem;
  padding: 1rem;
  border: 1px solid #334155;
  margin-bottom: 1rem;
}

.sql-editor-container h3 {
  color: #cbd5e1;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

#sql-query {
  width: 100%;
  min-height: 100px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  padding: 0.75rem;
  color: #e2e8f0;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  resize: vertical;
  margin-bottom: 0.75rem;
}

#sql-query:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.sql-editor-container button {
  background: #10b981;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.sql-editor-container button:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

#query-results {
  margin-top: 1rem;
  max-height: 400px;
  overflow: auto;
}

/* Query Results Table */
.query-results-table {
  width: 100%;
  border-collapse: collapse;
  background: #0f172a;
  border-radius: 0.375rem;
  overflow: hidden;
}

.query-results-table th {
  background: #1e293b;
  color: #94a3b8;
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #334155;
}

.query-results-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #1e293b;
  color: #e2e8f0;
  font-size: 0.875rem;
}

.query-results-table tr:hover {
  background: #1e293b;
}

/* Error Messages */
.error-message,
.error {
  background: #7f1d1d;
  border: 1px solid #991b1b;
  color: #fecaca;
  padding: 1rem;
  border-radius: 0.375rem;
  margin: 1rem 0;
}

/* Notifications */
.notification {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: #1e293b;
  border: 1px solid #3b82f6;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease-out;
  z-index: 2000;
}

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

/* User Avatars */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.75rem;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Presence Indicator */
.presence-list {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  z-index: 100;
}

.presence-indicator {
  position: relative;
}

.presence-indicator::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #10b981;
  border: 2px solid #0f172a;
  border-radius: 50%;
}

/* Responsive Design */
@media (max-width: 768px) {
  #container {
    padding: 0.5rem;
  }

  .chart-container,
  .sql-editor-container {
    padding: 0.75rem;
  }

  .cursor-label {
    font-size: 0.625rem;
    padding: 0.125rem 0.25rem;
  }
}

/* Accessibility */
:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1e293b;
}

::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}
