/**
 * Fractional CSS - Fractionalized Assets Section Styles
 * 
 * This file contains styles for:
 * - Fractional section layout
 * - Carousel for fractional assets
 * - Fraction form elements
 * - Fractions Live button
 * 
 * Extracted from index.php during section compartmentalization refactoring
 */

/* ============================================
   Fractional Section
   ============================================ */
.fractional-section {
  text-align: center;
  padding: clamp(15px, 2.5vw, 20px);
  background: linear-gradient(135deg, var(--bg) 0%, #1b2027 100%);
  border-radius: clamp(15px, 2vw, 20px);
  margin: 0;
  box-shadow: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden; /* Prevent any overflow */
}

.fractional-section h2 {
  color: var(--accent);
  font-size: clamp(1.8em, 5vw, 2.5em);
  margin-bottom: clamp(15px, 2.5vw, 20px);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  z-index: 100;
  position: relative;
}

.fractional-section p {
  color: var(--text);
  font-size: clamp(1em, 2.5vw, 1.2em);
  margin-bottom: clamp(25px, 4vw, 40px);
  max-width: min(600px, 95%);
  margin-left: auto;
  margin-right: auto;
  padding: 0 clamp(10px, 2vw, 20px);
}

/* ============================================
   Center-Mode Carousel Slider
   ============================================ */
:root {
  --carousel-gap: 1rem;
  --carousel-speed: 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  --carousel-closed: 2.5rem; /* Reduced to minimize partial card visibility */
  --carousel-open: 22rem; /* Increased width for better desktop display */
}

.carousel {
  position: relative;
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  overflow: hidden; /* Clip partial cards */
  box-sizing: border-box;
}

.carousel-controls {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-bottom: 1rem;
  padding: 0 1rem;
  z-index: 10;
  position: relative;
}

.carousel-container {
  display: flex;
  flex-direction: row;
  gap: var(--carousel-gap);
  align-items: flex-start;
  justify-content: flex-start;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-padding: 50% 0; /* Center snap point for better centering */
  transition: padding 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: grab;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  /* Ensure horizontal scrolling on mobile */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pinch-zoom; /* Allow pinch zoom but restrict to horizontal pan */
  /* Prevent vertical scrolling interference */
  overscroll-behavior-x: contain;
  overscroll-behavior-y: none;
  /* Clip partial cards */
  mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.carousel-container::-webkit-scrollbar {
  display: none;
}

.carousel-container:active {
  cursor: grabbing;
}

.slide {
  position: relative;
  flex: 0 0 var(--carousel-closed);
  height: 36rem; /* Increased height to show all content without scrolling */
  min-width: var(--carousel-closed);
  max-width: var(--carousel-closed);
  width: var(--carousel-closed);
  border-radius: 1rem;
  overflow: hidden;
  cursor: pointer;
  transition: flex-basis var(--carousel-speed), transform var(--carousel-speed), box-shadow var(--carousel-speed), min-width var(--carousel-speed), max-width var(--carousel-speed), width var(--carousel-speed);
  scroll-snap-align: center;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
  /* Ensure cards don't shrink on mobile */
  flex-shrink: 0;
  box-sizing: border-box;
}

.slide[active] {
  flex-basis: var(--carousel-open) !important;
  min-width: var(--carousel-open) !important;
  max-width: var(--carousel-open) !important;
  width: var(--carousel-open) !important;
  transform: translateY(-6px);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.45);
}

.asset-display {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.7rem;
  padding: 0;
  background: linear-gradient(transparent 0%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0.9) 100%);
  overflow: hidden; /* Remove scrollbar - ensure card height accommodates all content */
  box-sizing: border-box;
}

/* Background image for slide - using existing img element */
.slide .asset-display img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.7) saturate(80%);
  transition: filter 0.5s ease-out, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
  opacity: 1;
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
  display: block;
}

.slide:hover .asset-display img {
  filter: brightness(0.85) saturate(100%);
  transform: scale(1.06);
}

.slide[active] .asset-display img {
  display: block;
  opacity: 1;
  filter: brightness(0.7) saturate(80%);
}

.asset-display h3 {
  color: #fff;
  font-weight: 700;
  font-size: 1.35rem;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin: 0;
  text-shadow: 3px 3px 8px rgba(0,0,0,0.95), 0 0 15px rgba(0,0,0,0.7), 0 0 25px rgba(0,0,0,0.5);
  z-index: 3;
  position: relative;
}

.asset-display p,
.asset-display label,
.asset-display input,
.asset-display .fraction-price {
  display: none;
}

/* Active slide styles - proper order and alignment */
.slide[active] .asset-display {
  flex-direction: column;
  align-items: flex-start;
  padding: 1.5rem 1.5rem 1.5rem 1rem;
  gap: 0.8rem;
  justify-content: flex-start;
  overflow: hidden; /* Remove scrollbar - ensure card height accommodates all content */
}

/* Hide all content when slide is not active */
.slide .asset-display h3,
.slide .asset-display p,
.slide .asset-display label,
.slide .asset-display input,
.slide .asset-display .desired-amount-wrapper {
  display: none;
}

/* Show all content when active */
.slide[active] .asset-display h3,
.slide[active] .asset-display p,
.slide[active] .asset-display label,
.slide[active] .asset-display input,
.slide[active] .asset-display .desired-amount-wrapper {
  display: block;
  text-align: left;
  width: 100%;
  z-index: 3;
  position: relative;
}

/* 1. Display name - first */
.slide[active] .asset-display .dog-display-name {
  writing-mode: horizontal-tb;
  transform: none;
  font-size: 1.8rem;
  color: #fff;
  margin: 0 0 0.8rem 0;
  text-shadow: 3px 3px 10px rgba(0,0,0,0.95), 0 0 20px rgba(0,0,0,0.8), 0 0 30px rgba(0,0,0,0.6);
  font-weight: 700;
  order: 1;
}

/* 2. Short description - second */
.slide[active] .asset-display .dog-short-description {
  color: #fff;
  font-size: 1rem;
  line-height: 1.5;
  margin: 0 0 0.6rem 0;
  text-shadow: 3px 3px 8px rgba(0,0,0,0.95), 0 0 15px rgba(0,0,0,0.7), 0 0 25px rgba(0,0,0,0.5);
  font-weight: 500;
  order: 2;
}

/* 3. Description - third */
.slide[active] .asset-display .dog-description {
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 0.6rem 0;
  text-shadow: 3px 3px 8px rgba(0,0,0,0.95), 0 0 15px rgba(0,0,0,0.7), 0 0 25px rgba(0,0,0,0.5);
  opacity: 0.9;
  order: 3;
}

/* 4. Price per fraction - fourth */
.slide[active] .asset-display .fraction-price {
  color: var(--credit);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 0.6rem 0;
  text-shadow: 3px 3px 8px rgba(0,0,0,0.95), 0 0 15px rgba(0,0,0,0.7), 0 0 25px rgba(0,0,0,0.5);
  order: 4;
}

/* 5. Supply available - fifth */
.slide[active] .asset-display .supply-available {
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.4;
  margin: 0 0 0.8rem 0;
  text-shadow: 3px 3px 8px rgba(0,0,0,0.95), 0 0 15px rgba(0,0,0,0.7), 0 0 25px rgba(0,0,0,0.5);
  font-weight: 500;
  order: 5;
}

/* 6. Desired amount wrapper - sixth, contains label and input inline */
.slide[active] .asset-display .desired-amount-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  order: 6;
  margin: 0;
}

/* Desired amount label - inline with input */
.slide[active] .asset-display .desired-amount-label {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  text-shadow: 3px 3px 8px rgba(0,0,0,0.95), 0 0 15px rgba(0,0,0,0.7), 0 0 25px rgba(0,0,0,0.5);
  display: inline-block;
  width: auto;
  flex-shrink: 0;
}

/* Input box - smaller, darker background, inline with label */
.slide[active] .asset-display .fraction-input {
  padding: 0.35rem 0.5rem;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: rgba(19, 26, 34, 0.85);
  color: #fff;
  font-size: 0.85rem;
  margin: 0;
  width: auto;
  max-width: 100%; /* Changed to prevent overflow */
  min-width: 0;
  z-index: 10;
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.slide[active] .asset-display .fraction-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(63, 224, 249, 0.4);
  background: rgba(19, 26, 34, 0.95);
}

/* Dots navigation - visible on all devices */
.carousel-dots {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  padding: 20px 0;
  flex-wrap: wrap;
}

.carousel-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: all 0.3s;
  /* Better touch target on mobile */
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.carousel-dot::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: inherit;
  position: absolute;
}

.carousel-dot.active {
  background: var(--accent);
}

.carousel-dot.active::before {
  background: var(--accent);
  transform: scale(1.3);
}

/* ============================================
   Fraction Form
   ============================================ */
.fraction-form {
  width: 100%;
  max-width: min(400px, 95%);
  margin: 0 auto;
}

.fraction-form h4 {
  color: var(--text);
  font-size: clamp(1.2em, 3vw, 1.4em);
  margin-bottom: clamp(15px, 2.5vw, 20px);
}

.fraction-option {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  padding: 15px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  transition: background 0.3s ease;
  cursor: pointer;
}

.fraction-option:hover {
  background: rgba(255,255,255,0.2);
}

.fraction-option input[type="checkbox"] {
  margin-right: 15px;
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.fraction-label {
  color: var(--text);
  font-size: 1.1em;
  font-weight: 500;
}

.carousel-btn {
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: rgba(63, 224, 249, 0.12);
  color: var(--text);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  z-index: 10;
  position: relative;
}

.carousel-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

.carousel-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.carousel-btn.prev {
  margin-right: 0.5rem;
}

.carousel-btn.next {
  margin-left: 0.5rem;
}

.form-actions {
  margin-top: 40px;
}

.submit-btn {
  background: linear-gradient(135deg, rgba(63, 224, 249, 0.9) 0%, rgba(67, 223, 235, 0.9) 100%);
  color: #ffffff;
  border: 2px solid #000000;
  padding: clamp(8px, 1.4vw, 10px) clamp(20px, 3.5vw, 24px);
  font-size: clamp(0.85em, 1.8vw, 1em);
  font-weight: 600;
  border-radius: clamp(12px, 2vw, 16px);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  min-height: 36px;
  width: 100%;
  max-width: 100%; /* Changed to prevent overflow */
  margin: 0 auto;
  display: block;
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, rgba(63, 224, 249, 1) 0%, rgba(67, 223, 235, 1) 100%);
}

.form-details {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 100%; /* Changed to prevent overflow */
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.fraction-selection {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 20px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  border: 1px solid rgba(63,224,249,0.2);
}

.fraction-selection label {
  display: flex;
  flex-direction: column;
  font-weight: bold;
  color: var(--text);
  font-size: 0.9em;
}

.fraction-selection input {
  padding: 8px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: rgba(255,255,255,0.1);
  color: var(--text);
  font-size: 1em;
  margin-top: 5px;
}

.fraction-selection input:focus {
  outline: none;
  border-color: #43dfeb;
  box-shadow: 0 0 8px rgba(63,224,249,0.4);
}

.form-details label {
  display: flex;
  flex-direction: column;
  font-weight: bold;
  color: var(--text);
}

.form-details input {
  padding: 10px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  color: var(--text);
  font-size: 1em;
  margin-top: 5px;
}

.form-details input:focus {
  outline: none;
  border-color: #43dfeb;
  box-shadow: 0 0 10px rgba(63,224,249,0.5);
}

.form-details p {
  font-size: 1.1em;
  color: var(--accent);
  text-align: center;
}

.form-details #total-cost {
  font-weight: bold;
  color: var(--credit);
}

/* ============================================
   Wallet Addresses Section
   ============================================ */
.wallet-addresses {
  margin: 24px 0;
  text-align: left;
}

.wallet-addresses > label {
  display: block;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 12px;
  font-size: 1em;
}

.wallet-address-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.wallet-label {
  font-weight: bold;
  color: var(--credit);
  font-size: 0.9em;
  flex-shrink: 0;
}

.wallet-address {
  word-break: break-all;
  font-size: 0.9em;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.copy-btn {
  padding: 0.25rem 0.5rem;
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(63, 224, 249, 0.3);
}

.copy-btn:hover {
  background: #43dfeb;
  border-color: #43dfeb;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(63, 224, 249, 0.5);
}

.copy-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(63, 224, 249, 0.4);
}

.copy-btn.copied {
  background: var(--credit);
  border-color: var(--credit);
  color: var(--bg);
}

/* ============================================
   Fractions Live Button
   ============================================ */
.fractions-live-btn {
  display: inline-block;
  margin: clamp(15px, 2.5vw, 20px) clamp(8px, 1.5vw, 10px) 0 clamp(8px, 1.5vw, 10px);
  padding: clamp(10px, 2vw, 12px) clamp(20px, 3vw, 24px);
  background: linear-gradient(135deg, var(--accent) 0%, #43dfeb 100%);
  color: var(--bg);
  border: none;
  border-radius: clamp(20px, 3vw, 25px);
  font-size: clamp(0.95em, 2.5vw, 1.1em);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(63,224,249,0.3);
  animation: flash-glow 1.5s ease-in-out infinite alternate;
  text-align: center;
  min-height: 44px; /* Better touch target */
}

.fractions-live-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(63,224,249,0.5);
}

@keyframes flash-glow {
  0% {
    box-shadow: 0 4px 15px rgba(63,224,249,0.3), 0 0 15px rgba(63,224,249,0.2);
    filter: brightness(1);
  }
  100% {
    box-shadow: 0 4px 15px rgba(63,224,249,0.6), 0 0 25px rgba(63,224,249,0.4);
    filter: brightness(1.15);
  }
}

@media (max-width: 767px) {
  :root {
    --carousel-closed: 2rem; /* Further reduced on mobile for minimal visibility */
    --carousel-open: calc(100% - 4rem); /* Responsive width that fits in modal */
  }

  .fractional-section {
    margin: clamp(30px, 5vw, 40px) clamp(8px, 2vw, 10px);
    padding: clamp(20px, 4vw, 30px) clamp(12px, 2vw, 15px);
  }
  
  .fractional-section h2 {
    font-size: clamp(1.6em, 5vw, 2em);
  }

  .slide {
    height: clamp(26rem, 40vw, 30rem); /* Increased to show input field on mobile */
  }

  /* Keep horizontal scrolling on mobile */
  .carousel-container {
    flex-direction: row;
    scroll-snap-type: x mandatory;
    align-items: flex-start;
    justify-content: flex-start;
    padding-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    /* Ensure proper touch scrolling */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
  }

  .slide {
    min-width: var(--carousel-closed);
    max-width: var(--carousel-closed);
    flex: 0 0 var(--carousel-closed);
    flex-shrink: 0;
  }

  .slide[active] {
    min-width: var(--carousel-open);
    max-width: var(--carousel-open);
    flex-basis: var(--carousel-open);
  }

  .slide[active] .asset-display h3 {
    font-size: 1.3rem;
  }
  
  .carousel-btn {
    width: 2rem;
    height: 2rem;
    font-size: 1.2rem;
  }

  /* Keep dots visible on mobile - make them more prominent */
  .carousel-dots {
    padding: 15px 0;
    gap: 0.4rem;
  }
  
  .carousel-dot {
    min-width: 40px;
    min-height: 40px;
  }
  
  .carousel-dot::before {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 480px) {
  :root {
    --carousel-closed: 1.5rem; /* Even smaller on very small screens */
    --carousel-open: calc(100% - 3rem); /* Responsive width that fits in modal */
    --carousel-gap: 0.8rem;
  }

  /* Keep horizontal scrolling on small mobile too */
  .carousel-container {
    flex-direction: row;
    scroll-snap-type: x mandatory;
    gap: 0.8rem;
    padding-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
  }

  .slide {
    height: clamp(26rem, 45vw, 30rem); /* Increased to show input field on small mobile */
    min-width: var(--carousel-closed);
    max-width: var(--carousel-closed);
    flex: 0 0 var(--carousel-closed);
    flex-shrink: 0;
    scroll-snap-align: center;
  }

  .slide[active] {
    min-width: var(--carousel-open);
    max-width: var(--carousel-open);
    flex-basis: var(--carousel-open);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  }

  .slide[active] .asset-display {
    align-items: flex-start;
    padding: 1.2rem;
    flex-direction: column;
  }

  .slide[active] .asset-display h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .slide[active] .asset-display .dog-display-name {
    font-size: 1.5rem;
    margin-bottom: 0.6rem;
  }

  .slide[active] .asset-display .dog-short-description,
  .slide[active] .asset-display .dog-description {
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
  }

  .slide[active] .asset-display .fraction-price {
    font-size: 1rem;
    margin-bottom: 0.4rem;
  }

  .slide[active] .asset-display .supply-available {
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
  }

  .slide[active] .asset-display {
    padding: 1.2rem 1.2rem 1.2rem 0.8rem;
  }

  .slide[active] .asset-display .desired-amount-wrapper {
    flex-wrap: wrap;
  }

  .slide[active] .asset-display .desired-amount-label {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    width: 100%;
  }

  .slide[active] .asset-display .fraction-input {
    width: 100%;
    max-width: 100%;
    min-width: auto;
    padding: 0.5rem;
    background: rgba(19, 26, 34, 0.85);
  }
}

@keyframes flash-glow-strong {
  0% {
    filter: brightness(1.1) drop-shadow(0 0 16px #ffe154) drop-shadow(0 0 8px #3fe0f9);
  }
  100% {
    filter: brightness(1.35) drop-shadow(0 0 32px #ffe154) drop-shadow(0 0 16px #3fe0f9);
  }
}

