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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #f5f5f5;
}

#dashboard {
  width: 100%;
  height: 100%;
  padding: 10px;
}

.tile {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 10px;
  overflow: hidden;
  transition: box-shadow 0.2s;
  /* Make tile a predictable flexbox container */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}

.tile:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Responsive text sizing - single line only, shrink to fit, never clip glyphs */
/* CSS provides safe defaults, but JS text-fitting is required for accurate fitting */
.tile div:not(.webhook-content):not(.toggle-error),
.tile span {
  display: inline-block;
  text-align: center;
  /* Single line only - never wrap */
  white-space: nowrap;
  /* Preserve glyph height - ensure descenders are visible */
  line-height: 1.25;
  /* Safe default font size - JS will adjust dynamically */
  font-size: 18px;
  /* Constrain width - allow horizontal overflow to be hidden */
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  /* DO NOT clip vertically - descenders must remain visible */
  min-width: 0;
}

/* Preserve webhook-content and error message styling */
.tile .webhook-content {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.tile .toggle-error {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}

/* Constrain icons - prevent them from consuming all space */
.tile img {
  display: block;
  max-width: 60%;
  max-height: 60%;
  width: auto;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
}

/* Icon-only tiles (no direct child divs/spans for labels) can have larger icons */
.tile:has(img):not(:has(> div)):not(:has(> span)) img {
  max-width: 80%;
  max-height: 80%;
}

/* Ensure iframes fully occupy tile area */
.tile iframe {
  border: none;
  width: 100%;
  height: 100%;
  flex: 1 1 100%;
  min-width: 0;
  min-height: 0;
}

/* Support for no-padding variant */
.tile.no-padding {
  padding: 0;
}

/* When no-padding, allow larger icons */
.tile.no-padding img {
  max-width: 90%;
  max-height: 90%;
}

.webhook-content {
  padding: 10px;
}

/* Unreachable application tiles - grey out icon and label */
.tile.unreachable {
  opacity: 0.5;
}

.tile.unreachable img {
  filter: grayscale(100%);
  opacity: 0.6;
}

.tile.unreachable div {
  color: #999;
}

/**
 * GLOBAL SEARCH BAR STYLES
 * Command palette-style overlay for searching and executing actions
 */

.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.15s ease-out;
}

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

.search-container {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.15s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.search-input {
  padding: 16px;
  border: none;
  border-bottom: 1px solid #e0e0e0;
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace;
  outline: none;
  background-color: white;
}

.search-input::placeholder {
  color: #ccc;
}

.search-input:focus {
  border-bottom-color: #999;
}

.search-results {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.search-result {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background-color 0.15s;
  background-color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.search-result:hover {
  background-color: #f9f9f9;
}

.search-result.selected {
  background-color: #f5f5f5;
  font-weight: 500;
}

.search-result:last-child {
  border-bottom: none;
}
