/* ============================================================================
   shared-art.css
   Art cards (horizontal strip, no inline comments) + art modal (art, info and comments) — visually matched to
   shared-products-dimona.css (#f4f3ef surface, deep rounding, Figtree,
   #151219 text, #712bf5 accent).

   NOTE: shared-art.js writes inline styles on the card and Bootstrap
   utilities (.p-2, .text-primary, .text-muted, .rounded-circle) use
   !important, so !important is required in several rules to override them.
   The card background comes from Firestore: shared-art.js sets --card-bg
   (and --card-fg for readable text) on each card from the art's color field.
   #f4f3ef is only the fallback when the art has no color saved.
   ========================================================================== */

/* ─── Horizontal strip ────────────────────────────────────────────────────── */

#artContainer {
  gap: 20px !important;
  height: auto !important;
  max-height: none !important;
  align-items: flex-start !important;
}

#artContainer::-webkit-scrollbar { height: 4px; }
#artContainer::-webkit-scrollbar-track { background: transparent; }
#artContainer::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* ─── Card ────────────────────────────────────────────────────────────────── */

.art-card {
  display: flex;
  flex: 0 0 220px;
  flex-direction: column;
  align-self: flex-start;        /* size to content, don't stretch to a fixed-height strip */
  width: 220px;
  min-width: 220px;
  height: auto !important;       /* card grows to fit image + name/price/artist + buttons */
  max-height: none !important;
  padding: 10px;
  overflow: hidden;
  background: var(--card-bg, #f4f3ef) !important;
  border: none !important;
  border-radius: 28px !important;
  box-shadow: none !important;
  font-family: 'Figtree', sans-serif;
  font-weight: 400;
  color: var(--card-fg, #151219);
}

/* ─── Profile page grid ────────────────────────────────────────────────────────
   profile-pages.css turns #artContainer into a 3-column grid and forces EVERY
   child to a 1:1 box with !important (`#artContainer > *`). That was meant for
   bare images; on a full card it squashed the card into a square and clipped
   the name / price / artist / buttons. Here the card sizes to its content and
   fits the grid cell; only the IMAGE is square (see "Image" below).
   (#id + class beats #id + *, so this wins regardless of stylesheet order.) */

/* 3 columns of full cards is too narrow for name / price / buttons, so 2 per row */
#artContainer,
#artsContainer {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

#artContainer > .art-card,
#artsContainer > .art-card {
  width: 100% !important;
  min-width: 0 !important;
  aspect-ratio: auto !important;
  height: auto !important;
  align-self: start;
}

/* ─── Image ───────────────────────────────────────────────────────────────── */

.art-card > div:has(> .art-image) {
  container-type: inline-size;   /* cqw do botão de carrinho acompanha a largura do card */
  position: relative;
  flex: 0 0 auto !important;     /* never let the flex column squash or stretch the height */
  width: 100%;
  height: auto !important;
  min-height: 0;
  aspect-ratio: 1 / 1 !important;
  overflow: hidden;
  border-radius: 22px;
  cursor: pointer;
}

.art-card .art-image {
  position: absolute;            /* image never influences the box size; the box is always 1:1 */
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  transform: scale(1);
  transition: transform 0.4s ease;
  will-change: transform;
}

.art-card > div:has(> .art-image):hover .art-image {
  transform: scale(1.05);
}

/* ─── Body (name, price, artist) ──────────────────────────────────────────── */

.art-card .card-body {
  flex: 1;
  min-width: 0;
  padding: 12px 4px 4px !important;
}

/* Art name */
.art-card .card-body > p.fw-semibold {
  font-size: 17px !important;
  font-weight: 500 !important;
  color: var(--card-fg, #151219);
}

/* Price */
.art-card .card-body > p.text-primary {
  margin-top: 2px;
  font-size: 21px !important;
  font-weight: 700 !important;
  line-height: normal;
  color: var(--card-fg, #151219) !important;
}

/* Artist row */
.art-card .card-body > .d-flex {
  gap: 8px !important;
  margin-top: 10px !important;
}

.art-card img.user-profile-link {
  flex-shrink: 0;
  width: 30px !important;
  height: 30px !important;
  object-fit: cover;
  background: #1c1c1f;
  border-radius: 9px !important;
  cursor: pointer;
}

.art-card small.user-profile-link {
  min-width: 0;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--card-fg, #000) !important;
  cursor: pointer;
}

.art-card .user-profile-link:hover {
  opacity: 0.75;
}

/* Like lives on the artist row (same line as the profile name) */
.art-card .card-body > .d-flex > small.user-profile-link {
  flex: 1 1 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.art-card .art-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 5px;
}

.art-card .art-actions .btn {
  flex-shrink: 0;
  min-height: 30px;
  padding: 5px 9px !important;
  font-size: 0.78rem !important;
  white-space: nowrap;
}

/* ─── Manage menu (three dots) — copied 1:1 from shared-products-dimona.css so the
   art card works the same even on pages that don't load that file. Opens upward. ── */

.dimona-manage-menu {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

.dimona-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #9a9aa1;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.15s ease, color 0.15s ease;
}

.dimona-menu-trigger:hover,
.dimona-manage-menu.open .dimona-menu-trigger {
  background: #f1f1f3;
  color: #1c1c1f;
}

/* Drops UPWARD, anchored above the trigger */
.dimona-menu-dropdown {
  position: absolute;
  right: 0;
  bottom: 100%;
  margin-bottom: 8px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 5;
}

.dimona-manage-menu.open .dimona-menu-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dimona-menu-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38.4px;
  height: 38.4px;
  border-radius: 10px;
  border: none;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.18);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.dimona-menu-item:hover { filter: brightness(1.08); }
.dimona-menu-item:active { transform: scale(0.94); }

.dimona-menu-item-accent { background: #5b4bff; }
.dimona-menu-item-danger { background: #e0475a; }

/* ─── Buttons (like) ────────────────────────────────────────────────── */

.art-card .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 12px !important;
  font-family: inherit;
  font-size: 0.8rem !important;
  font-weight: 600;
  line-height: 1;
  color: #151219;
  background: #fff;
  border: 1.5px solid #e2e2e2;
  border-radius: 12px;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease,
              color 0.15s ease, transform 0.15s ease;
}

.art-card .btn:hover {
  color: #712bf5;
  background: #fff;
  border-color: #712bf5;
}

.art-card .btn:active {
  transform: scale(0.96);
}

.art-card .btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(113, 43, 245, 0.25);
}

/* Carrinho (substitui o "Buy"): mesmo ícone do card de produto, sobre a imagem.
   Copiado de shared-products-dimona.css para funcionar também sem esse arquivo. */
.art-card .dimona-cart-icon-btn {
  position: absolute;
  right: 7cqw;
  bottom: 7cqw;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14cqw;
  height: 14cqw;
  padding: 0;
  background: #712bf5;
  border: none;
  border-radius: 4.2cqw 4.2cqw 0.84cqw 4.2cqw;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(113, 43, 245, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}

.art-card .dimona-cart-icon-btn:hover {
  background: #5f22d6;
  transform: scale(1.06);
}

.art-card .dimona-cart-icon-btn:active {
  transform: scale(0.96);
}

.art-card .dimona-cart-icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(113, 43, 245, 0.35);
}

.art-card .dimona-cart-icon-img {
  width: 5.74cqw;
  height: 5.74cqw;
  object-fit: contain;
  filter: brightness(0) invert(1);   /* ícone preto → branco */
}

/* Liked state (btn-primary / liked / active, depending on shared-likes.js) */
.art-card .like-button.btn-primary,
.art-card .like-button.liked,
.art-card .like-button.active {
  color: #fff;
  background: #712bf5;
  border-color: #712bf5;
}

.art-card .like-button.btn-primary:hover,
.art-card .like-button.liked:hover,
.art-card .like-button.active:hover {
  color: #fff;
  background: #5f22d6;
  border-color: #5f22d6;
}

/* Art card shown inside the product modal's linked-art box
   (that box is #f4f3ef too, so the card goes white to stay visible) */
#vinculatedArtModalContainer .art-card {
  background: #fff !important;
}

/* ─── Art modal (matches #productModal): art on the left, info + comments right ─ */

#artModal .modal-content {
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: 28px;
  background: #fff;
  font-family: 'Figtree', sans-serif;
  color: #151219;
}

#artModal .btn-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 20;
  width: 32px;
  height: 32px;
  margin: 0;
  background-color: #fff;
  border-radius: 50%;
  opacity: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Share — same white circle as #productModal .pm-share-btn, parked beside the
   close button so it never covers the comment box */
#artModal .am-share-btn {
  position: absolute;
  top: 14px;
  right: 54px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #151219;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: background 0.15s ease, transform 0.15s ease;
}

#artModal .am-share-btn:hover {
  background: #f1f1f3;
  transform: scale(1.05);
}

#artModal .am-share-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(113, 43, 245, 0.3);
}

#artModal .am-wrap {
  display: flex;
  height: min(640px, 86vh);
}

#artModal .am-left {
  display: flex;
  flex: 1 1 56%;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 20px;
}

#artModal .am-left img {
  flex: none;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;           /* always square; art is letterboxed inside */
  object-fit: contain;
  border-radius: 18px;
}

#artModal .am-right {
  display: flex;
  flex: 0 0 380px;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 28px 24px 20px;
}

#artModal .am-info {
  flex-shrink: 0;
  padding-right: 74px;           /* keep clear of the close + share buttons */
}

#artModal .am-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1.2;
  color: #151219;
}

#artModal .am-price {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
  color: #151219;
}

#artModal .am-desc {
  max-height: 84px;
  margin: 10px 0 0;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.4;
  color: #5b5b63;
  white-space: pre-wrap;
}

#artModal .am-artist {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

#artModal .am-artist img {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  object-fit: cover;
  background: #1c1c1f;
  border-radius: 10px;
  cursor: pointer;
}

#artModal .am-artist span {
  min-width: 0;
  font-size: 15px;
  font-weight: 500;
  color: #000;
  cursor: pointer;
}

#artModal .am-artist .user-profile-link:hover { opacity: 0.75; }

#artModal .am-comments {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1.5px solid #ecebe7;
}

/* Comments panel (list + input) rendered by SharedCommentsManager.mountCommentsPanel */
#artModal .am-comments .cm-panel-title {
  flex-shrink: 0;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 600;
  color: #151219;
}

#artModal .am-comments .cm-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;       /* shared-comments.js sets 300px inline */
  padding-right: 4px;
  overflow-y: auto !important;
  font-size: 0.9rem;
}

#artModal .am-comments .cm-list::-webkit-scrollbar { width: 4px; }
#artModal .am-comments .cm-list::-webkit-scrollbar-track { background: transparent; }
#artModal .am-comments .cm-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* "No comments yet." / error */
#artModal .am-comments .cm-list > p {
  margin: 0;
  font-size: 14px;
  color: #9a9aa1 !important;
}

#artModal .am-comments .cm-list img.user-profile-link {
  width: 34px !important;
  height: 34px !important;
  object-fit: cover;
  background: #1c1c1f;
  border-radius: 10px !important;
}

#artModal .am-comments .cm-list strong {
  font-size: 14px;
  font-weight: 500;
}

#artModal .am-comments .cm-list .text-break {
  font-size: 14px;
  line-height: 1.4;
}

#artModal .am-comments .cm-list .text-muted {
  font-size: 12px;
  color: #9a9aa1 !important;
}

#artModal .am-comments .cm-list .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 600;
  color: #151219;
  background: #fff;
  border: 1.5px solid #e2e2e2;
  border-radius: 10px;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#artModal .am-comments .cm-list .btn:hover {
  color: #712bf5;
  background: #fff;
  border-color: #712bf5;
}

/* Liked comment (the like manager toggles btn-primary / btn-outline-primary) */
#artModal .am-comments .cm-list .comment-like-button.btn-primary {
  color: #fff;
  background: #712bf5;
  border-color: #712bf5;
}

#artModal .am-comments .cm-list .btn-link {
  border: none;
  background: transparent;
}

#artModal .am-comments .cm-list .alert {
  margin: 8px 0 0;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 12px;
}

/* Input row */
#artModal .am-comments .cm-input {
  flex-shrink: 0;
  margin-top: 12px;
}

#artModal .am-comments .cm-input .input-group {
  flex-wrap: nowrap;
  gap: 6px;
}

#artModal .am-comments .cm-input .input-group > * {
  margin-left: 0 !important;
  border-radius: 12px !important;
}

#artModal .am-comments .cm-input .form-control {
  font-family: inherit;
  background: #fff;
  border: 1.5px solid #e2e2e2;
  padding: 8px 12px;
  box-shadow: none;
  transition: border-color 0.15s ease;
}

#artModal .am-comments .cm-input .form-control:focus {
  outline: none;
  border-color: #712bf5;
  box-shadow: 0 0 0 3px rgba(113, 43, 245, 0.15);
}

#artModal .am-comments .cm-input .btn {
  font-family: inherit;
  font-weight: 600;
  color: #151219;
  background: #fff;
  border: 1.5px solid #e2e2e2;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#artModal .am-comments .cm-input .btn:hover {
  color: #712bf5;
  background: #fff;
  border-color: #712bf5;
}

#artModal .am-comments .cm-input .comment-submit {
  color: #fff;
  background: #712bf5;
  border-color: #712bf5;
}

#artModal .am-comments .cm-input .comment-submit:hover {
  color: #fff;
  background: #5f22d6;
  border-color: #5f22d6;
}

@media (max-width: 768px) {
  #artModal .am-wrap { flex-direction: column; height: auto; }
  #artModal .am-left { flex: none; padding: 12px; }
  #artModal .am-left img { width: min(100%, 460px); }
  #artModal .am-right { flex: none; padding: 20px 16px 16px; }
  #artModal .am-info { padding-right: 0; }
  #artModal .cm-list { max-height: 260px !important; }
}

/* ─── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .art-card {
    flex-basis: 190px !important;
    width: 190px !important;
    min-width: 190px !important;
    padding: 4px;
    border-radius: 18px !important;
  }

  .art-card > div:has(> .art-image) { aspect-ratio: 3 / 4 !important; border-radius: 12px; }
  .art-card .art-image { object-fit: cover; }
  .art-card .card-body { padding: 8px 2px 2px !important; }
  .art-card .card-body > p.fw-semibold { font-size: 15px !important; line-height: 1.3; }
  .art-card .card-body > p.text-primary { font-size: 14px !important; line-height: 1.25; }
  .art-card .card-body > .d-flex { gap: 6px !important; margin-top: 8px !important; }
  .art-card .card-body > .d-flex { flex-wrap: wrap; }
  .art-card img.user-profile-link { width: 26px !important; height: 26px !important; }
  .art-card small.user-profile-link { font-size: 13px !important; }
  .art-card .card-body > .d-flex > small.user-profile-link { flex: 1 1 24px; }
  .art-card .art-actions { flex: 1 0 100%; }
  .art-card .art-actions .btn { min-height: 32px; padding: 4px 8px !important; }
}

/* ─── Debug-only dark mode (mirrors shared-products-dimona.css) ───────────── */

html.kv-dbg-dark .dimona-menu-trigger:hover,
html.kv-dbg-dark .dimona-manage-menu.open .dimona-menu-trigger,
html.kv-dbg-dark .art-card,
html.kv-dbg-dark .art-card .btn,
html.kv-dbg-dark #artModal .modal-content,
html.kv-dbg-dark #artModal .btn-close,
html.kv-dbg-dark #artModal .am-share-btn,
html.kv-dbg-dark #artModal .cm-list .btn,
html.kv-dbg-dark #artModal .cm-input .form-control,
html.kv-dbg-dark #artModal .cm-input .btn:not(.comment-submit) {
  background: #222124 !important;
  border-color: #e1dfe6 !important;
}

html.kv-dbg-dark #artModal .modal-content,
html.kv-dbg-dark #artModal .am-title,
html.kv-dbg-dark #artModal .cm-panel-title {
  color: #e1dfe6;
}

html.kv-dbg-dark .art-card .dimona-cart-icon-btn,
html.kv-dbg-dark #artModal .cm-input .comment-submit,
html.kv-dbg-dark .art-card .like-button.btn-primary,
html.kv-dbg-dark .art-card .like-button.liked,
html.kv-dbg-dark .art-card .like-button.active {
  background: #712bf5 !important;
}

html.kv-dbg-dark .art-card .card-body > p.text-primary,
html.kv-dbg-dark #artModal .am-price {
  color: #e1dfe6 !important;
}

/* ─── Profile pages only: hide artist avatar + name ───────────────────────────
   (profile.html / public-profile.html use <body class="profile-page-shell">).
   The row's space is reclaimed: the like button (same row) is taken out of the
   flow and floated over the top-right corner of the image instead. */

body.profile-page-shell .art-card {
  position: relative;
}

body.profile-page-shell .art-card img.user-profile-link,
body.profile-page-shell .art-card small.user-profile-link {
  display: none !important;
}

body.profile-page-shell .art-card .card-body > .d-flex {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
  margin: 0 !important;
}