/* Modal Overlay for Table Attachments */

.table-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  animation: fadeIn 0.15s ease-out;
}

.table-modal-overlay.hidden {
  display: none;
}

.table-modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.2s ease-out;
}

.table-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  background: #f8f9fa;
  border-radius: 8px 8px 0 0;
}

.table-modal-title {
  font-family: monospace;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-modal-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.table-modal-button {
  background: white;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: system-ui, -apple-system, sans-serif;
  color: #333;
}

.table-modal-button:hover {
  background: #f0f0f0;
  border-color: #b0b0b0;
}

.table-modal-button:active {
  transform: scale(0.97);
}

.table-modal-button.copy-button.copied {
  background: #4caf50;
  color: white;
  border-color: #4caf50;
}

.table-modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.table-modal-close:hover {
  background: #e0e0e0;
  color: #333;
}

.table-modal-body {
  overflow: auto;
  padding: 20px;
  flex: 1;
  min-height: 200px;
}

.table-modal-code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
  margin: 0;
  color: #333;
  tab-size: 2;
}

.table-modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  color: #666;
  gap: 16px;
}

.table-modal-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f0f0f0;
  border-top-color: #2196f3;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.table-modal-error {
  padding: 40px;
  text-align: center;
  color: #d32f2f;
}

/* Link styling for attachment links */
a.table-attachment-link {
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
  color: #1976d2;
  transition: color 0.15s ease;
}

a.table-attachment-link:hover {
  color: #1565c0;
  border-bottom-style: solid;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  .table-modal-content {
    background: #1e1e1e;
  }

  .table-modal-header {
    background: #2d2d2d;
    border-bottom-color: #404040;
  }

  .table-modal-title {
    color: #e0e0e0;
  }

  .table-modal-button {
    background: #2d2d2d;
    border-color: #505050;
    color: #e0e0e0;
  }

  .table-modal-button:hover {
    background: #383838;
    border-color: #606060;
  }

  .table-modal-close {
    color: #b0b0b0;
  }

  .table-modal-close:hover {
    background: #383838;
    color: #e0e0e0;
  }

  .table-modal-code {
    color: #e0e0e0;
  }

  .table-modal-loading {
    color: #b0b0b0;
  }

  .table-modal-spinner {
    border-color: #404040;
    border-top-color: #2196f3;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .table-modal-content {
    max-width: 95vw;
    max-height: 95vh;
  }

  .table-modal-header {
    padding: 12px 16px;
  }

  .table-modal-body {
    padding: 16px;
  }

  .table-modal-code {
    font-size: 11px;
  }
}
