/*
 * Copyright (c) 2024 Biovisuals Private Limited
 * All rights reserved.
 *
 * Icon Hub Phase 6B-1 — "Save to My Icons" dialog. Builds on bioDialog.css (.bio-dialog-*);
 * only the form fields, the inline error and the busy state are styled here.
 */

.bv-myicon-dialog {
  max-width: 440px;
}

.bv-myicon-dialog:focus {
  outline: none;
}

.bv-myicon-form {
  margin: 0;
}

.bv-myicon-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

.bv-myicon-label {
  margin-bottom: 6px;
  color: #5A2E00;
  font-size: 14px;
  font-weight: 600;
}

.bv-myicon-required {
  color: #b42318;
}

.bv-myicon-input.bio-dialog-input {
  margin-bottom: 4px;
}

.bv-myicon-textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.4;
}

.bv-myicon-input[aria-invalid="true"] {
  border-color: #b42318;
}

.bv-myicon-input[readonly] {
  background: #f7f7f7;
  color: #555;
}

.bv-myicon-count {
  align-self: flex-end;
  color: #6b4a2d;
  font-size: 12px;
}

.bv-myicon-error {
  margin: 0 0 14px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fef3f2;
  color: #b42318;
  font-size: 13px;
  line-height: 1.4;
}

.bv-myicon-error[hidden] {
  display: none;
}

.bv-myicon-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.bv-myicon-dialog .bio-dialog-btn:disabled,
.bv-myicon-dialog .bio-dialog-close:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.bv-myicon-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: bvMyIconSpin 0.8s linear infinite;
}

.bv-myicon-dialog.is-busy .bv-myicon-spinner {
  display: inline-block;
}

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

@media (prefers-reduced-motion: reduce) {
  .bv-myicon-spinner {
    animation-duration: 2s;
  }
}

/* ───────────────────── My Icons library (Phase 6B-2) ─────────────────────
 * Extends the Icon Hub V2 grid (iconHub.css `.bv-ih-*`): the cards, thumbnails, states and
 * lazy previews are the catalogue's. Only the owned-icon extras are styled here.
 */

/* The description line under a My Icon's name. */
.bv-ih-card--myicon .bv-ih-card__meta {
  display: block;
  overflow: hidden;
  color: #6b4a2d;
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Rename / Delete sit over the card's top-right corner, as siblings of the card. */
.bv-ih-grid--myicons .bv-ih-grid__item {
  position: relative;
}

.bv-ih-myicon-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
}

.bv-ih-grid__item:hover .bv-ih-myicon-actions,
.bv-ih-grid__item:focus-within .bv-ih-myicon-actions {
  opacity: 1;
}

.bv-ih-myicon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #e4d9cd;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  color: #6b4a2d;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}

.bv-ih-myicon-action:hover,
.bv-ih-myicon-action:focus-visible {
  border-color: #ff6f00;
  color: #b35100;
  outline: none;
}

.bv-ih-myicon-action--delete:hover,
.bv-ih-myicon-action--delete:focus-visible {
  border-color: #b42318;
  color: #b42318;
}

/* Touch / keyboard: the controls are always visible when hover is not available. */
@media (hover: none) {
  .bv-ih-myicon-actions {
    opacity: 1;
  }
}

/* The empty state's second line (how to save one). */
.bv-ih-myicons-empty .bv-ih-status__hint {
  margin: 6px 0 0;
  color: #6b4a2d;
  font-size: 12px;
  line-height: 1.4;
}

@media (prefers-reduced-motion: reduce) {
  .bv-ih-myicon-actions {
    transition: none;
  }
}
