/**
 * @file
 * Content Finder styles - Gin theme compatible.
 */

/* Toolbar icon - matching Coffee module styling */
.toolbar-icon-content-finder {
  --icon: url("/modules/contrib/nodehive_core/modules/nodehive_content_browser/images/icons/content-finder.svg") !important;
}

.toolbar .toolbar-bar .toolbar-icon-content-finder:before,
.toolbar .toolbar-bar .toolbar-icon-content-finder.active:before {
  background-image: url("/modules/contrib/nodehive_core/modules/nodehive_content_browser/images/icons/content-finder.svg") !important;
  background-color: transparent !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
}

/* Overlay container */
.content-finder-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  display: none;
}

.content-finder-overlay.is-open {
  display: block;
}

/* Backdrop */
.content-finder-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.2s ease-out;
}

/* Dialog */
.content-finder-dialog {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  background: var(--gin-bg-layer, #fff);
  border-radius: var(--gin-border-m, 8px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  animation: slideDown 0.3s ease-out;
}

/* Header */
.content-finder-header {
  position: relative;
  padding: 0;
  border-bottom: 1px solid var(--gin-border-color, #dee2e6);
}

.content-finder-search {
  width: 100%;
  padding: 1.5rem 3rem 1.5rem 1.5rem;
  font-size: 1.125rem;
  border: none;
  background: transparent;
  color: var(--gin-color-text, #222);
  outline: none;
}

.content-finder-search:focus {
  outline: 2px solid var(--gin-color-primary, #0074bd);
  outline-offset: -2px;
}

.content-finder-search::placeholder {
  color: var(--gin-color-text-light, #666);
}

.content-finder-close {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  color: var(--gin-color-text-light, #666);
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: var(--gin-border-s, 4px);
  transition: background-color 0.2s;
}

.content-finder-close:hover {
  background: var(--gin-bg-item-hover, #f0f0f0);
}

/* Results */
.content-finder-results {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.content-finder-loading,
.content-finder-empty {
  display: none;
  padding: 3rem;
  text-align: center;
  color: var(--gin-color-text-light, #666);
}

/* Results list */
.content-finder-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.content-finder-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--gin-border-color-light, #f0f0f0);
  cursor: pointer;
  transition: background-color 0.2s;
}

.content-finder-item:hover {
  background: var(--gin-bg-item-hover, #f8f9fa);
}

.content-finder-item.is-selected {
  background: var(--gin-color-primary-light, #e6f1f9);
  outline: 2px solid var(--gin-color-primary, #0074bd);
  outline-offset: -2px;
}

.content-finder-item-content {
  flex: 1;
}

.content-finder-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.content-finder-item-type {
  font-size: 0.75rem;
  color: var(--gin-color-primary, #0074bd);
  font-weight: 500;
}

.content-finder-item-title {
  font-weight: 500;
  color: var(--gin-color-text, #222);
}

.content-finder-item-status {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--gin-border-xs, 3px);
  margin-left: 0.5rem;
}

.content-finder-item-status.is-published {
  background: var(--gin-color-success-light, #d4edda);
  color: var(--gin-color-success, #155724);
}

.content-finder-item-status.is-unpublished {
  background: var(--gin-color-warning-light, #fff3cd);
  color: var(--gin-color-warning, #856404);
}

.content-finder-item-spaces {
  font-size: 0.75rem;
  color: var(--gin-color-text-light, #666);
  margin-left: 0.5rem;
}

.content-finder-item-meta {
  font-size: 0.75rem;
  color: var(--gin-color-text-light, #666);
}

.content-finder-item-actions {
  display: flex;
  gap: 0.5rem;
}

.content-finder-edit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--gin-border-s, 4px);
  color: var(--gin-color-text-light, #666);
  transition: all 0.2s;
}

.content-finder-edit:hover {
  background: var(--gin-bg-item, #e9ecef);
  color: var(--gin-color-primary, #0074bd);
}

/* Footer */
.content-finder-footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--gin-border-color, #dee2e6);
  background: var(--gin-bg-layer2, #f8f9fa);
  border-radius: 0 0 var(--gin-border-m, 8px) var(--gin-border-m, 8px);
}

.content-finder-hint {
  font-size: 0.75rem;
  color: var(--gin-color-text-light, #666);
}

.content-finder-hint kbd {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  font-size: 0.75rem;
  font-family: monospace;
  background: var(--gin-bg-item, #e9ecef);
  border: 1px solid var(--gin-border-color, #dee2e6);
  border-radius: var(--gin-border-xs, 3px);
  margin: 0 0.125rem;
}

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

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Body class when overlay is open */
body.content-finder-open {
  overflow: hidden;
}

/* Create content section */
.content-finder-create-section {
  padding: 1.5rem;
}

.content-finder-create-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  color: var(--gin-color-text, #222);
}

.content-finder-create-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.content-finder-create-item {
  border: 1px solid var(--gin-border-color, #dee2e6);
  border-radius: var(--gin-border-s, 4px);
  transition: all 0.2s;
}

.content-finder-create-item:hover {
  border-color: var(--gin-color-primary, #0074bd);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.content-finder-create-link {
  display: flex;
  align-items: center;
  padding: 1rem;
  text-decoration: none;
  color: var(--gin-color-text, #222);
}

.content-finder-create-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-right: 0.75rem;
  background: var(--gin-color-primary-light, #e6f1f9);
  color: var(--gin-color-primary, #0074bd);
  border-radius: var(--gin-border-s, 4px);
  font-size: 1.5rem;
  font-weight: 300;
  flex-shrink: 0;
}

.content-finder-create-content {
  flex: 1;
  min-width: 0;
}

.content-finder-create-label {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.content-finder-create-description {
  font-size: 0.75rem;
  color: var(--gin-color-text-light, #666);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .toolbar-icon-content-finder:before {
    filter: invert(1);
  }
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  .content-finder-dialog {
    top: 5%;
    width: 95%;
    max-height: 90vh;
  }

  .content-finder-item-header {
    flex-wrap: wrap;
  }

  .content-finder-hint {
    display: none;
  }
}