/* Custom styles for Observable Framework market data tables */

/* Global table improvements */
table {
  width: 100% !important;
  table-layout: auto !important;
  border-collapse: collapse;
}

/* Make name column (5th column) wider and prevent text truncation */
table td:nth-child(5), 
table th:nth-child(5) {
  min-width: 300px !important;
  max-width: none !important;
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow: visible !important;
  text-overflow: clip !important;
  width: 300px !important;
}

/* General cell styling to prevent ellipsis */
table td {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  padding: 8px 12px;
  vertical-align: top;
  max-width: none !important;
}

table th {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  padding: 8px 12px;
  font-weight: bold;
}

/* Specific styling for Observable Framework table containers */
.observablehq table,
.observablehq-table table {
  table-layout: auto !important;
  width: 100% !important;
}

.observablehq table td:nth-child(5),
.observablehq table th:nth-child(5),
.observablehq-table table td:nth-child(5),
.observablehq-table table th:nth-child(5) {
  min-width: 300px !important;
  width: 300px !important;
  max-width: none !important;
  white-space: normal !important;
  word-wrap: break-word !important;
  text-overflow: clip !important;
  overflow: visible !important;
}

/* Ensure responsive behavior while maintaining name column width */
@media (max-width: 768px) {
  table {
    font-size: 14px;
  }
  
  table td:nth-child(5), 
  table th:nth-child(5) {
    min-width: 250px !important;
    width: 250px !important;
  }
}

/* Additional styling for Observable specific elements */
.observablehq--table-container {
  overflow-x: auto;
}

/* Make sure table cells don't use ellipsis by default */
* {
  text-overflow: clip !important;
}

/* PWA-specific styles */
@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Loading states for data updates */
.data-loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.data-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #4f46e5;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Better mobile experience */
@media (max-width: 768px) {
  .install-button,
  .notification {
    bottom: 10px !important;
    right: 10px !important;
    left: 10px !important;
    max-width: none !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .notification {
    border: 2px solid currentColor;
  }
  
  button {
    border: 2px solid currentColor;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .notification,
  .install-button,
  .data-loading::after {
    animation: none;
    transition: none;
  }
}
