/* Refer to docs/logs/project-card-forge.md → 7/4/2025 – launch of V2 for details. */

/* CardForge Editor Layout */
.cf-left-column {
  grid-column: span 8;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.cardforge-container {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
  margin-top: 2rem;
  margin-bottom: 4rem; /* Add space for footer */
  min-height: calc(100vh - 200px); /* Ensure proper height */
}

.cardforge-editor {
  background: var(--surface-2, rgba(255,255,255,0.05));
  padding: 1.5rem;
  border-radius: 8px;
  /* Blur effects removed */
}

.cardforge-editor h2 {
  margin-top: 0;
}

.cardforge-form label {
  display: block;
  font-weight: 500;
  margin-top: 1rem;
  color: var(--mood-primary-color, #e1e1ff);
}

.cardforge-form input,
.cardforge-form textarea,
.cardforge-form select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--mood-accent-color, #4a4a6a);
  border-radius: 4px;
  background: var(--aura-bg-color, #1a1a2e);
  color: var(--mood-primary-color, #e1e1ff);
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cardforge-form input:focus,
.cardforge-form textarea:focus,
.cardforge-form select:focus {
  outline: none;
  border-color: var(--mood-primary-color, #e1e1ff);
  box-shadow: 0 0 0 2px rgba(225, 225, 255, 0.1);
}

.cardforge-form button,
.add-stat-btn,
.add-social-btn,
.add-micro-btn,
.add-attribute-btn {
  background: var(--mood-accent-color, #4a4a6a);
  color: var(--aura-bg-color, #1a1a2e);
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  margin-top: 12px;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.cardforge-form button:hover,
.add-stat-btn:hover,
.add-social-btn:hover,
.add-micro-btn:hover,
.add-attribute-btn:hover {
  background: var(--mood-primary-color, #e1e1ff);
  transform: translateY(-1px);
}

.cardforge-form button:active,
.add-stat-btn:active,
.add-social-btn:active,
.add-micro-btn:active,
.add-attribute-btn:active {
  transform: translateY(0);
}

/* Remove buttons consistent styling */
.remove-stat,
.remove-social,
.remove-micro,
.remove-attribute,
.clear-achievement,
.clear-superpower {
  background: transparent;
  border: none;
  color: var(--mood-secondary-color, #a0a0c0);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s ease, background-color 0.2s ease;
  line-height: 1;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-stat:hover,
.remove-social:hover,
.remove-micro:hover,
.remove-attribute:hover,
.clear-achievement:hover,
.clear-superpower:hover {
  color: var(--mood-primary-color, #e1e1ff);
  background: rgba(255, 255, 255, 0.1);
}

/* Row containers for consistent layout */
.stat-row,
.social-row,
.micro-row,
.attribute-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  width: 100%;
}

/* Badges tab - simple fix */
#micro-editor {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.micro-row {
  display: grid;
  grid-template-columns: 120px 100px 1fr 32px;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.micro-row > * {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.micro-row input,
.micro-row select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Input sizing within rows */
.stat-row input,
.social-row input,
.micro-row input,
.micro-row select,
.attribute-row input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--mood-accent-color, #4a4a6a);
  border-radius: 4px;
  background: var(--aura-bg-color, #1a1a2e);
  color: var(--mood-primary-color, #e1e1ff);
  font-family: inherit;
}

/* Icon picker buttons */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.icon-option {
  background: transparent;
  border: 1px solid var(--mood-accent-color, #4a4a6a);
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--mood-primary-color, #e1e1ff);
}
.icon-option.active {
  background: var(--mood-primary-color, #e1e1ff);
  color: var(--aura-bg-color, #1a1a2e);
}
.icon-option i {
  pointer-events: none;
}

/* Badge slider and value label */
.badge-slider {
  flex: 1;
  margin-right: 8px;
}
.slider-value {
  width: 24px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--mood-primary-color, #e1e1ff);
}

/* Micro badges display grid */
.micro-badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.micro-badge-container {
  background: var(--surface-2, rgba(255,255,255,0.05));
  padding: 8px;
  border-radius: 6px;
  text-align: center;
}
.micro-badge-container .badge-name {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: var(--mood-primary-color, #e1e1ff);
}
/* Remove margin from Card Preview header */
.cardforge-preview h2 {
  margin: 0;
}
/* Special button styling */
.choose-image-btn {
  background: var(--mood-accent-color, #4a4a6a);
  color: var(--aura-bg-color, #1a1a2e);
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  margin-top: 8px;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.choose-image-btn:hover {
  background: var(--mood-primary-color, #e1e1ff);
  transform: translateY(-1px);
}

/* Section consistency */
.cf-section {
  container-type: inline-size;
  container-name: section;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--surface-2, rgba(255,255,255,0.02));
  border-radius: 8px;
  border: 1px solid var(--mood-accent-color, rgba(255,255,255,0.1));
  /* Blur effects removed */
}

.cf-section-title {
  margin-bottom: 1rem;
  color: var(--mood-primary-color, #e1e1ff);
}

/* Prevent layout blowout without forcing grid structure */
.cf-left-column {
  min-width: 0;
  max-width: 100%;
}

.cardforge-preview {
  min-width: 0;
  max-width: 100%;
}

/* Section constraints for proper containment */
.cf-section[data-step-section="4"],
.cf-section[data-step-section="5"],
.cf-section[data-step-section="6"] {
  max-width: 100%;
  overflow: hidden;
  width: 100%;
}

.cf-section[data-step-section="4"] input,
.cf-section[data-step-section="4"] select,
.cf-section[data-step-section="5"] input,
.cf-section[data-step-section="5"] select,
.cf-section[data-step-section="6"] input {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.cf-section[data-step-section="4"] label,
.cf-section[data-step-section="5"] label,
.cf-section[data-step-section="6"] label {
  display: block;
  margin-bottom: 4px;
  color: var(--mood-primary-color, #e1e1ff);
  font-weight: 500;
}

#social-editor,
#micro-editor,
#attribute-editor {
  max-width: 100%;
  overflow: hidden;
}

/* Image Style Controls */
.image-style-controls {
  margin: 1rem 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.image-style-controls label {
  margin-bottom: 4px;
  font-weight: 500;
  color: var(--mood-primary-color, #e1e1ff);
}

.image-style-controls select {
  padding: 8px 12px;
  border: 1px solid var(--mood-accent-color, #4a4a6a);
  border-radius: 4px;
  background: var(--aura-bg-color, #1a1a2e);
  color: var(--mood-primary-color, #e1e1ff);
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.image-style-controls select:focus {
  outline: none;
  border-color: var(--mood-primary-color, #e1e1ff);
}

/* Inline Image Chooser Styling */
.custom-url-section {
  margin: 1rem 0;
}

.url-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.url-input-group input {
  flex: 1;
}

.use-url-btn,
.load-images-btn {
  background: var(--mood-accent-color, #4a4a6a);
  color: var(--mood-primary-color, #e1e1ff);
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.2s;
}

.use-url-btn:hover,
.load-images-btn:hover {
  background: var(--mood-primary-color, #6a6a8a);
}

.image-chooser-section {
  margin: 1rem 0;
}

.image-chooser-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.image-pagination {
  display: flex;
  gap: 8px;
  align-items: center;
}

.image-pagination button {
  background: var(--mood-accent-color, #4a4a6a);
  color: var(--mood-primary-color, #e1e1ff);
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.8em;
}

.image-pagination button:hover {
  background: var(--mood-primary-color, #6a6a8a);
}

.image-pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#page-info {
  font-size: 0.9em;
  color: var(--mood-secondary-color, #b1b1d1);
}

.inline-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  border: 1px solid var(--mood-accent-color, #4a4a6a);
  border-radius: 4px;
  padding: 8px;
  background: var(--aura-bg-color, rgba(26, 26, 46, 0.5));
  overflow: hidden;
}

.inline-image-grid img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.2s;
}

.inline-image-grid img:hover {
  border-color: var(--mood-accent-color, #4a4a6a);
  transform: scale(1.05);
}

.inline-image-grid img.selected {
  border-color: var(--mood-primary-color, #e1e1ff);
}

.coming-soon {
  font-size: 0.85em;
  color: var(--mood-secondary-color, #b1b1d1);
  font-style: italic;
  margin-top: 1rem;
  text-align: center;
}

.hidden {
  display: none !important;
}

/* Override any conflicting styles with specificity */
.cardforge-form .stat-row,
.cardforge-form .social-row,
.cardforge-form .micro-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin-bottom: 8px !important;
  width: 100% !important;
  max-width: 100% !important;
}

.cardforge-form .stat-row input,
.cardforge-form .social-row input,
.cardforge-form .micro-row input,
.cardforge-form .micro-row select {
  flex: 1 !important;
  min-width: 0 !important;
  padding: 6px 8px !important;
  border: 1px solid var(--mood-accent-color, #4a4a6a) !important;
  border-radius: 4px !important;
  background: var(--aura-bg-color, #1a1a2e) !important;
  color: var(--mood-primary-color, #e1e1ff) !important;
  font-family: inherit !important;
}

/* Ensure remove buttons are properly styled */
.cardforge-form .remove-stat,
.cardforge-form .remove-social,
.cardforge-form .remove-micro {
  background: transparent !important;
  border: none !important;
  color: var(--mood-secondary-color, #a0a0c0) !important;
  font-size: 1.2rem !important;
  cursor: pointer !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
  transition: color 0.2s ease, background-color 0.2s ease !important;
  line-height: 1 !important;
  min-width: 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

/* Preview */
.cardforge-preview {
  background: var(--surface-2, rgba(255,255,255,0.05));
  padding: 1.5rem;
  border-radius: 8px;
  flex: 1;
}

/* updated by Cascade 2025-07-05: enhanced card style */
.cardforge-card {
  position: relative;
  width: 260px;
  margin: 0 auto;
  background: var(--surface-3, rgba(255,255,255,0.02));
  border: 1.5px solid var(--border-1, rgba(255,255,255,0.2));
  border-radius: 1rem;
  box-shadow: 0 4px 18px rgba(0,0,0,0.3);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  text-align: center;
}
.cardforge-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
}
.cardforge-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.35), rgba(236,72,153,0.35));
  opacity: 0.28;
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* updated by Cascade 2025-07-05: larger avatar & glow */
.cardforge-avatar {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 1rem;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.12), 0 4px 12px rgba(0,0,0,0.25);
}

.cardforge-name {
  font-size: 1.5rem;
  margin: 0.25rem 0;
}

.cardforge-class {
  font-size: 1rem;
  opacity: 0.8;
  margin: 0;
}

.cardforge-quote {
  font-style: italic;
  margin-top: 1rem;
  font-size: 0.95rem;
  line-height: 1.4;
  opacity: 0.88;
}

/* === Additional CardForge V2 helpers === */
.cardforge-card-content {
  padding: 1.25rem 1rem 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cardforge-class-badge {
  margin-top: 0.25rem;
  font-size: 0.85rem;
}

/* Selected state for My Cards list */
.cardforge-list li.selected {
  background: rgba(99,102,241,0.15);
  border-radius: 4px;
}

