/* CardForge Base Styles
 * Core variables, resets, and base card container
 * Extracted from: cardforge-card.css (base container, animations, glow effects)
 * Created: 2025-08-03
 */

/* Basic card container - will be extended by modular system */
.card-preview-canvas {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: fit-content;
  border-radius: 1rem;
  background: var(--card-bg, rgba(18,22,34,0.85));
  border: 1px solid var(--card-border, rgba(255,255,255,0.15));
  overflow: visible;
  display: block;
  padding: 0;
  box-sizing: border-box;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--card-text, #e1faff);
  contain: layout style;
}

/* Basic glow effect - will be enhanced by modular system */
.card-preview-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: 1rem;
  background: var(--card-glow, linear-gradient(135deg, #35f5ff, #9dff5c));
  background-size: 300% 300%;
  animation: cardGlow 8s ease-in-out infinite;
  pointer-events: none;
  opacity: var(--card-glow-opacity, 0.6);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  transition: opacity 0.3s ease;
}

@keyframes cardGlow {
  0%, 100% { background-position: 0% 50%; opacity: 0.4; }
  50% { background-position: 100% 50%; opacity: 0.8; }
}

.card-preview-canvas:hover {
  box-shadow: var(--card-hover-shadow, 0 16px 32px rgba(79,248,255,0.3));
}

.card-preview-canvas:hover::before {
  opacity: var(--card-glow-hover-opacity, 1);
}

/* ===== SOCIAL LINKS DISPLAY ON CARD ===== */
/* Extracted from cardforge-ui.css - Card-specific social link styling */

/* Social Links Display on Card */
.social-links {
  display: flex;
  gap: 12px;
  margin: 16px 0 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.social-link:hover {
  background: var(--mood-primary-color, #5AE4FF);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(90, 228, 255, 0.3);
}

.social-link .social-icon {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
  transition: all 0.2s ease;
}

/* Theme-specific adjustments */
.theme-neofantasy .social-link {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-neofantasy .social-link:hover {
  background: var(--mood-accent-color, #8b5cf6);
  box-shadow: 0 0 15px var(--mood-accent-color, #8b5cf6);
}

/* ===== FRONT FACE STYLING ===== */
/* Extracted from cardforge-ui.css - Card display components */

/* Front face styling */
.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-avatar {
  width: 60px;
  height: 60px;
  object-fit: cover;
}

.card-badge, .card-rarity, .card-achievement {
  display: inline-block;
  padding: 2px 6px;
  margin: 4px 4px 4px 0;
  background: var(--mood-primary-color);
  color: #fff;
  border-radius: 4px;
  font-size: 0.85rem;
}

.stat-bar {
  display: flex;
  align-items: center;
  margin: 6px 0;
}

.stat-label {
  flex: 1;
  font-size: 0.8rem;
  color: var(--mood-secondary-color);
}

.stat-progress {
  height: 8px;
  background: linear-gradient(90deg, var(--aura-glow, #5AE4FF), var(--mood-primary-color, #5AE4FF));
  border-radius: 4px;
  transition: width 1s ease-out;
  width: 0;
  position: relative;
  overflow: hidden;
}

/* Animated fill effect */
.stat-progress.animate {
  width: var(--target-width, 0%) !important;
}

/* Subtle glow effect during animation */
.stat-progress::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: translateX(-100%);
  transition: transform 1s ease-out;
}

.stat-progress.animate::before {
  transform: translateX(100%);
}

/* ===== BACK-OF-CARD INFORMATION GRID LAYOUT ===== */
/* Information Grid Layout - Header, Social Row, Two-Column Content Grid */

.card-back-content {
  padding: 1rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Back Header - Name and Class */
.back-header {
  text-align: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.back-header .card-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  color: var(--mood-primary-color, #5AE4FF);
}

.back-header .card-class {
  font-size: 0.9rem;
  color: var(--mood-secondary-color, #a0a0c0);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

/* Back Body - Main Content Area */
.back-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Social Links Section - Horizontal Row */
.social-section {
  text-align: center;
}

.social-section .section-title {
  font-size: 0.85rem;
  color: var(--mood-secondary-color, #a0a0c0);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 0.75rem 0;
  font-weight: 500;
}

.social-section .social-links {
  justify-content: center;
  margin: 0;
}

/* Biography Section - Above Grid */
.biography-section {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.75rem;
  backdrop-filter: blur(4px);
  margin-bottom: 1rem;
}

.biography-section .section-title {
  font-size: 0.8rem;
  color: var(--mood-secondary-color, #a0a0c0);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 0.75rem 0;
  font-weight: 500;
  text-align: center;
}

/* Information Grid - Two Column Layout */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  flex: 1;
}

/* Back Sections - Badges and Attributes */
.back-section {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.75rem;
  backdrop-filter: blur(4px);
}

.back-section .section-title {
  font-size: 0.8rem;
  color: var(--mood-secondary-color, #a0a0c0);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 0.75rem 0;
  font-weight: 500;
  text-align: center;
}

/* Badges Section - Glass Panel Grid */
.badges-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  justify-items: center;
  width: 100%;
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.preset-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  color: var(--text-primary);
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 80px;
}

.preset-btn:hover {
  background: var(--glass-bg-hover);
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.preset-btn.active {
  background: var(--accent-color-alpha);
  border-color: var(--accent-color);
  box-shadow: 0 4px 15px var(--accent-color-alpha);
}

.preset-image {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  margin-left: 1rem;
  background: var(--card-bg);
  border: 2px solid var(--glass-border);
}

.preset-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.preset-btn:hover .preset-image img {
  transform: scale(1.05);
}

.preset-info {
  flex: 1;
  padding: 1rem 1rem 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.preset-character {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-color);
  margin-bottom: 0.125rem;
}

.preset-name {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
}

.preset-type {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
  opacity: 0.8;
}

/* ===== ROLL BUTTON STYLES ===== */
.roll-button-container {
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
}

.roll-btn {
  background: linear-gradient(135deg, var(--accent-color), var(--mood-primary-color));
  border: 2px solid var(--accent-color);
  border-radius: 16px;
  padding: 1rem 2rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  color: white;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 70px;
  position: relative;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.roll-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  border-color: var(--mood-secondary-color);
}

.roll-btn:active {
  transform: translateY(-1px) scale(0.98);
  transition: all 0.1s ease;
}

.roll-icon {
  font-size: 2rem;
  animation: rollSpin 2s ease-in-out infinite;
}

.roll-btn:hover .roll-icon {
  animation: rollSpinFast 0.5s ease-in-out infinite;
}

@keyframes rollSpin {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(90deg); }
  50% { transform: rotate(180deg); }
  75% { transform: rotate(270deg); }
}

@keyframes rollSpinFast {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.roll-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.roll-label {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.roll-subtitle {
  font-size: 0.85rem;
  opacity: 0.9;
  font-weight: 400;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .presets-grid {
    grid-template-columns: 1fr;
  }
  
  .preset-btn {
    min-height: 70px;
  }
  
  .preset-image {
    width: 50px;
    height: 50px;
  }
  
  .preset-character {
    font-size: 0.8rem;
  }
  
  .preset-name {
    font-size: 0.8rem;
  }
  
  .preset-type {
    font-size: 0.7rem;
  }
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  transition: all 0.2s ease;
  min-height: 60px;
  max-width: 100%;
  justify-content: center;
  backdrop-filter: blur(2px);
  overflow: hidden;
}

.badge-item:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(90, 228, 255, 0.2);
}

.badge-icon {
  margin-bottom: 0.25rem;
  color: var(--mood-primary-color, #5AE4FF);
  display: grid;
  justify-content: center;
  align-items: center;
  min-height: 1.5rem;
  gap: 0.1rem;
}

/* Single icon - normal size */
.badge-icon:has(i:only-child) {
  font-size: 1.2rem;
}

/* 2 icons - horizontal row */
.badge-icon:has(i:nth-child(2):last-child) {
  grid-template-columns: 1fr 1fr;
  font-size: 0.9rem;
}

/* 3-4 icons - 2x2 grid */
.badge-icon:has(i:nth-child(3)) {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  font-size: 0.8rem;
}

/* 5+ icons - 3x2 grid with smaller icons */
.badge-icon:has(i:nth-child(5)) {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  font-size: 0.7rem;
}

.badge-icon i {
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge-label {
  font-size: 0.7rem;
  color: var(--mood-secondary-color, #a0a0c0);
  text-align: center;
  line-height: 1.2;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-count {
  font-size: 0.6rem;
  color: var(--mood-accent-color, #8b5cf6);
  font-weight: 600;
  margin-top: 0.1rem;
}

/* Attributes Section - Key-Value Pairs */
.attributes-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.attribute-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  border-left: 3px solid var(--mood-primary-color, #5AE4FF);
}

.attribute-key {
  font-size: 0.75rem;
  color: var(--mood-secondary-color, #a0a0c0);
  font-weight: 500;
}

.attribute-value {
  font-size: 0.75rem;
  color: var(--mood-text-color, #ffffff);
  font-weight: 400;
}

/* Biography Text */
.biography-text {
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--mood-secondary-color, #a0a0c0);
  font-style: italic;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  text-align: left;
}

/* Mobile Responsive - Stack Grid Vertically */
@media (max-width: 768px) {
  .info-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .badges-container {
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
  }
  
  .badge-item {
    min-height: 50px;
    padding: 0.4rem;
  }
  
  .badge-icon {
    font-size: 1rem;
  }
  
  .badge-label {
    font-size: 0.65rem;
  }
}

/* Basic content structure - will be enhanced by modular system */
.card-preview-content {
  width: 100%;
  overflow: hidden;
  padding: 0;
  position: relative;
  z-index: 1;
}
