/* Card Display Effects - Enhanced holographic effects */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
  padding: 16px 0;
}

.card-wrapper {
  display: grid;
  place-items: center;
  position: relative;
  aspect-ratio: 5/7;
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
  overflow: visible;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              filter 0.3s ease;
  transform-style: preserve-3d;
  perspective: 1000px;
}

.card-wrapper:hover {
  transform: scale(1.08) rotateY(8deg) rotateX(-5deg);
  filter: brightness(1.1);
}

.card-reflection {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  width: 100%;
  height: 100%;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.3),
    0 8px 32px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.3s ease;
}

.card-wrapper:hover .card-reflection {
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.4),
    0 16px 48px rgba(0, 0, 0, 0.3),
    0 0 40px rgba(255, 255, 255, 0.1);
}

.card-reflection img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Light sweep reflection */
.card-reflection::after {
  content: "";
  height: 200%;
  width: 60px;
  position: absolute;
  top: -50%;
  left: -100px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    rgba(255, 255, 255, 0.8),
    rgba(255, 255, 255, 0.4),
    transparent
  );
  opacity: 0;
  transform: rotate(25deg);
  animation: reflection 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes reflection {
  0%, 70% { left: -100px; opacity: 0; }
  75% { opacity: 0.8; }
  100% { left: 250px; opacity: 0; }
}

.card-status {
  aspect-ratio: 5/7;
  border-radius: 8px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* rare=0: Normal - no effect */

/* rare=1: Rare (Cyan/Turquoise holographic) */
.pattern-rare {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 255, 255, 0.03) 2px,
      rgba(0, 255, 255, 0.03) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(64, 224, 208, 0.03) 2px,
      rgba(64, 224, 208, 0.03) 4px
    ),
    radial-gradient(ellipse at 30% 20%, rgba(0, 255, 255, 0.4), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(64, 224, 208, 0.3), transparent 50%);
  background-size: 100% 100%;
  mix-blend-mode: screen;
  opacity: 0.6;
  animation: holo-shift 4s ease-in-out infinite;
}

.color-rare {
  background: linear-gradient(
    125deg,
    transparent 0%,
    rgba(0, 255, 255, 0.5) 20%,
    rgba(0, 200, 255, 0.3) 40%,
    transparent 50%,
    rgba(64, 224, 208, 0.4) 60%,
    rgba(0, 255, 200, 0.5) 80%,
    transparent 100%
  );
  background-size: 300% 300%;
  mix-blend-mode: overlay;
  opacity: 0.7;
  animation: gradient-flow 5s ease-in-out infinite;
}

/* rare=2: Shiny (Rainbow prismatic) */
.pattern-shiny {
  background:
    repeating-conic-gradient(
      from 0deg at 50% 50%,
      rgba(255, 0, 0, 0.1) 0deg,
      rgba(255, 127, 0, 0.1) 45deg,
      rgba(255, 255, 0, 0.1) 90deg,
      rgba(0, 255, 0, 0.1) 135deg,
      rgba(0, 0, 255, 0.1) 180deg,
      rgba(75, 0, 130, 0.1) 225deg,
      rgba(148, 0, 211, 0.1) 270deg,
      rgba(255, 0, 0, 0.1) 315deg
    );
  background-size: 100% 100%;
  mix-blend-mode: screen;
  opacity: 0.5;
  animation: prism-rotate 8s linear infinite;
}

.color-shiny {
  background: linear-gradient(
    45deg,
    #ff000080, #ff7f0080, #ffff0080, #00ff0080,
    #0000ff80, #4b008280, #9400d380, #ff000080,
    #ff7f0080, #ffff0080
  );
  background-size: 500% 500%;
  animation: rainbow-sweep 4s ease-in-out infinite;
  mix-blend-mode: color-dodge;
  opacity: 0.4;
}

/* rare=3: Unique (Gold legendary) */
.pattern-unique {
  background:
    radial-gradient(ellipse at 25% 25%, rgba(255, 215, 0, 0.6), transparent 40%),
    radial-gradient(ellipse at 75% 75%, rgba(255, 200, 0, 0.5), transparent 40%),
    radial-gradient(ellipse at 50% 50%, rgba(255, 247, 0, 0.3), transparent 60%),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 5px,
      rgba(255, 215, 0, 0.1) 5px,
      rgba(255, 215, 0, 0.1) 10px
    );
  background-size: 200% 200%;
  mix-blend-mode: screen;
  opacity: 0.7;
  animation: gold-pulse 3s ease-in-out infinite;
}

.color-unique {
  background:
    linear-gradient(
      115deg,
      transparent 10%,
      rgba(255, 215, 0, 0.6) 25%,
      rgba(255, 255, 200, 0.8) 35%,
      rgba(255, 215, 0, 0.6) 45%,
      transparent 55%,
      rgba(255, 200, 0, 0.5) 70%,
      rgba(255, 247, 0, 0.7) 80%,
      transparent 90%
    );
  background-size: 300% 300%;
  mix-blend-mode: soft-light;
  opacity: 0.6;
  animation: gold-sweep 4s ease-in-out infinite;
}

@keyframes holo-shift {
  0%, 100% {
    opacity: 0.5;
    filter: hue-rotate(0deg);
  }
  50% {
    opacity: 0.7;
    filter: hue-rotate(30deg);
  }
}

@keyframes gradient-flow {
  0% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}

@keyframes prism-rotate {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(360deg); }
}

@keyframes rainbow-sweep {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes gold-pulse {
  0%, 100% {
    opacity: 0.6;
    background-position: 0% 0%;
  }
  50% {
    opacity: 0.8;
    background-position: 100% 100%;
  }
}

@keyframes gold-sweep {
  0% { background-position: 200% 0%; }
  100% { background-position: -100% 100%; }
}

/* Sparkle/star particles */
.card-wrapper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(2px 2px at 15% 20%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(2px 2px at 85% 30%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 45% 60%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(2px 2px at 75% 80%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1px 1px at 25% 90%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 55% 10%, rgba(255, 255, 255, 0.8), transparent);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  animation: sparkle 3s ease-in-out infinite;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  border-radius: 8px;
}

.card-wrapper:hover::before {
  opacity: 1;
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0;
    transform: scale(1);
  }
  25% {
    opacity: 1;
    transform: scale(1.02);
  }
  50% {
    opacity: 0.5;
    transform: scale(1);
  }
  75% {
    opacity: 1;
    transform: scale(1.02);
  }
}

/* Sweep light effect on status layers */
.card-status.pattern-rare::after,
.card-status.pattern-shiny::after,
.card-status.pattern-unique::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    rgba(255, 255, 255, 0.6),
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transform: skewX(-20deg);
  animation: sweep-light 6s ease-in-out infinite;
}

@keyframes sweep-light {
  0%, 60% { left: -100%; opacity: 0; }
  70% { opacity: 1; }
  100% { left: 200%; opacity: 0; }
}

/* Hover effects - intensify animations */
.card-wrapper:hover .pattern-rare,
.card-wrapper:hover .pattern-shiny,
.card-wrapper:hover .pattern-unique {
  animation-duration: 2s;
  opacity: 0.8;
}

.card-wrapper:hover .color-rare,
.card-wrapper:hover .color-shiny,
.card-wrapper:hover .color-unique {
  animation-duration: 2s;
  opacity: 0.9;
}

.card-wrapper:hover .card-status::after {
  animation-duration: 3s;
}

/* Service icons in profile (right side) */
.service-icons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: auto;
  align-self: flex-start;
}

.service-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  opacity: 0.8;
  transition: opacity 0.2s, transform 0.2s;
}

.service-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Card page layout */
.card-page {
  padding: 16px 0;
}

.card-header {
  margin-bottom: 8px;
}

.card-header h2 {
  margin: 0;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: 8px;
  flex: 1;
}

.card-stats .stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 50px;
  padding: 4px 8px;
  border-radius: 4px;
}

.card-stats .stat-value {
  font-size: 1.2em;
  font-weight: bold;
  color: var(--text-primary, #333);
}

.card-stats .stat-label {
  font-size: 0.75em;
  color: var(--text-secondary, #666);
}

/* Rarity colored stats */
.card-stats .rare-unique {
  background: rgba(255, 247, 0, 0.2);
}
.card-stats .rare-unique .stat-value {
  color: #b8860b;
}

.card-stats .rare-shiny {
  background: linear-gradient(135deg, rgba(255, 255, 0, 0.15), rgba(255, 127, 0, 0.15));
}
.card-stats .rare-shiny .stat-value {
  color: #ff8c00;
}

.card-stats .rare-rare {
  background: rgba(0, 255, 255, 0.15);
}
.card-stats .rare-rare .stat-value {
  color: #20b2aa;
}

/* Card item with detail below */
.card-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.card-count {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: bold;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

.no-cards {
  text-align: center;
  padding: 32px;
  color: var(--text-secondary, #666);
}

/* Card detail below card */
.card-detail {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-primary, #333);
}

.card-detail .card-cp {
  font-weight: bold;
}

.card-detail .card-rarity {
  font-size: 16px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .card-stats {
    background: var(--bg-secondary, #2a2a2a);
  }

  .card-stats .stat-value {
    color: var(--text-primary, #eee);
  }

  .card-stats .stat-label {
    color: var(--text-secondary, #aaa);
  }

  .card-stats .rare-unique .stat-value {
    color: #ffd700;
  }

  .card-stats .rare-shiny .stat-value {
    color: #ffa500;
  }

  .card-stats .rare-rare .stat-value {
    color: #40e0d0;
  }

  .card-detail {
    color: var(--text-primary, #eee);
  }

  .card-detail .card-status-text {
    color: var(--text-secondary, #aaa);
  }
}

/* RSE section title */
.rse-section-title {
  margin: 24px 0 12px;
  font-size: 1.1em;
  color: var(--text-primary, #333);
}

/* RSE character sections */
.rse-characters {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
}

.rse-character-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.rse-character-main {
  display: flex;
  justify-content: center;
}

.rse-character-main .card-wrapper {
  width: 250px;
  max-width: 250px;
}

/* RSE card grid (cards below character) */
.rse-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  width: 100%;
  padding: 20px;
  background: rgba(128, 128, 128, 0.08);
  border-radius: 12px;
}

.rse-card-grid .card-wrapper {
  max-width: 180px;
}

.rse-card-grid .card-info-name {
  font-size: 11px;
}

.rse-card-grid .card-info-text {
  font-size: 12px;
}

.rse-card-grid .card-key-btn {
  font-size: 9px;
  padding: 2px 8px;
}

/* Card info (below card) */
.card-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  text-align: center;
}

.card-info-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  position: relative;
}

.card-info-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #333);
}

.card-info-header .card-key-btn {
  position: absolute;
  right: 0;
}

.card-info-text {
  font-size: 11px;
  color: var(--text-secondary, #666);
  line-height: 1.5;
}

.card-key-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  cursor: default;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Dark mode for RSE */
@media (prefers-color-scheme: dark) {
  .rse-section-title {
    color: var(--text-primary, #eee);
  }

  .rse-card-grid {
    background: rgba(255, 255, 255, 0.05);
  }

  .card-info-name {
    color: var(--text-primary, #eee);
  }

  .card-info-text {
    color: var(--text-secondary, #aaa);
  }
}
