:root {
  --radius: 0.6rem;
}
* { outline-offset: 2px; }
.hide-scrollbar { scrollbar-width: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }

/* MAIN Headings = Sora, MAIN Body = Inter */
h1,h2,h3,h4,h5,h6,.font-display { font-family: 'Sora', system-ui, -apple-system, sans-serif; font-size-adjust: from-font; }
body, .font-sans { font-family: 'Inter', system-ui, -apple-system, sans-serif; font-size-adjust: from-font; }

/* Card hover subtle motion */
.card {
  transform: translateZ(0);
  transition: transform .2s ease, border-color .2s ease, background-color .2s ease;
}
.card:hover { transform: translateY(-2px); }

/* 3D card container for hero section */
.cards-3d-container {
  perspective: 1000px; /* Establishes a 3D perspective */
  transform-style: preserve-3d; /* Ensures children participate in 3D space */
}

/* Hero Cards Static Positioning (formerly animated) */
.hero-card-item {
  /* No initial opacity: 0; now, they are always visible */
}

.hero-card-left {
  /* Final state from former animation */
  transform: translateY(-50%) rotateZ(-18deg) translateZ(-20px);
}

.hero-card-middle {
  /* Final state from former animation */
  transform: translateX(-50%) scale(1.05) translateZ(30px);
}

.hero-card-right {
  /* Final state from former animation (already had rotateZ(18deg), added translateY for consistency) */
  transform: translateY(-50%) rotateZ(18deg) translateZ(-20px);
}

/* Hero Title Word */
.hero-title-word {
  display: inline-block; /* Essential for correct layout */
  opacity: 1; /* Always visible */
  transform: translateY(0); /* No initial transform */
}

/* Element Colors */
.element-badge-light, .element-tag[data-element="Light"] .element-tag-dot { --element-color: 240 5.9% 90%; }
.element-badge-dark, .element-tag[data-element="Dark"] .element-tag-dot { --element-color: 240 4% 50%; }
.element-badge-balance, .element-tag[data-element="Balance"] .element-tag-dot { --element-color: 262 88% 78%; }
.element-badge-grass, .element-tag[data-element="Grass"] .element-tag-dot { --element-color: 142 76% 36%; }
.element-badge-fire, .element-tag[data-element="Fire"] .element-tag-dot { --element-color: 0 84% 60%; }
.element-badge-water, .element-tag[data-element="Water"] .element-tag-dot { --element-color: 206 90% 54%; }
.element-badge-electric, .element-tag[data-element="Electric"] .element-tag-dot { --element-color: 50 96% 54%; }
.element-badge-ground, .element-tag[data-element="Ground"] .element-tag-dot { --element-color: 36 78% 41%; }

.element-badge {
  --bg-alpha: 0.1;
  --border-alpha: 0.4;
  background-color: hsla(var(--element-color), var(--bg-alpha));
  border-color: hsla(var(--element-color), var(--border-alpha));
  color: hsl(var(--element-color));
}

/* Element Filter Tags */
.element-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  line-height: 1;
  padding: 0.5rem 0.875rem;
  border-radius: 9999px;
  border: 1px solid rgb(63 63 70);
  background-color: transparent;
  color: rgb(161 161 170);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  user-select: none;
}
.element-tag:hover {
  background-color: rgb(39 39 42);
  color: rgb(228 228 231);
}
.element-tag .element-tag-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: rgb(82 82 91);
  transition: background-color 0.2s ease-in-out;
  background-color: hsl(var(--element-color));
}
/* Include state */
.element-tag[data-state="1"] {
  border-color: rgba(34, 197, 94, 0.4);
  background-color: rgba(34, 197, 94, 0.1);
  color: rgb(134 239 172);
}
.element-tag[data-state="1"] .element-tag-dot {
  background-color: rgb(34 197 94);
}
/* Exclude state */
.element-tag[data-state="2"] {
  border-color: rgba(239, 68, 68, 0.4);
  background-color: rgba(239, 68, 68, 0.1);
  color: rgb(252 165 165);
}
.element-tag[data-state="2"] .element-tag-dot {
  background-color: rgb(239 68 68);
}

/* Details Dialog */
#details-dialog[open] {
  opacity: 1; /* Ensure visible after animation or if animation fails */
  animation: fade-in .3s ease-out forwards; /* Added forwards */
}
#details-dialog[open] #details-dialog-content {
  transform: translateX(0); /* Ensure in position after animation or if animation fails */
  animation: slide-in .3s ease-out forwards; /* Added forwards */
}

/* Closing animations for Details Dialog */
#details-dialog.details-dialog-closing #details-dialog-content {
  animation: slide-out .3s ease-in forwards;
}
#details-dialog.details-dialog-closing::backdrop {
  animation: fade-out .3s ease-in forwards;
}

#details-dialog::backdrop { background: rgba(10,10,10,0.8); backdrop-filter: blur(4px); }

/* Checkout Dialog Animations (formerly Rent Dialog) */
#checkout-dialog[open] {
  opacity: 1;
  animation: fade-in .3s ease-out forwards;
  max-height: 90vh; /* allow taller dialog similar to rentals drawer */
  display: flex; /* Use flexbox for layout */
  flex-direction: column; /* Stack header, content, footer */
  width: 95vw; /* ensure responsive width */
  max-width: 40rem; /* match max-w-xl for a roomier cart */
}
#checkout-dialog[open] {
  transform: scale(1);
  animation: zoom-in .3s ease-out forwards;
}

#checkout-dialog.checkout-dialog-closing {
  animation: zoom-out .3s ease-in forwards;
}
#checkout-dialog.checkout-dialog-closing::backdrop {
  animation: fade-out .3s ease-in forwards;
}

#checkout-dialog::backdrop { background: rgba(10,10,10,0.8); backdrop-filter: blur(4px); }

/* Rentals Drawer Animations */
#rentals-drawer[open] {
  opacity: 1;
  animation: fade-in .3s ease-out forwards;
}
#rentals-drawer[open] {
  transform: scale(1);
  animation: zoom-in .3s ease-out forwards;
}

#rentals-drawer.rentals-drawer-closing {
  animation: zoom-out .3s ease-in forwards;
}
#rentals-drawer.rentals-drawer-closing::backdrop {
  animation: fade-out .3s ease-in forwards;
}

#rentals-drawer::backdrop { background: rgba(10,10,10,0.8); backdrop-filter: blur(4px); }

/* Custom Calendar Dialog Styles */
#calendar-dialog[open] {
  opacity: 1;
  animation: fade-in .3s ease-out forwards;
}
#calendar-dialog[open] {
  transform: scale(1);
  animation: zoom-in .3s ease-out forwards;
}

#calendar-dialog.calendar-dialog-closing {
  animation: zoom-out .3s ease-in forwards;
}
#calendar-dialog.calendar-dialog-closing::backdrop {
  animation: fade-out .3s ease-in forwards;
}

#calendar-dialog::backdrop { background: rgba(10,10,10,0.8); backdrop-filter: blur(4px); }

/* Day cell styling */
.calendar-day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem; /* Adjust as needed */
  height: 1.8rem; /* Adjust as needed */
  border-radius: 0.375rem; /* rounded-md */
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  margin: 0.1rem; /* Small margin for spacing */
}

.calendar-day:hover:not(.calendar-disabled):not(.calendar-selected) {
  background-color: #2D2D31; /* neutral-800 slightly lighter for hover */
  color: #FFFFFF; /* white */
}

.calendar-day.calendar-today {
  border: 1px solid #FFFFFF; /* Changed from brand-DEFAULT to white */
  color: #FFFFFF; /* Changed from brand-DEFAULT to white */
  background-color: transparent;
}

.calendar-day.calendar-selected {
  background-color: #FFFFFF; /* Changed from brand-DEFAULT to white */
  color: #0A0A0A; /* neutral-950 (for text on white bg) */
}

.calendar-day.calendar-disabled {
  color: #52525B; /* neutral-600 */
  cursor: not-allowed;
  opacity: 0.6;
}

.calendar-day.calendar-other-month {
  color: #71717A; /* neutral-500 */
  opacity: 0.7;
}

/* Input style specific for calendar triggering inputs */
.cart-item-input.date-input {
  /* This ensures our custom styles override default input styling for date inputs */
  background-color: #0A0A0A; /* neutral-950 */
  border: 1px solid #27272A; /* neutral-800 */
  padding: 0.5rem 0.75rem; /* px-3 py-2 */
  height: 2.25rem; /* h-9 */
  border-radius: 0.375rem; /* rounded-md */
  color: #E5E7EB; /* neutral-200 */
  outline: none;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  cursor: pointer; /* Indicate it's clickable */
}
.cart-item-input.date-input:focus {
  border-color: #52525B; /* neutral-700 */
  box-shadow: 0 0 0 2px rgba(82, 82, 91, 0.6); /* focus-ring-2 focus-ring-neutral-700/60 */
}

/* Small inputs for cart items */
.cart-input-sm {
  background-color: transparent;
  border: 1px solid rgb(63 63 70); /* border-neutral-700 */
  padding: 0.25rem 0.5rem; /* px-2 py-1 */
  height: 2rem; /* h-8 */
  border-radius: 0.375rem; /* rounded-md */
  color: rgb(228 228 231); /* text-neutral-200 */
  outline: none;
  font-size: 0.875rem; /* text-sm */
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  -webkit-text-security: none;
  text-security: none;
  caret-color: #A5B4FC; /* subtle brand accent when typing */
}

.cart-input-sm.date-input-sm {
  cursor: pointer;
}

.cart-input-sm:focus {
  border-color: #A5B4FC; /* brand color */
  box-shadow: 0 0 0 1px #A5B4FC; /* focus ring */
}

/* small label next to duration input */
.cart-duration-label {
  margin-left: 0.5rem;
  font-size: 0.875rem;
  color: rgb(163 163 163); /* neutral-400 */
  white-space: nowrap;
}

/* Hide number input spinners */
.cart-input-sm[type="number"]::-webkit-inner-spin-button,
.cart-input-sm[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.cart-input-sm[type="number"] {
  -moz-appearance: textfield; /* Firefox */
}

/* FAQ Accordion Styles */
.faq-content {
  /* This height is controlled by JS to animate smoothly */
  transition: height 0.3s ease-in-out;
}

.faq-trigger[aria-expanded="true"] .faq-chevron {
  transform: rotate(180deg);
}

/* Rentals Accordion Styles */
.rental-accordion-content {
  transition: height 0.3s ease-in-out;
  overflow: hidden;
}

.rental-accordion-trigger[aria-expanded="true"] .rental-accordion-chevron {
  transform: rotate(180deg);
}

/* Rentals item removal animation */
.rental-item-removing {
  animation: fade-out-slide-up 0.4s ease-out forwards;
}

@keyframes fade-out-slide-up {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
    margin-bottom: 12px; /* Tailwind's space-y-3 on parent */
    height: auto; /* Calculate current height */
  }
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top-width: 0;
    border-bottom-width: 0;
    overflow: hidden;
  }
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slide-out { from { transform: translateX(0); } to { transform: translateX(100%); } } /* New keyframe for sliding out */
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } } /* New keyframe for fading out */
@keyframes zoom-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes zoom-out {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.95); }
}

/* Search bar animation utilities */
.search-fade-out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.search-fade-in {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

/* Specific for suggestions for a slight slide effect */
#suggestions.search-fade-out {
  transform: translateY(-5px);
}
#suggestions.search-fade-in {
  transform: translateY(0);
}

#suggestions { z-index: 50; border: 1px solid rgb(38 38 38); background: rgb(10 10 10); border-radius: .6rem; box-shadow: 0 10px 30px rgba(0,0,0,.5); overflow: hidden; }
.suggest-item { display:flex; gap:.6rem; align-items:center; padding:.5rem .75rem; font-size:.875rem; color:rgb(212 212 212); cursor:pointer; }
.suggest-item:hover, .suggest-item[data-active="true"] { background: rgb(23 23 23); color:white; }
.suggest-kbd { margin-left:auto; color:rgb(163 163 163); font-size:.75rem; display: inline-flex; align-items: center; justify-content: center; }
.suggest-tag { font-size:.7rem; padding:.1rem .4rem; border:1px solid rgb(38 38 38); background:rgb(15 15 15); border-radius:.4rem; color:rgb(163 163 163); }

/* Saelogy Gradient Text */
.saelogy-gradient-text {
  background: linear-gradient(90deg, #A5B4FC, #E0E7FF, #A5B4FC); /* Brand colors */
  background-size: 200% auto; /* Ensures gradient is wider than text for animation */
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 3s ease infinite alternate; /* Subtle animation */
  padding-bottom: 0.125em; /* Add a small padding to prevent descenders from being clipped */
}

/* Progress Bar Gradient */
#progress-bar {
  background: linear-gradient(90deg, #A5B4FC, #E0E7FF, #A5B4FC); /* Brand colors */
  background-size: 200% auto; /* Ensures gradient is wider than text for animation */
  animation: gradient-shift 3s ease infinite alternate; /* Subtle animation for general progress/loading */
}

/* New: Reading Progress Bar Styles */
#reading-progress-bar {
  background: linear-gradient(90deg, #A5B4FC, #E0E7FF, #A5B4FC); /* Same brand gradient */
  background-size: 200% auto; /* Ensures gradient is wider than text for animation */
  animation: gradient-shift 3s ease infinite alternate; /* Match saelogy text logo animation */
  position: fixed;
  top: 0;
  left: 0;
  height: 3.67px; /* Subtle height */
  width: 0; /* Starts hidden */
  z-index: 69; /* Above content, below global loading bar */
  transition: width 0.2s ease-out; /* Smooth transition for width changes on scroll */
  pointer-events: none; /* Do not block interaction with elements below */
}

@keyframes gradient-shift {
  0% { background-position: 0% center; }
  100% { background-position: 100% center; }
}

/* Skeleton Loader Styles */
.skeleton-card {
  display: flex;
  padding: 0.75rem;
  gap: 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgb(38 38 42); /* neutral-800 */
  background-color: rgb(10 10 10); /* neutral-950 */
  box-shadow: 0 1px 0 0 rgba(255,255,255,0.04) inset, 0 1px 2px rgba(0,0,0,0.2); /* shadow-soft */
  position: relative;
  overflow: hidden;
  height: 120px; /* Fixed height to match existing cards */
}

.skeleton-card .skeleton-image {
  flex-shrink: 0;
  width: 8rem; /* w-32 */
  height: 6rem; /* h-24 */
  border-radius: 0.375rem; /* rounded-md */
  background-color: rgb(39 39 42); /* neutral-900 */
}

.skeleton-card .skeleton-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-self: stretch;
}

.skeleton-card .skeleton-line {
  height: 0.75rem; /* Roughly text height */
  background-color: rgb(39 39 42); /* neutral-900 */
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
}
.skeleton-card .skeleton-line:last-child {
  margin-bottom: 0;
}

.skeleton-card .skeleton-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto; /* Push to bottom */
}

.skeleton-card .skeleton-buttons {
  display: flex;
  gap: 0.5rem;
}

.skeleton-card .skeleton-button {
  width: 2rem; /* w-8 */
  height: 2rem; /* h-8 */
  border-radius: 0.375rem; /* rounded-md */
  background-color: rgb(39 39 42); /* neutral-900 */
}

/* Shimmer effect */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton-card *,
.skeleton-card .skeleton-image,
.skeleton-card .skeleton-button {
  background: linear-gradient(90deg, rgb(39 39 42) 8%, rgb(63 63 70) 18%, rgb(39 39 42) 33%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

/* Fix for mobile cart and rentals buttons */
@media (max-width: 767px) {
  #open-cart, #open-rentals {
    padding: 0.375rem 0.75rem; /* py-1.5 px-3 */
    gap: 0.25rem; /* gap-1 */
  }
  #open-cart #cart-count,
  button#open-rentals > span {
    font-size: 0.75rem; /* text-xs */
    line-height: 1; /* Ensure text takes minimal height */
    white-space: nowrap; /* Prevent text from wrapping */
  }
  #open-cart .fa-solid,
  #open-rentals .fa-solid {
    font-size: 0.875rem; /* text-sm */
  }
}

/* Ensure filter popovers don't overflow on small screens */
@media (max-width: 767px) {
  .filter-popover {
    left: 0;
    right: auto;
    width: calc(100vw - 2rem); /* Give a small page padding */
    transform-origin: top left;
    margin-left: 1rem; /* keeps a small gap from the edge */
  }
}

/* Image Zoom Dialog Styles */
/* These styles control the dialog and its backdrop */
#image-zoom-dialog::backdrop {
  background: rgba(10,10,10,0.9);
  backdrop-filter: blur(8px);
  opacity: 0; /* Start hidden for fade-in effect */
  transition: opacity 0.3s ease-out;
}

#image-zoom-dialog[open] {
  height: 95vh; /* Apply height only when dialog is open and in the top layer */
}

#image-zoom-dialog.image-zoom-dialog-closing::backdrop {
  opacity: 0;
}

/* These styles control the image inside the dialog */
/* The initial state is set on the img tag directly in index.html (scale-0, opacity-0) */
#image-zoom-dialog img.visible {
  transform: scale(1);
  opacity: 1;
}

/* Animation for the image to scale out and fade when closing */
#image-zoom-dialog.image-zoom-dialog-closing img {
  transform: scale(0.8);
  opacity: 0;
}

/* Filter Button Styles */ 
.filter-button { 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  border-radius: 0.375rem; /* rounded-md */ 
  font-size: 0.875rem; /* text-sm */ 
  font-weight: 500; /* font-medium */ 
  border: 1px solid rgb(39 39 42); /* border-neutral-800 */ 
  background-color: transparent; 
  color: rgb(228 228 231); /* text-neutral-200 */ 
  height: 2.75rem; /* h-11 */ 
  padding: 0 1rem; /* px-4 */ 
  gap: 0.5rem; /* gap-2 */ 
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; 
  white-space: nowrap; 
} 
.filter-button:hover { 
  background-color: rgb(39 39 42); /* hover:bg-neutral-900 */ 
} 
.filter-button:focus-visible { 
  outline: 2px solid transparent; 
  outline-offset: 2px; 
  box-shadow: 0 0 0 2px rgb(23 23 23), 0 0 0 4px rgb(113 113 122); /* focus:ring-2 focus:ring-neutral-700 */ 
} 
.filter-badge { 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  font-size: 0.75rem; /* text-xs */ 
  font-weight: 600; /* font-semibold */ 
  padding: 0 0.375rem; /* px-1.5 */ 
  height: 1.125rem; /* h-4.5 */ 
  border-radius: 9999px; /* rounded-full */ 
  background-color: rgb(163 163 170); /* bg-neutral-400 */ 
  color: rgb(23 23 23); /* text-neutral-900 */ 
} 
.filter-button .filter-badge { 
  margin-left: 0.5rem; 
} 
/* Filter Popover Styles */ 
.filter-popover { 
  position: absolute; 
  top: calc(100% + 0.5rem); /* Position below trigger with a gap */ 
  right: 0; 
  z-index: 50; 
  width: 12rem; /* w-48 */ 
  border-radius: 0.5rem; /* rounded-lg */ 
  border: 1px solid rgb(39 39 42); /* border-neutral-800 */ 
  background-color: rgb(10 10 10); /* bg-neutral-950 */ 
  box-shadow: 0 10px 30px rgba(0,0,0,.5); 
  opacity: 0; 
  transform: scale(0.95) translateY(-5px); 
  transform-origin: top right; 
  pointer-events: none; 
  transition: opacity 0.2s ease, transform 0.2s ease; 
} 
.filter-popover.popover-open { 
  opacity: 1; 
  transform: scale(1) translateY(0); 
  pointer-events: auto; 
} 
.filter-popover-item { 
  position: relative; 
  display: flex; 
  cursor: pointer; 
  user-select: none; 
  align-items: center; 
  border-radius: 0.25rem; /* rounded-sm */ 
  padding: 0.375rem 0.5rem; /* py-1.5 px-2 */ 
  font-size: 0.875rem; /* text-sm */ 
  outline: none; 
  width: 100%; 
  text-align: left; 
  transition: background-color 0.1s ease; 
  color: rgb(212 212 216); /* text-neutral-300 */ 
} 
.filter-popover-item:hover, .filter-popover-item:focus { 
  background-color: rgb(39 39 42); /* bg-neutral-900 */ 
  color: #fff; 
} 
.filter-popover-item[data-state='selected'] { 
  background-color: rgb(63 63 70); /* bg-neutral-700 */ 
  color: #fff; 
}

.cart-field-label { font-size: 0.75rem; color: rgb(163 163 172); margin-bottom: 0.25rem; display: block; }
.cart-field-help { font-size: 0.75rem; color: rgb(115 115 115); }
