/* 5etools Integration Styles */

/* ----- 5etools Search Panel ----- */
.fivetools-search-controls {
  padding: 10px 0;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--mm-divider-color);
}

.fivetools-search-input {
  padding: 8px 12px;
  width: 100%;
  border: 1px solid var(--mm-border-color);
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 10px;
  background-color: var(--mm-bg-light);
}

.fivetools-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.fivetools-filter-button {
  padding: 5px 10px;
  border: 1px solid var(--mm-border-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.fivetools-filter-button.active {
  background-color: var(--panel-color, var(--color-amethyst));
  color: white;
  font-weight: bold;
}

.fivetools-filter-button:not(.active) {
  background-color: var(--mm-bg-light);
  color: var(--mm-text-color);
}

.fivetools-filter-button:not(.active):hover {
  background-color: var(--mm-bg-hover);
}

/* Hide search controls when viewing details */
.viewing-spell-details .fivetools-search-controls {
  display: none;
}

.fivetools-results {
  height: auto;
  max-height: 350px; /* This is a maximum, not a fixed height */
  overflow: auto;
  border: none;
  border-radius: 4px;
}

/* Make panel height adjust based on content */
.panel-content:has(.fivetools-results) {
  display: flex;
  flex-direction: column;
  height: auto;
  max-height: 500px; /* Limit the maximum height of the panel content */
  overflow: auto;
}

/* More specific selector to target the 5etools spells panel */
#\35 etools-spells .panel-content {
  height: auto;
  max-height: 500px;
}

/* Hide results container border when viewing details */
.viewing-spell-details .fivetools-results {
  border: none;
  max-height: none; /* Allow the results to expand when viewing details */
}

.fivetools-results-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.85em;
  background-color: transparent;
  border: none;
  table-layout: fixed;
}

.fivetools-results-table th:first-child,
.fivetools-results-table td:first-child {
  width: 40%;
}

.fivetools-results-table th {
  text-align: left;
  padding: 6px 8px;
  background-color: #d9e7dd;
  font-weight: bold;
  color: #333;
  text-transform: uppercase;
  font-size: 0.8em;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
}

.fivetools-results-table td {
  padding: 5px 8px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.fivetools-results-table .name-cell {
  font-weight: bold;
}

.fivetools-results-table tr.even-row {
  background-color: var(--mm-bg-color);
}

.fivetools-results-table tr.odd-row {
  background-color: var(--mm-bg-light);
}

.fivetools-results-table tr:hover {
  background-color: var(--mm-bg-hover);
  cursor: pointer;
}

.fivetools-no-results {
  padding: 20px;
  text-align: center;
  color: #888;
  background-color: var(--mm-bg-color);
}

.fivetools-results-limit {
  padding: 10px;
  text-align: center;
  background-color: var(--mm-bg-dark);
  font-style: italic;
  color: #666;
  font-size: 0.85em;
}

/* ----- 5etools Spell Details ----- */
.fivetools-details {
  background-color: var(--mm-bg-color);
  padding: 15px;
  border-radius: 4px;
  border: none;
}

.fivetools-back-button {
  padding: 5px 10px;
  background-color: var(--mm-bg-light);
  color: var(--mm-text-color);
  border: 1px solid var(--mm-border-color);
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 15px;
  font-size: 13px;
}

.fivetools-title {
  margin-top: 0;
  color: var(--panel-color, var(--color-amethyst));
  border-bottom: 1px solid var(--mm-divider-color);
  padding-bottom: 10px;
  font-size: 1.3em;
  font-weight: bold;
}

/* Spell info grid layout */
.spell-info-grid {
  display: table;
  width: 100%;
  margin-top: 5px;
  margin-bottom: 5px;
  font-size: 0.9em;
  border-collapse: collapse;
  border: none;
}

.spell-info-header-row,
.spell-info-value-row {
  display: table-row;
}

.spell-info-header {
  display: table-cell;
  font-weight: bold;
  font-size: 1 em;
  color: var(--mm-text-color);
  padding: 3px 5px 0px 0px;
  text-transform: uppercase;
}

.spell-info-value {
  display: table-cell;
  padding: 0px 10px 5px 0px;
}

.spell-description {
  margin-bottom: 15px;
  line-height: 1.6;
  color: var(--mm-text-color);
}

.spell-separator {
  border: none;
  border-bottom: 1px solid var(--mm-divider-color);
  margin: 0 0 15px 0;
}

.spell-higher-levels {
  border-top: 1px solid var(--mm-divider-color);
  padding-top: 10px;
  margin-top: 5px;
  margin-bottom: 15px;
  font-style: italic;
}

.spell-higher-title {
  font-weight: bold;
}

.spell-material {
  margin-top: 5px;
  margin-bottom: 15px;
  font-size: 0.9em;
  font-style: italic;
}

.spell-source {
  margin-top: 5px;
  font-size: 0.85em;
  color: #666;
  font-style: italic;
  text-align: right;
}

/* ----- 5etools Loading and Errors ----- */
.fivetools-loading {
  text-align: center;
  padding: 20px;
}

.fivetools-error {
  display: none;
  background-color: #ffebee;
  padding: 15px;
  margin: 10px 0;
  border-radius: 4px;
  color: #d32f2f;
}

.fivetools-refresh-button {
  margin-top: 10px;
  padding: 5px 10px;
  background-color: #d32f2f;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.fivetools-fallback-button {
  margin-top: 10px;
  margin-left: 10px;
  padding: 5px 10px;
  background-color: #2196f3;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* Raw data display */
.fivetools-raw-data {
  background-color: #f5f5f5;
  padding: 10px;
  border-radius: 4px;
  overflow: auto;
  max-height: 500px;
  font-size: 12px;
  border: none;
} 