:root {
  --background-color: #0a0c18; /* Deep Midnight Blue */
  --accent-color: #625774; /* Mystic Lavender */
  --highlight-color: #d2dae1; /* Moonlight Silver */
  --border-color: #2b304a; /* Shadowed Indigo */
  --hover-color: #7ebcb5; /* Soft Teal Glow */
  --text-color: #e8e8e8; /* Celestial White */
  --secondary-accent: #a390b8; /* Pale Violet */
}

/* Navbar Styles */
.navbar-dark.bg-dark {
  background-color: var(--background-color);
}

.navbar-brand {
  font-weight: bold;
  letter-spacing: 1px;
  color: var(--highlight-color);
}

.nav-link {
  color: var(--text-color);
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--hover-color);
}

/* Body and Background */
body {
  background: linear-gradient(45deg, var(--background-color), #2c3e50, #4a6073);
  background-size: 200% 200%;
  animation: backgroundShift 15s ease infinite;
  color: var(--text-color);
}

/* Animation for background color shifting */
@keyframes backgroundShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Filters Section */
.filters {
  margin: 20px 0;
  padding: 10px;
  background-color: var(--border-color);
  border-radius: 5px;
}

/* Responsive Filters */
@media (max-width: 768px) {
  #filters-container {
    display: block;
    padding: 15px;
  }

  #filters-form select,
  #filters-form input,
  #search-button {
    width: 100%;
    margin-bottom: 10px;
  }
}

/* Sidebar Styling */
.filter-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 250px;
  background: var(--background-color);
  color: var(--highlight-color);
  padding: 20px;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 1000;
}

#toggle-sidebar {
  position: fixed; /* keeps it in the corner */
  bottom: 50px; /* adjust as needed */
  left: 10px; /* adjust as needed */
  background: var(--background-color);
  color: var(--highlight-color);
  border: 2px solid var(--highlight-color);
  padding: 10px 15px;
  z-index: 1001;
  transition: background-color 0.3s;
  margin-right: 15px; /* ensures separation from nearby text */
  border-radius: 5px; /* optional: round the edges */
}

#toggle-sidebar:hover {
  background-color: var(--secondary-accent);
  border-color: var(--hover-color);
}


.filter-sidebar.open {
  transform: translateX(0);
}

/* Loading Indicator */
.loading-indicator {
  position: fixed;
  top: 10px;
  right: 10px;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 10px;
  border-radius: 5px;
  font-weight: bold;
  z-index: 1001;
}

/* Card Flip Section */
.card-flip {
  perspective: 1000px;
  transform-style: preserve-3d;
  margin-bottom: 2rem;
  width: 100%;
  position:relative;
}

.card {
  position: relative;
  width: 100%;
  min-height: 600px;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  background-color: var(--background-color) !important;
  color: var(--text-color) !important;
  border: 1px solid var(--border-color) !important;
}

@media (max-width: 576px) {
  .card {
    min-height: 400px;
  }
}

.card-body, .card-footer, .card-title, .card-text {
  color: var(--text-color) !important;
}

.card-body {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background-color: var(--border-color) !important;
}

.card > .front,
.card > .back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  transform-style: preserve-3d;
}

.card > .front {
  z-index: 2;
  background-color: var(--border-color);
  overflow: auto;
}

.card > .back {
  transform: rotateY(180deg);
  z-index: 1;
  background-color:var(--border-color);
  padding: 10px;
  overflow-y: auto;
}

.card-flip.flip .card {
  transform: rotateY(180deg);
}

.card-flip.flip .card > .front {
  z-index: 1;
}

.card-flip.flip .card > .back {
  z-index: 2;
}
/* Card Title */
.card-title {
  width: 100%;
  text-align: center;
  margin-top: 10px;
}

.card > .front .card-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;

}


.card > .back .card-text {
  display: block;        
  white-space: normal;   
  overflow: visible;    
  -webkit-line-clamp: unset; 
  -webkit-box-orient: unset;
}


.card-footer {
  width: 100%;
  padding: 10px 0;
}



/* Button Hover Effect */
button:hover {
  background-color: var(--hover-color);
  color: var(--text-color);
  transition: background-color 0.3s ease;
}

#checkout-button {
  display: block;
  margin: 20px auto;
  background-color: var(--accent-color);
  color: var(--text-color);
}

/* Responsive Card Layout */
@media (max-width: 576px) {
  #items-container .col-lg-3,
  #items-container .col-md-4,
  #items-container .col-sm-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* Out-of-Stock Overlay */
.card-flip.out-of-stock .card-img-top {
  opacity: 0.5;
  filter: grayscale(100%); /* Optional: Add grayscale for more visual distinction */
}

.out-of-stock-overlay {
  content: 'Out of Stock';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ff0000; /* Bright red for visibility */
  font-size: 1.5em;
  font-weight: bold;
  background-color: rgba(0, 0, 0, 0.7); /* Dark background for contrast */
  padding: 10px;
  border-radius: 5px;
  text-align: center;
}


.card-flip.out-of-stock .card-img-top::after {
  content: 'Out of Stock';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: red;
  font-size: 1.5em;
  font-weight: bold;
}

/* Item Rarity Overlays */
.item-image {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
}

.item-image.common::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
}

.item-image.uncommon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 255, 0, 0.3);
}

.item-image.rare::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 255, 0.3);
}

.item-image.very-rare::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(128, 0, 128, 0.3);
}


/* Attunement Indicator Styling */
.attunement-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 4px solid #ff9800;
  box-shadow: 0 0 8px #ff9800, 0 0 16px #ffd900;
  box-sizing: border-box;
  z-index: 10;
  pointer-events: none; /* Ensures it doesn't interfere with interactions */
}

.attunement-indicator .attunement-label {
  font-family: 'Cinzel', serif;
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 1rem;
  font-weight: bold;
  color: #ff9800; 
  background-color: rgba(0, 0, 0, 0.6); /* Dark semi-transparent background */
  padding: 2px 5px;
  border-radius: 3px;
}

/* Attunement Indicator
.attunement-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(255, 255, 255, 0.9);
  color: var(--background-color);
  padding: 4px;
  font-size: 14px;
  border-radius: 50%;
  z-index: 10;
}

.attunement-indicator i {
  color: #ff9800;
} */

/* Sparkle Effect */
.sparkle-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
}

.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: sparkle 2s infinite ease-in-out;
  opacity: 0;
}

@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0); }
  50% { opacity: 1; transform: scale(1); }
}

/* Loading Animation */
.loading {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Emeril's Error Page Styling */

/* Container for Emeril's image and speech bubble */
.emeril-error-container {
  position: relative;
  display: inline-block;
  margin-top: 20px;
}

/* Emeril's Image Styling */
.emeril-image {
  max-width: 250px;
  width: 100%;
  border-radius: 50%;
  border: 2px solid var(--accent-color);
}

/* Speech Bubble Styling */
.speech-bubble {
  position: absolute;
  top: 10%;
  left: 105%;
  width: 200px;
  padding: 10px;
  background-color: var(--background-color);
  border: 2px solid var(--accent-color);
  border-radius: 10px;
  color: var(--text-color);
  text-align: left;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
  transform: translateX(10px);
}

/* Speech Text Styling */
.speech-text {
  font-style: italic;
  font-size: 1rem;
  line-height: 1.5;
}

/* Responsive Styling for Small Screens */
@media (max-width: 768px) {
  /* Center Emeril's image and speech bubble */
  .emeril-error-container {
      display: flex;
      flex-direction: column;
      align-items: center;
      text-align: center;
  }

  /* Adjust Speech Bubble Position */
  .speech-bubble {
      position: static;
      width: auto;
      margin-top: 10px;
      transform: none;
  }
}

/* Return Button Styling */
.return-button {
  margin-top: 20px;
}

.return-home {
  background-color: var(--accent-color);
  color: var(--text-color);
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
}

.return-home:hover {
  background-color: var(--hover-color);
}

/* Container for the cards */
.inventory-container .row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

/* Card Styling */
.inventory-container .card {
  flex: 2 0 100%; /* Default width */
  margin: 15px;
  max-width: 500px;
  box-sizing: border-box;
  height: 200px; /* Shorter fixed height */
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  background-color: var(--background-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 8px; /* Optional: rounded corners for a modern look */
  overflow: auto;
}

.inventory-container .card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.inventory-container .card-title {
  text-align: center;
  font-size: 1.2em;
  font-weight: bold;
  margin-top: 10px;
  margin-bottom: 10px;
  color: var(--highlight-color);
  white-space: nowrap;
  overflow: auto;
  
}

/* Card Body with Scrollable Text */
.inventory-container .card-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 15px; /* Added padding for better readability */
  font-size: 0.95em; /* Slightly larger font for readability */
  line-height: 1.6;
}

/* Scrollbar customization */
.inventory-container .card-body::-webkit-scrollbar {
  width: 8px;
}

.inventory-container .card-body::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
}

.inventory-container .card-footer {
  text-align: center;
  padding: 10px 0;
  background-color: var(--border-color);
  font-size: 0.9em;
  color: var(--highlight-color);
}

/* Button Hover Effect */
button:hover {
  background-color: var(--hover-color);
  color: var(--text-color);
  transition: background-color 0.3s ease;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
  .inventory-container .card {
    flex: 1 0 45%;
    max-width: 45%;
  }
}

@media (max-width: 576px) {
  .inventory-container .card {
    flex: 1 0 100%;
    max-width: 100%;
  }
}

.inventory-container .card-quantity {
  font-size: 0.9em;
  margin-bottom: 5px;
}

.inventory-container .card-description {
  flex-grow: 1;
  overflow-y: auto;
  max-height: 300px; /* Adjust this based on your desired height */
  line-height: 1.5;
}

.inventory-container .card-rarity {
  font-weight: bold;
  margin-top: 10px;
}

.inventory-container .rarity-common {
  color: gray;
}

.inventory-container .rarity-uncommon {
  color: green;
}

.inventory-container .rarity-rare {
  color: blue;
}

.inventory-container .rarity-very-rare {
  color: purple;
}

/* Mobile-friendly card layout */
  @media (max-width: 576px) {
    .card {

      min-height: 360px;

      height: auto;
    }

  .card-body {
    overflow-y: visible;
  }

  .card > .front {
    overflow: visible;
  }

    .card > .front .card-text {
      -webkit-line-clamp: 2;
      overflow: hidden;
    }

    .card-img-top {
      max-height: 120px;
      object-fit: cover;
    }
  }
