/* ── Collage Maker ─────────────────────────────────────────── */

.collage-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 100px;
}

.collage-page-header {
  margin-bottom: 24px;
}

.collage-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  font-weight: 600;
  color: #BB5D4C;
  margin: 0 0 4px;
}

.collage-subtitle {
  font-size: 14px;
  color: #7a6855;
  margin: 0;
}

/* ── URL Input ─────────────────────────────────────────────── */

.url-input-section {
  background: #fff;
  border: 1px solid #e8ddd0;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 28px;
}

.url-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e8ddd0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  font-family: 'DM Mono', 'Courier New', monospace;
  color: #4a3728;
  background: #fdf9f4;
  resize: vertical;
  line-height: 1.6;
  margin-bottom: 14px;
}

.url-textarea:focus {
  outline: none;
  border-color: #BB5D4C;
}

.url-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.extract-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  background: #BB5D4C;
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s;
}

.extract-btn:hover { background: #99473A; }
.extract-btn:disabled { background: #ccc; cursor: not-allowed; }

.download-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  background: transparent;
  color: #4a3728;
  border: 1.5px solid #c8b8a2;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.download-all-btn:hover { border-color: #BB5D4C; background: #fdf3f1; }
.download-all-btn.hidden { display: none; }

.url-hint {
  font-size: 12px;
  color: #a08060;
  margin: 12px 0 0;
}

/* ── Image Grid ───────────────────────────────────────────── */

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* ── Image Card ───────────────────────────────────────────── */

.collage-card {
  background: #fff;
  border: 1px solid #e8ddd0;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.collage-card.is-loading {
  min-height: 220px;
  align-items: center;
  justify-content: center;
}

/* Loading state */
.card-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px;
  color: #a08060;
  font-size: 13px;
  text-align: center;
}

.card-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e8ddd0;
  border-top-color: #BB5D4C;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.card-url-label {
  font-size: 11px;
  color: #b8a590;
  word-break: break-all;
  max-width: 200px;
}

/* Image area */
.card-image-wrap {
  position: relative;
  background: #f5efe6;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: grab;
}

.card-image-wrap:active { cursor: grabbing; }

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 8px;
  box-sizing: border-box;
  draggable: true;
}

.card-image-wrap.is-generating {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: #a08060;
  font-size: 13px;
}

.card-gen-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e8ddd0;
  border-top-color: #BB5D4C;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Generated badge */
.card-generated-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(187,93,76,0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}

/* Card body */
.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: #4a3728;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-source {
  font-size: 11px;
  color: #b8a590;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Alternatives strip */
.card-alts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.alt-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  background: #f5efe6;
  transition: border-color 0.15s, opacity 0.15s;
}

.alt-thumb:hover { border-color: #BB5D4C; }
.alt-thumb.active { border-color: #BB5D4C; }
.alt-thumb.broken { display: none; }

/* Card action buttons */
.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid #e8ddd0;
  background: #fff;
  color: #4a3728;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.card-btn:hover { border-color: #BB5D4C; background: #fdf3f1; }
.card-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.card-btn--copy {
  flex: 1;
  justify-content: center;
  background: #f0f4fa;
  border-color: #c8d4e8;
}

.card-btn--copy:hover { background: #dde6f5; border-color: #8fa8d0; }

.card-btn--generate {
  flex: 1;
  justify-content: center;
}

/* Error card */
.card-error {
  padding: 20px 16px;
  text-align: center;
  color: #a08060;
  font-size: 13px;
}

.card-error-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.card-error-msg {
  font-size: 12px;
  color: #c8a888;
  margin-top: 4px;
  word-break: break-word;
}

/* Copy feedback */
.copy-feedback {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #4a3728;
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 9999;
  pointer-events: none;
  animation: feedbackFade 2s forwards;
}

@keyframes feedbackFade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(6px); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Mobile */
@media (max-width: 480px) {
  .image-grid { grid-template-columns: 1fr; }
  .collage-main { padding: 16px 12px 90px; }
}

/* ── Manual URL input (fallback for bot-protected sites) ──── */
.card-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: #a08060;
  font-size: 13px;
}

.manual-url-wrap {
  border: 1px dashed #d4c5b0;
  border-radius: 10px;
  padding: 12px;
  background: #fdf9f4;
}

.manual-url-label {
  font-size: 11px;
  color: #a08060;
  margin-bottom: 8px;
  line-height: 1.4;
}

.manual-url-row {
  display: flex;
  gap: 6px;
}

.manual-url-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #e8ddd0;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12px;
  font-family: inherit;
  color: #4a3728;
  background: #fff;
  transition: border-color 0.15s;
}

.manual-url-input:focus { outline: none; border-color: #BB5D4C; }

.manual-url-btn {
  white-space: nowrap;
  background: #BB5D4C;
  color: #fff;
  border-color: #BB5D4C;
  padding: 7px 12px;
}

.manual-url-btn:hover { background: #99473A; border-color: #99473A; }

/* ── Bookmarklet install section ─────────────────────────── */
.bookmarklet-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #ede5d8;
}

.bookmarklet-section--standalone {
  margin-top: 32px;
  padding: 24px;
  border: 1px solid #ede5d8;
  border-radius: 12px;
  background: #fdf8f2;
  max-width: 520px;
}

.bookmarklet-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #7a6855;
  margin-bottom: 10px;
}

.bookmarklet-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.bookmarklet-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #4a3728;
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: grab;
  white-space: nowrap;
  user-select: none;
  transition: background 0.15s;
}

.bookmarklet-link:hover { background: #2c1a10; }
.bookmarklet-link:active { cursor: grabbing; }

.bookmarklet-instructions {
  font-size: 11px;
  color: #a08060;
  line-height: 1.5;
}
