/* =========================
   Global / Body
========================= */
body {
    font-family: 'Arial', sans-serif;
    background: #f6f6f6;
    margin: 0;
    padding: 0;
    text-align: center;
    color: #333;
}

a {
    color: #007bff;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* =========================
   Forms / Inputs / Buttons
========================= */
form {
    background: #fff;
    display: inline-block;
    padding: 25px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    max-width: 90%;
    margin: 20px auto;
    text-align: center;
}

input[type="text"],
input[type="number"],
button {
    padding: 12px 15px;
    margin: 8px 0;
    width: 90%;
    max-width: 300px;
    font-size: 1rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

button {
    background: #007bff;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
button:hover {
    background: #0056b3;
    transform: scale(1.02);
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================
   Code Box
========================= */
.code-box {
    background: #222;
    color: #0f0;
    font-weight: bold;
    font-family: monospace;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    display: inline-block;
    word-break: break-word;
}

/* =========================
   Grids: Collections / Cards / Boosters
========================= */
.collection-grid,
.cards-grid,
.booster-grid {
    display: grid;
    gap: 15px;
    margin: 20px 10px;
}

/* Responsive columns */
.collection-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}
.cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.booster-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

@media (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

@media (max-width: 600px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

.habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 20px auto;
    padding: 0 10px;
}

/* =========================
   Set / Card / Booster Cards
========================= */
.set-card,
.card-thumb,
.booster-card {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
    background: #fafafa;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.5s ease;
    cursor: pointer;
}

.set-card:hover,
.card-thumb:hover,
.booster-card:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-thumb img,
.booster-card img {
    width: 100%;
    display: block;
    border-radius: 6px;
}

.set-card img{
        width: 50%;
        max-height: 100px;
        margin: auto auto;
            display: block;
    border-radius: 6px;
}

.set-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-weight: bold;
    margin-bottom: 5px;
}
.set-title:hover { cursor: pointer; }

.set-stats {
    font-size: 0.9em;
    color: #333;
}

.set-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.card-qty,
.selection-qty,
.card-thumb .selection-count {
    position: absolute;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.75em;
    padding: 2px 4px;
    border-radius: 3px;
}
.card-qty { bottom: 4px; right: 4px; }
.selection-qty { bottom: 2px; right: 2px; }
.card-thumb .selection-count { top: 4px; left: 4px; background: rgba(255,152,0,0.9); }

.card-selected {
    border: 2px solid #ff9800;
    box-shadow: 0 0 10px #ff9800;
}

/* New card highlight */
.new-card {
    border: 3px solid gold;
    box-shadow: 0 0 15px 5px rgba(255, 223, 0, 0.7);
    position: relative;
    z-index: 2;
}

/* Card thumbnails */
.card-thumb {
    border: 1px solid #bbb;
    background: linear-gradient(145deg, #fff, #f0f0f0);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    padding: 4px;
    transition: transform 0.3s, box-shadow 0.3s;
}
.card-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.card-thumb::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(120deg, rgba(255,255,255,0.1), transparent);
    pointer-events: none;
}

.card-thumb-shop {
    display: inline-block;
    position: relative;
    margin: 5px;
    opacity: 0;
    transform: translateY(20px);
    transition: transform 0.5s ease, opacity 0.5s ease;
    border-radius: 6px;
    overflow: hidden;
}
.card-thumb-shop img {
    width: 140px;
    height: auto;
    display: block;
    border-radius: 6px;
}

/* =========================
   Progress Bars
========================= */
.progress-container {
    width: 100%;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin: 5px 0 10px;
    height: 14px;
}
.progress-bar {
    height: 100%;
    background: #4caf50;
    width: 0%;
    transition: width 0.6s ease;
    text-align: center;
    color: #fff;
    font-size: 0.8em;
    line-height: 1;
}

/* =========================
   Modals
========================= */
.modal,
.collection-modal,
#cardModal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    justify-content: center;
    align-items: center;
    z-index: 999;
}
.modal { background: rgba(0,0,0,0.7); }
.collection-modal { background: rgba(0,0,0,0.7); }
#cardModal { background: rgba(0,0,0,0.8); z-index: 1000; }

.modal-content,
.collection-modal-content,
#cardModal .modal-content.card-popup {
    text-align: center;
    border-radius: 8px;
    padding: 15px 20px;
    background: #fff;
    max-width: 600px;
    width: 90%;
}
#cardModal .modal-content.card-popup {
    background: transparent;
    border: none;
    box-shadow: none;
    max-width: none;
    width: auto;
    height: auto;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content img,
.collection-modal-content img,
#cardModal img#cardImage {
    border-radius: 8px;
}
#cardModal img#cardImage {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    display: block;
}

/* =========================
   3D Card View
========================= */
.card-3d-container {
    perspective: 1200px;
    width: 90%;
    max-width: 350px;
    margin: 0 auto;
    position: relative;
    overflow: visible;
    background: transparent;
}
.card-3d {
    width: 100%;
    aspect-ratio: 63 / 88;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateY(0deg);
    transition: transform 0.5s cubic-bezier(0.4, 0.2, 0.2, 1);
    backface-visibility: hidden;
    background: transparent;
    will-change: transform;
    cursor: grab;
}
.card-3d:active { cursor: grabbing; }

.card-face {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    backface-visibility: hidden;
    transform-origin: center;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}
.card-face img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: block;
    margin: 0;
    padding: 0;
    background: transparent;
}
.card-face.back { transform: rotateY(180deg); }

/* Disable selection for 3D cards */
.card-3d-container,
.card-3d,
.card-face,
.card-face img {
    user-select: none;
    -webkit-user-drag: none;
    -webkit-tap-highlight-color: transparent;
}

/* =========================
   Pack Animations
========================= */
#packImage {
    width: 240px;
    transition: transform 0.6s ease, opacity 0.3s ease, height 0.4s ease, margin 0.4s ease;
}
.pack-shake { animation: shake 0.5s; }
.pack-flip { transform: rotateY(180deg); opacity: 0; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
}

#packCards img.card-thumb {
    width: 100px;
    height: auto;
    margin: 5px;
    border-radius: 6px;
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: transform 0.5s ease, opacity 0.5s ease;
}

/* =========================
   Rare Card Sparkle Effect
========================= */
.rare-card {
    position: relative;
    display: inline-block;
    overflow: hidden; /* ⬅ contain the pseudo-elements */
    border-radius: 6px;
    isolation: isolate;
    z-index: 2; /* ensure shine appears above card content but below others */
}
.rare-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(
        120deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.5) 45%,
        rgba(255,255,255,0) 70%
    );
    transform: translateX(-30%) rotate(8deg);
}
.rare-card.sparkle::after {
    animation: rareSparkle 900ms ease-out forwards;
}
.rare-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent 0%,
        rgba(255, 255, 255, 0.6) 50%,
        transparent 100%
    );
    transform: skewX(-20deg);
    animation: shine 6s ease-in-out infinite;
    pointer-events: none;
    z-index: 3;
    opacity: 0.7;
}

@keyframes shine {
    0% { left: -100%; opacity: 0; }
    10% { opacity: 1; }
    50% { left: 120%; opacity: 1; }
    60% { opacity: 0; }
    100% { left: 120%; opacity: 0; }
}

@keyframes rareSparkle {
    0% { opacity: 0; transform: translateX(-30%) rotate(8deg) scale(0.9); filter: blur(6px); }
    35% { opacity: 1; transform: translateX(10%) rotate(8deg) scale(1.05); filter: blur(0px); }
    100% { opacity: 0; transform: translateX(40%) rotate(8deg) scale(1.1); filter: blur(6px); }
}



/* =========================
   Card Animations
========================= */
.card-thumb {
    opacity: 0;
    transform: translateY(20px);
    transition: transform 0.5s ease, opacity 0.5s ease;
}
.fade-out {
    opacity: 0;
    transform: translateY(-50px) scale(0.5);
}
.fade-in {
    opacity: 1;
    transform: translateY(0) scale(1.2);
}

/* Slide transition */
.card-slide {
    position: relative;
    overflow: hidden;
}
.card-slide img {
    width: 100%;
    display: block;
    transition: transform 0.4s ease, opacity 0.4s ease;
}
.card-slide.slide-out-left { transform: translateX(-100%); opacity: 0; }
.card-slide.slide-out-right { transform: translateX(100%); opacity: 0; }
.card-slide.slide-in-left,
.card-slide.slide-in-right { transform: translateX(0); opacity: 1; }

/* =========================
   Trade / Selection UI
========================= */
#tradeSelections {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}
.selection-thumb {
    width: 60px;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.selection-thumb img { width: 100%; display: block; }
#tradeAnimation img {
    width: 240px;
    height: auto;
    border-radius: 6px;
    transition: transform 1s ease, opacity 1s ease;
}

/* =========================
   Points Summary
========================= */
.points-summary-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
    width: 100%;
}

.points-summary {
    background: linear-gradient(145deg, #fdfdfd, #f0f0f0);
    border-radius: 12px;
    padding: 20px 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    border: 1px solid #ccc;
    transition: transform 0.2s, box-shadow 0.2s;
}
.points-summary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
    cursor: default;
}

.points-summary-compact {
    display: inline-block;
    background: #007bff;
    color: #fff;
    border-radius: 25px;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    border: 1px solid #0056b3;
    transition: background 0.2s;
}
.points-summary-compact:hover {
    background: #0056b3;
    cursor: default;
}

/* =========================
   Habits Cards
========================= */
.habit-card {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.habit-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.habit-card h3 {
    margin-top: 0;
    font-size: 1.2rem;
    color: #007bff;
}
.habit-card p {
    margin: 6px 0;
    font-size: 0.95rem;
}
.habit-card button { margin-top: 10px; width: 70%; }

/* ========================= Card Swipe Area ========================= */
.card-swipe-area {
  margin-top: 15px;
  text-align: center;
  position: relative;
}

.nav-btn {
  margin: 0 20px;
}

.swipe-hint {
  display: none;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 14px;
  border-radius: 8px;
  margin-top: 10px;
  font-size: 0.95em;
}

/* On mobile: hide buttons and show swipe hint */
@media (max-width: 700px) {
  .card-swipe-area {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 15px 0;
  }

  .nav-btn {
    display: none;
  }

  .swipe-hint {
    display: inline-block;
  }
}

@keyframes swipePulse {
  0%, 100% { opacity: 0.5; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(5px); }
}
.swipe-hint {
  animation: swipePulse 2s ease-in-out infinite;
}

/* =========================
   Card Swipe Area (Desktop Cleanup)
========================= */
.card-swipe-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: nowrap;
  margin-top: 20px;
}

.card-swipe-area .nav-btn {
  width: auto !important;
  max-width: none;
  padding: 10px 18px;
  margin: 0;
  border-radius: 8px;
  font-size: 1rem;
  background: #007bff;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.card-swipe-area .nav-btn:hover {
  background: #0056b3;
  transform: scale(1.05);
}

.card-swipe-area #cardCounter {
  font-weight: bold;
  font-size: 1.1rem;
  color: #333;
}

/* Keep mobile rules as-is */
@media (max-width: 700px) {
  .card-swipe-area {
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 15px 0;
  }
}






/* ===== Card Slide Transitions ===== */
.card-slide-container {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.card-slide-img {
  width: 100%;
  height: 100%;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.card-slide-img.enter-left {
  transform: translateX(-100%);
  opacity: 0;
}
.card-slide-img.enter-right {
  transform: translateX(100%);
  opacity: 0;
}
.card-slide-img.active {
  transform: translateX(0);
  opacity: 1;
}
.card-slide-img.exit-left {
  transform: translateX(-100%);
  opacity: 0;
}
.card-slide-img.exit-right {
  transform: translateX(100%);
  opacity: 0;
}

/*Card tilt to mouse logic for collection_set.php*/

.card-3d-container {
  perspective: 1200px;
  width: 90%;
  max-width: 350px;
  margin: 0 auto;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.2s ease;
}

.card-3d-container.tilt {
  transform: rotateY(var(--rotateY, 0deg)) rotateX(var(--rotateX, 0deg));
}

.card-slide-img.active {
  box-shadow: 0 15px 25px rgba(0,0,0,0.2);
/*  transition: transform 0.4s ease, opacity 0.4s ease, box-shadow 0.2s ease;*/
transition: transform 0.4s cubic-bezier(0.22, 1.61, 0.36, 1), opacity 0.4s ease;
/*Overshoot on slide, comment this and uncomment above it to restore previous behaviour*/
}

.card-3d-container.tilt .card-slide-img.active {
  box-shadow: 0 25px 35px rgba(0,0,0,0.3);
  filter: brightness(1.05);
}




























