/* —— Enhanced Reset & Cross-Browser Compatibility —— */
* {
  margin: 0; 
  padding: 0;
  box-sizing: border-box;
}

/* Cross-browser compatibility fixes */
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Ensure proper viewport handling */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Enable text selection for inputs and content areas */
input, textarea, [contenteditable] {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

body {
  position: relative;
  display: flex; 
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  background: url('bg.png') no-repeat center center fixed;
  background-size: cover;
  background-attachment: scroll; /* Fallback for mobile */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  color: #fff;
  overflow-x: hidden;
  /* Cross-browser flexbox support */
  display: -webkit-flex;
  display: -ms-flexbox;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  -webkit-align-items: center;
  -ms-flex-align: center;
  /* Allow text selection globally for better UX */
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

body::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  pointer-events: none;
  z-index: 0;
}

/* —— Title —— */
h1 {
  margin: 2rem 0;
  position: relative;
  z-index: 10;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 300;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
  color: #fff;
  letter-spacing: 3px;
  text-align: center;
  max-width: 90vw;
}

/* —— Carousel container —— */
.carousel-container {
  position: relative;
  width: 100%;
  max-width: 100vw;
  align-self: stretch;
  height: 85vh; 
  max-height: 800px;
  perspective: 1400px;
  -webkit-perspective: 1400px;
  z-index: 1;
  margin-bottom: 2rem;
  overflow: visible;
  /* Cross-browser flexbox support */
  -webkit-align-self: stretch;
  -ms-flex-item-align: stretch;
}

/* —— 3D carousel —— */
.carousel {
  width: 100%; 
  height: 100%;
  position: absolute;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
}

/* —— Items —— */
.carousel-item {
  position: absolute;
  top: 50%; 
  left: 50%;
  width: clamp(280px, 30vw, 380px);
  height: clamp(360px, 40vw, 480px);
  margin: calc(-1 * clamp(180px, 20vw, 240px)) 0 0 calc(-1 * clamp(140px, 15vw, 190px));
  display: flex; 
  flex-direction: column;
  align-items: center; 
  justify-content: center;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  -moz-transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
  -webkit-will-change: transform, opacity;
  text-align: center;
  background: transparent;
  border-radius: 0;
  border: none;
  box-shadow: none;
  /* Cross-browser flexbox support */
  display: -webkit-flex;
  display: -ms-flexbox;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  -webkit-align-items: center;
  -ms-flex-align: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
}

.carousel-item img {
  width: clamp(140%, 15vw, 180%); 
  height: auto;
  max-height: clamp(280px, 30vw, 400px);
  object-fit: contain;
  filter: brightness(0.7);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0;
}

.carousel-item.active {
  z-index: 2;
  background: transparent;
  border: none;
  box-shadow: none;
  transform: scale(1.1);
}

.carousel-item:not(.active) {
  z-index: 1;
  opacity: 0.6;
}

.carousel-item.active img {
  transform: scale(1.2);
  filter: brightness(1.2);
}

.carousel-item:not(.active) img {
  filter: brightness(0.5);
}

/* —— Text Container for Better Readability —— */
.carousel-item-text {
  position: absolute;
  bottom: -70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  min-width: 200px;
  text-align: center;
  z-index: 10;
  /* Ensure text is always visible */
  white-space: nowrap;
  overflow: visible;
}

.carousel-item h3 {
  margin: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: #ffffff;
  font-weight: 600;
  text-shadow: none;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.carousel-item .smaller-heading {
  font-size: clamp(1rem, 2vw, 1.3rem);
  margin-top: 0.5rem;
  color: #ff6b35;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: none;
}

/* —— Navigation buttons —— */
.controls {
  margin-top: calc(60vh + 1rem);
  display: flex; gap: 1rem;
  z-index: 1;
  justify-content: center;
}

.controls button {
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  color: #2c3e50;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  font-size: clamp(0.9rem, 2vw, 1rem);
}
.controls button:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* —— Enhanced Microphone button with animations —— */
.mic-button {
  position: fixed;
  bottom: clamp(20px, 5vh, 40px);
  right: clamp(20px, 5vw, 40px);
  width: clamp(90px, 13.5vw, 108px);
  height: clamp(90px, 13.5vw, 108px);
  border-radius: 50%;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  border: 3px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex; 
  align-items: center; 
  justify-content: center;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  -moz-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  padding: 0; 
  overflow: hidden;
  /* Reduce visual noise: remove constant float animation */
  animation: none;
  -webkit-animation: none;
  /* Cross-browser flexbox support */
  display: -webkit-flex;
  display: -ms-flexbox;
  -webkit-align-items: center;
  -ms-flex-align: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  /* Touch target size for mobile */
  min-width: 44px;
  min-height: 44px;
}

@keyframes micFloat {
  0%, 100% { 
    transform: translateY(0px);
    -webkit-transform: translateY(0px);
    -moz-transform: translateY(0px);
    -ms-transform: translateY(0px);
  }
  50% { 
    transform: translateY(-8px);
    -webkit-transform: translateY(-8px);
    -moz-transform: translateY(-8px);
    -ms-transform: translateY(-8px);
  }
}

@-webkit-keyframes micFloat {
  0%, 100% { -webkit-transform: translateY(0px); }
  50% { -webkit-transform: translateY(-8px); }
}

@keyframes micWave {
  0% {
    transform: scale(1);
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    -ms-transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    -webkit-transform: scale(1.2);
    -moz-transform: scale(1.2);
    -ms-transform: scale(1.2);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.4);
    -webkit-transform: scale(1.4);
    -moz-transform: scale(1.4);
    -ms-transform: scale(1.4);
    opacity: 0;
  }
}

@-webkit-keyframes micWave {
  0% {
    -webkit-transform: scale(1);
    opacity: 1;
  }
  50% {
    -webkit-transform: scale(1.2);
    opacity: 0.7;
  }
  100% {
    -webkit-transform: scale(1.4);
    opacity: 0;
  }
}

.mic-button:hover {
  transform: scale(1.1) translateY(-8px);
  background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  animation: none;
}

.mic-button:active {
  transform: scale(0.95);
  transition: all 0.1s ease;
}

.mic-icon {
  width: clamp(30px, 4.5vw, 42px);
  height: clamp(30px, 4.5vw, 42px);
  fill: white; display: block;
  transition: all 0.3s ease;
}

.mic-button.active {
  animation: micPulse 1.5s infinite;
  background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
  transform: scale(1.05);
}

.mic-button.active::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border: 2px solid rgba(231, 76, 60, 0.6);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: micWave 2s infinite;
  pointer-events: none;
}

.mic-button.active::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border: 2px solid rgba(231, 76, 60, 0.4);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: micWave 2s infinite 0.5s;
  pointer-events: none;
}

@keyframes micPulse {
  0% { 
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(231, 76, 60, 0.7);
  }
  50% { 
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 0 10px rgba(231, 76, 60, 0);
  }
  100% { 
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(231, 76, 60, 0);
  }
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Large tablets and small desktops */
@media (max-width: 1024px) {
  .carousel-container {
    height: 80vh;
    perspective: 1200px;
    -webkit-perspective: 1200px;
  }
  
  .carousel-item {
    width: clamp(260px, 28vw, 340px);
    height: clamp(340px, 38vw, 440px);
  }
  
  .carousel-item img {
    max-height: clamp(260px, 28vw, 360px);
  }
  
  h1 {
    font-size: clamp(2rem, 5.5vw, 3rem);
    margin: 1.5rem 0;
  }
}

/* Tablets */
@media (max-width: 768px) {
  .carousel-container {
    height: 75vh;
    perspective: 1000px;
    -webkit-perspective: 1000px;
  }
  
  .carousel-item {
    width: clamp(240px, 35vw, 300px);
    height: clamp(320px, 45vw, 400px);
  }
  
  .carousel-item img {
    max-height: clamp(240px, 35vw, 320px);
  }
  
  h1 {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    margin: 1.2rem 0;
    letter-spacing: 2px;
  }
  
  .carousel-item-text {
    bottom: -50px;
    padding: 0.75rem 1rem;
    min-width: 150px;
    white-space: nowrap;
    overflow: visible;
  }
  
  .mic-button {
    bottom: clamp(15px, 4vh, 30px);
    right: clamp(15px, 4vw, 30px);
  }
}

/* Large phones and small tablets */
@media (max-width: 600px) {
  .carousel-container {
    height: 70vh;
    perspective: 800px;
    -webkit-perspective: 800px;
  }
  
  .carousel-item {
    width: clamp(220px, 80vw, 280px);
    height: clamp(280px, 90vw, 360px);
  }
  
  .carousel-item img {
    max-height: clamp(200px, 60vw, 280px);
  }
  
  .carousel-item-text {
    bottom: -40px;
    padding: 0.5rem 0.75rem;
    min-width: 120px;
    white-space: nowrap;
    overflow: visible;
  }
  
  .carousel-item h3 {
    font-size: clamp(1rem, 4vw, 1.3rem);
  }
  
  .carousel-item .smaller-heading {
    font-size: clamp(0.9rem, 3.5vw, 1.2rem);
  }
  
  h1 {
    font-size: clamp(1.5rem, 7vw, 2rem);
    margin: 1rem 0;
    letter-spacing: 1px;
  }
  
  .mic-button { bottom: clamp(12px, 3vh, 25px); right: clamp(12px, 3vw, 25px); }
  
  /* Improve touch targets */
  .controls button {
    min-width: 44px;
    min-height: 44px;
    padding: 12px 16px;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .carousel-container {
    height: 65vh;
    perspective: 600px;
    -webkit-perspective: 600px;
  }
  
  .carousel-item {
    width: clamp(200px, 85vw, 260px);
    height: clamp(260px, 95vw, 340px);
  }
  
  .carousel-item img {
    max-height: clamp(180px, 65vw, 260px);
  }
  
  .carousel-item-text {
    bottom: -30px;
    padding: 0.5rem;
    min-width: 100px;
    white-space: nowrap;
    overflow: visible;
  }
  
  .carousel-item h3 {
    font-size: clamp(0.9rem, 4.5vw, 1.2rem);
  }
  
  .carousel-item .smaller-heading {
    font-size: clamp(0.8rem, 4vw, 1.1rem);
  }
  
  h1 {
    font-size: clamp(1.2rem, 8vw, 1.8rem);
    margin: 0.8rem 0;
    letter-spacing: 0.5px;
  }
  
  .mic-button { bottom: clamp(10px, 2.5vh, 20px); right: clamp(10px, 2.5vw, 20px); }
  .mic-button:not(.active)::after { width: 110%; height: 110%; }
  .mic-button.active::before { width: 120%; height: 120%; }
  
  /* Ensure proper touch targets */
  .controls button {
    min-width: 48px;
    min-height: 48px;
    padding: 14px 18px;
    font-size: 0.9rem;
  }
}

/* Extra small mobile phones */
@media (max-width: 360px) {
  .carousel-container {
    height: 60vh;
    perspective: 500px;
    -webkit-perspective: 500px;
  }
  
  .carousel-item {
    width: clamp(180px, 90vw, 240px);
    height: clamp(240px, 100vw, 320px);
  }
  
  .carousel-item img {
    max-height: clamp(160px, 70vw, 240px);
  }
  
  .carousel-item-text {
    bottom: -25px;
    padding: 0.4rem 0.6rem;
    min-width: 90px;
    white-space: nowrap;
    overflow: visible;
  }
  
  h1 {
    font-size: clamp(1rem, 9vw, 1.6rem);
    margin: 0.6rem 0;
  }
  
  .mic-button:not(.active)::after { width: 105%; height: 105%; }
  .mic-button.active::before { width: 115%; height: 115%; }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .carousel-container {
    height: 85vh;
    perspective: 700px;
    -webkit-perspective: 700px;
  }
  
  .carousel-item {
    width: clamp(200px, 25vw, 280px);
    height: clamp(260px, 35vw, 360px);
  }
  
  .carousel-item img {
    max-height: clamp(180px, 25vw, 260px);
  }
  
  h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin: 0.5rem 0;
  }
  
  .carousel-item-text {
    bottom: -30px;
    padding: 0.4rem 0.8rem;
  }
  
  .mic-button { bottom: clamp(8px, 2vh, 15px); right: clamp(8px, 2vw, 15px); }
}

/* White section styles */
.white-section {
position: relative;
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
background-image: none;
color: #2c3e50;
padding: 4rem 2rem;
width: 100%;
align-self: stretch;
/* Remove forced jump; managed by JS scrollIntoView when needed */
margin-top: 0;
z-index: 1;
min-height: 100vh;
}

.white-section .content {
max-width: 1200px;
margin: 0 auto;
text-align: center;
}

.white-section h2 {
font-size: 2.5rem;
margin-bottom: 1rem;
color: #2c3e50;
font-weight: 600;
letter-spacing: 1px;
}

.white-section p {
font-size: 1.2rem;
color: #6c757d;
line-height: 1.6;
}

/* Responsive adjustments */
@media (max-width: 480px) {
.white-section {
  padding: 2rem 1rem;
}

.white-section h2 {
  font-size: 1.8rem;
}
}
/* —— Checkout layout improvements —— */
#checkout .checkout-container {
  display: flex;
  flex-wrap: wrap;
  gap: 3rem;
  max-width: 1200px;
  margin: 0 auto;
}

.cart-summary,
.order-details {
  flex: 1 1 300px;
  background: #ffffff;
  padding: 2rem;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.cart-summary {
  border-right: none;
}

.order-details {
  border-left: none;
}

.cart-summary h2,
.order-details h2 {
  margin-bottom: 1.5rem;
  color: #1d1d1f;
  font-weight: 500;
  letter-spacing: -0.5px;
  font-size: 1.8rem;
}

#cart-count,
#cart-total,
#shipping-name,
#shipping-address,
#delivery-method {
  color: #1d1d1f;
}

#cart-items div {
  margin-bottom: 1rem;
}

.cart-summary .total {
  margin-top: 1.5rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  color: #1d1d1f;
  font-size: 1.3rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e5e7;
}

#checkout .btn.place-order-btn {
  display: inline-block;
  background: #007aff;
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.2px;
  transition: all 0.2s ease;
  box-shadow: none;
}

#checkout .btn.place-order-btn:hover {
  background: #0056cc;
  transform: none;
  box-shadow: none;
}

/* Button focus-visible for keyboard accessibility */
#checkout .btn.place-order-btn:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.6);
  outline-offset: 2px;
}

/* —— Ensure checkout text is dark on white bg —— */
#checkout {
  color: #2c3e50;
}

/* —— Cart summary item styling —— */
.cart-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  border-bottom: none;
  padding-bottom: 0;
}

.cart-item img {
  width: 60px;
  height: auto;
  object-fit: contain;
  margin-right: 1.5rem;
  border-radius: 0;
}

.cart-item-details {
  display: flex;
  flex-direction: column;
}

.cart-item-details h4 {
  margin: 0;
  font-size: 1.1rem;
  color: #1d1d1f;
  font-weight: 500;
}

.cart-item-details p {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  color: #86868b;
}

/* —— Order‑complete success screen —— */
#order-complete {
  color: #2c3e50;
  text-align: center;
}

.success-card {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  border: 2px solid #28a745;
  border-radius: 15px;
  padding: 3rem;
  max-width: 500px;
  margin: 4rem auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  box-shadow: 0 15px 35px rgba(40, 167, 69, 0.2);
}

.success-card h2 {
  margin: 0;
  font-size: 2rem;
  color: #155724;
  font-weight: 600;
  letter-spacing: 1px;
}

.success-card p {
  margin: 0;
  font-size: 1.1rem;
  color: #155724;
}

.check-icon {
  width: 80px;
  height: 80px;
  fill: #28a745;
}

/* Generic hidden helper (if not already present) */
.hidden {
  display: none !important;
}

/* ===== PERFORMANCE & BROWSER OPTIMIZATIONS ===== */

/* Hardware acceleration for animations */
.carousel-item,
.mic-button,
.cart-panel {
  -webkit-transform: translateZ(0);
  -moz-transform: translateZ(0);
  -ms-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Safari-specific fixes */
@supports (-webkit-appearance: none) {
  .carousel-item img {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}

/* Firefox-specific fixes */
@-moz-document url-prefix() {
  .carousel-container {
    transform-style: preserve-3d;
  }
  
  .carousel-item {
    transform-style: preserve-3d;
  }
}

/* Edge/IE specific fixes */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  .carousel-item {
    transform: none !important;
  }
  
  .mic-button {
    transform: none !important;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .carousel-item img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .mic-button {
    animation: none !important;
  }
  
  .carousel-item {
    transition: none !important;
  }
}

/* —— Prevent scrolling during agent switches —— */
body.agent-switching {
  overflow: hidden;
}

.agent-switching .carousel-container {
  pointer-events: none;
}

.agent-switching .mic-button {
  pointer-events: none;
}

/* Order details grid styling */

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  align-items: start;
  margin-top: 1.5rem;
}

.details-grid .map {
  grid-column: 1 / -1;
  /* Optional: ensure the iframe fills its container */
  width: 100%;
}

.order-details h3 {
  margin-bottom: 0.75rem;
  color: #e74c3c;
  font-size: 1.2rem;
  border-bottom: 2px solid #e74c3c;
  padding-bottom: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Fieldset and legend styling for semantic groups */
.order-details fieldset {
  border: 1px solid #e5e5e7;
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.order-details legend {
  padding: 0 0.25rem;
  font-weight: 600;
  color: #2c3e50;
}

.order-details p,
.order-details label,
.order-details input {
  font-size: 1rem;
  line-height: 1.5;
  margin: 0.5rem 0;
}

.order-details input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  background: #fff;
  color: #2c3e50;
  transition: all 0.3s ease;
}

.order-details input:focus {
  outline: none;
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}
/* Listening ring animation around mic button */
.mic-button.active::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140%;
  height: 140%;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(231, 76, 60, 0.7);
  border-radius: 50%;
  animation: ring-pulse 1.5s infinite ease-out;
  pointer-events: none;
}

/* Idle wave animation (before click) */
.mic-button:not(.active)::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120%;
  height: 120%;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(231, 76, 60, 0.45);
  border-radius: 50%;
  animation: ring-pulse 2.4s infinite ease-out;
  pointer-events: none;
}

@keyframes ring-pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.7;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}
/* Removed forced pinning to allow responsive offsets */

/* Status and activity indicators */
#status {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

#activity {
  position: fixed;
  bottom: 24px;
  left: 24px;
  transform: translateX(calc(-100% - 8px));
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #888;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

#activity.active {
  background: #2ecc71;
}

/* Live Cart Panel Styles */
.cart-panel {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  -webkit-transform: translateY(-50%);
  -moz-transform: translateY(-50%);
  -ms-transform: translateY(-50%);
  width: 320px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  transition: all 0.3s ease;
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  /* Remove internal scrolling; expanded mode will switch to static layout */
  border: 1px solid rgba(0, 0, 0, 0.06);
  /* Performance optimizations */
  will-change: transform, opacity;
  -webkit-will-change: transform, opacity;
}

/* Expanded layout: switch to document flow to show all items without internal scroll */
.cart-panel.expanded {
  position: static;
  right: auto;
  top: auto;
  transform: none;
  width: min(680px, 95vw);
  margin: 20px auto;
  z-index: auto;
}

.cart-panel.hidden {
  transform: translateY(-50%) translateX(100%);
  -webkit-transform: translateY(-50%) translateX(100%);
  -moz-transform: translateY(-50%) translateX(100%);
  -ms-transform: translateY(-50%) translateX(100%);
  opacity: 0;
  pointer-events: none;
}

/* Cart transition animation */
.cart-panel.transitioning-to-checkout {
  animation: cartToCheckout 0.3s ease-in-out forwards;
  -webkit-animation: cartToCheckout 0.3s ease-in-out forwards;
}

@keyframes cartToCheckout {
  0% {
    transform: translateY(-50%) scale(1);
    -webkit-transform: translateY(-50%) scale(1);
    -moz-transform: translateY(-50%) scale(1);
    -ms-transform: translateY(-50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateY(-50%) scale(0.8) translateX(50%);
    -webkit-transform: translateY(-50%) scale(0.8) translateX(50%);
    -moz-transform: translateY(-50%) scale(0.8) translateX(50%);
    -ms-transform: translateY(-50%) scale(0.8) translateX(50%);
    opacity: 0.7;
  }
  100% {
    transform: translateY(-50%) scale(0.6) translateX(100%);
    -webkit-transform: translateY(-50%) scale(0.6) translateX(100%);
    -moz-transform: translateY(-50%) scale(0.6) translateX(100%);
    -ms-transform: translateY(-50%) scale(0.6) translateX(100%);
    opacity: 0;
  }
}

@-webkit-keyframes cartToCheckout {
  0% {
    -webkit-transform: translateY(-50%) scale(1);
    opacity: 1;
  }
  50% {
    -webkit-transform: translateY(-50%) scale(0.8) translateX(50%);
    opacity: 0.7;
  }
  100% {
    -webkit-transform: translateY(-50%) scale(0.6) translateX(100%);
    opacity: 0;
  }
}

.cart-header {
  padding: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-header h3 {
  margin: 0;
  color: #333;
  font-size: 1.2rem;
  font-weight: 600;
}

.cart-items {
  padding: 0 20px;
}

/* When expanded, ensure all items are visible without inner scrolling */
.cart-panel.expanded .cart-items {
  max-height: none !important;
  overflow: visible !important;
}

.cart-items .cart-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.cart-items .cart-item:last-child {
  border-bottom: none;
}

.cart-items .cart-item img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
  margin-right: 12px;
}

.cart-items .cart-item-details h4 {
  margin: 0 0 4px 0;
  font-size: 0.9rem;
  color: #333;
  font-weight: 600;
}

.cart-items .cart-item-details p {
  margin: 0;
  font-size: 0.8rem;
  color: #666;
}

.cart-footer {
  padding: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.02);
  border-radius: 0 0 16px 16px;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
}

/* Cart panel responsive improvements */
@media (max-width: 1024px) {
  .cart-panel {
    width: 300px;
    right: 15px;
  }
}

@media (max-width: 768px) {
  .cart-panel {
    width: 280px;
    right: 10px;
  }
  
  .cart-header {
    padding: 15px;
  }
  
  .cart-items {
    padding: 0 15px;
    max-height: 250px;
  }
  
  .cart-footer {
    padding: 15px;
  }
}

@media (max-width: 600px) {
  .cart-panel {
    width: 260px;
    right: 8px;
  }
  
  .cart-header h3 {
    font-size: 1.1rem;
  }
  
  .cart-items .cart-item {
    padding: 10px 0;
  }
  
  .cart-items .cart-item img {
    width: 45px;
    height: 45px;
  }
  
  .cart-items .cart-item-details h4 {
    font-size: 0.85rem;
  }
  
  .cart-items .cart-item-details p {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .cart-panel {
    width: 240px;
    right: 5px;
  }
  
  .cart-header {
    padding: 12px;
  }
  
  .cart-header h3 {
    font-size: 1rem;
  }
  
  .cart-items {
    padding: 0 12px;
    max-height: 200px;
  }
  
  .cart-items .cart-item {
    padding: 8px 0;
  }
  
  .cart-items .cart-item img {
    width: 40px;
    height: 40px;
  }
  
  .cart-footer {
    padding: 12px;
  }
  
  .cart-total {
    font-size: 1rem;
  }
}

@media (max-width: 360px) {
  .cart-panel {
    width: 220px;
    right: 3px;
  }
  
  .cart-header h3 {
    font-size: 0.9rem;
  }
  
  .cart-items .cart-item img {
    width: 35px;
    height: 35px;
  }
  
  .cart-items .cart-item-details h4 {
    font-size: 0.8rem;
  }
  
  .cart-items .cart-item-details p {
    font-size: 0.7rem;
  }
}

/* Landscape orientation cart adjustments */
@media (max-height: 500px) and (orientation: landscape) {
  .cart-panel {
    max-height: 80vh;
    top: 60%;
  }
  
  .cart-items {
    max-height: 300px;
  }
}