/* Voice Assistant Call Button */
.voice-assistant-btn {
  display: flex !important;
  align-items: center;
  text-decoration: none;
  transition: all 0.3s ease;
}

/* Waleed call avatar specific styles */
.waleed-call-avatar {
  width: 55px !important;
  height: 55px !important;
  min-width: 55px !important;
  min-height: 55px !important;
}

.voice-assistant-btn .floating-btn-icon {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: visible;
  padding: 0;
}

.voice-assistant-btn:hover .floating-btn-icon {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* Waleed avatar in call button */
.waleed-call-avatar {
  position: relative;
  width: 50px;
  height: 50px;
}

.waleed-call-avatar canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.phone-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: #FFD700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  border: 2px solid white;
}

.phone-indicator i {
  font-size: 10px;
  color: #333;
}

/* Call Icon Animation */
.voice-assistant-btn .floating-btn-icon i {
  transition: transform 0.3s ease;
}

.voice-assistant-btn.calling .floating-btn-icon i {
  animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-15deg); }
  75% { transform: rotate(15deg); }
}

/* Ripple Effect for Active Call */
.voice-assistant-btn.active .floating-btn-icon::before,
.voice-assistant-btn.active .floating-btn-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.3);
}

.voice-assistant-btn.active .floating-btn-icon::before {
  animation: ripple 1.5s ease-out infinite;
}

.voice-assistant-btn.active .floating-btn-icon::after {
  animation: ripple 1.5s ease-out infinite 0.5s;
}

@keyframes ripple {
  0% {
    width: 100%;
    height: 100%;
    opacity: 0.3;
  }
  100% {
    width: 200%;
    height: 200%;
    opacity: 0;
  }
}

/* Voice Assistant Modal */
.voice-assistant-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.voice-assistant-modal.show {
  display: flex;
}

.voice-assistant-container {
  background: white;
  border-radius: 20px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  position: relative;
  animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Close Button */
.voice-assistant-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: #f0f0f0;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.voice-assistant-close:hover {
  background: #e0e0e0;
  transform: scale(1.1);
}

/* Waleed Avatar */
.waleed-avatar {
  width: 200px;
  height: 200px;
  margin: 0 auto 20px;
  position: relative;
}

.waleed-avatar canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.waleed-avatar.talking::after {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border: 3px solid #FF6B6B;
  border-radius: 50%;
  animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Call Status */
.call-status {
  margin-bottom: 30px;
}

.call-status h3 {
  font-size: 24px;
  color: #333;
  margin-bottom: 10px;
  font-weight: 600;
}

.call-status p {
  color: #666;
  font-size: 16px;
  margin: 0;
}

/* Voice Visualizer */
.voice-visualizer {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 20px 0;
}

.voice-bar {
  width: 4px;
  background: linear-gradient(to top, #FF6B6B, #FF8E53);
  border-radius: 2px;
  transition: height 0.2s ease;
}

.voice-bar:nth-child(1) { height: 20px; animation: wave 0.6s ease-in-out infinite; }
.voice-bar:nth-child(2) { height: 30px; animation: wave 0.6s ease-in-out infinite 0.1s; }
.voice-bar:nth-child(3) { height: 40px; animation: wave 0.6s ease-in-out infinite 0.2s; }
.voice-bar:nth-child(4) { height: 35px; animation: wave 0.6s ease-in-out infinite 0.3s; }
.voice-bar:nth-child(5) { height: 25px; animation: wave 0.6s ease-in-out infinite 0.4s; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}

/* Control Buttons */
.voice-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

.voice-control-btn {
  padding: 12px 30px;
  border: none;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.end-call-btn {
  background: #dc3545;
  color: white;
}

.end-call-btn:hover {
  background: #c82333;
  transform: scale(1.05);
}

.mute-btn {
  background: #6c757d;
  color: white;
}

.mute-btn:hover {
  background: #5a6268;
  transform: scale(1.05);
}

.mute-btn.muted {
  background: #ffc107;
  color: #333;
}

/* Cart Preview in Call */
.voice-cart-preview {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: #f8f9fa;
  border-radius: 15px;
  padding: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  max-width: 200px;
  display: none;
}

.voice-cart-preview.show {
  display: block;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.voice-cart-preview h4 {
  font-size: 14px;
  margin-bottom: 10px;
  color: #333;
}

.voice-cart-preview .cart-item {
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
}

.voice-cart-preview .cart-total {
  font-size: 14px;
  font-weight: 600;
  color: #FF6B6B;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #dee2e6;
}

/* RTL Support */
.rtl .voice-assistant-close {
  right: auto;
  left: 15px;
}

.rtl .voice-cart-preview {
  right: auto;
  left: 20px;
}

.rtl .voice-cart-preview {
  animation: slideInRTL 0.3s ease;
}

@keyframes slideInRTL {
  from {
    transform: translateX(-50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Force proper button positioning and spacing */
.floating-buttons .voice-assistant-btn {
  order: -1; /* Place voice assistant button at top */
  margin-bottom: 15px !important; /* Add space below voice button */
}

/* Desktop specific styles for floating buttons */
@media (min-width: 768px) {
  .floating-buttons {
    gap: 20px !important; /* Increase spacing between buttons */
    align-items: flex-start !important; /* Align buttons to start */
  }
  
  /* Ensure voice assistant button appears above WhatsApp with proper spacing */
  .floating-buttons .voice-assistant-btn {
    position: relative;
    z-index: 10002;
    margin-bottom: 20px !important; /* Ensure space below */
  }
  
  .floating-buttons .whatsapp-btn {
    position: relative;
    z-index: 10001;
  }
  
  /* Ensure proper stacking */
  .floating-buttons > * {
    flex-shrink: 0; /* Prevent buttons from shrinking */
  }
}

/* Mobile Responsive */
@media (max-width: 767.98px) {
  .voice-assistant-container {
    padding: 30px 20px;
    width: 95%;
  }

  .waleed-avatar {
    width: 100px;
    height: 100px;
  }

  .call-status h3 {
    font-size: 20px;
  }

  .call-status p {
    font-size: 14px;
  }

  .voice-control-btn {
    padding: 10px 25px;
    font-size: 14px;
  }

  .voice-cart-preview {
    display: none !important;
  }
}

/* Voice Products Display */
.voice-products-display {
  position: absolute;
  top: 20px;
  left: 20px;
  background: #f8f9fa;
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 350px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 10;
  animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.voice-products-display h4 {
  font-size: 16px;
  margin-bottom: 15px;
  color: #333;
  font-weight: 600;
  border-bottom: 2px solid #667eea;
  padding-bottom: 10px;
}

#voiceProductsList {
  display: grid;
  gap: 15px;
}

.voice-product-card {
  background: white;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.voice-product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.voice-product-card .product-image {
  width: 100%;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-product-card .product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.voice-product-card .product-image.placeholder {
  background: #f0f0f0;
  color: #ccc;
  font-size: 40px;
}

.voice-product-card h5 {
  font-size: 13px;
  margin-bottom: 6px;
  color: #333;
  font-weight: 600;
  line-height: 1.2;
  min-height: 32px;
}

.voice-product-card .price {
  font-size: 16px;
  color: #667eea;
  font-weight: bold;
  margin: 5px 0;
}

.voice-product-card .original-price {
  font-size: 13px;
  color: #999;
  text-decoration: line-through;
  margin: 0;
}

.voice-product-card .add-to-cart-btn {
  width: 100%;
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
}

.voice-product-card .add-to-cart-btn:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  transform: scale(1.02);
}

.voice-product-card .add-to-cart-btn:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.voice-product-card .add-to-cart-btn.success {
  background: #28a745;
  color: white;
  animation: successPulse 0.5s ease;
}

/* Product card animation when added to cart */
.voice-product-card.added-to-cart {
  animation: addedToCart 0.6s ease;
}

@keyframes successPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes addedToCart {
  0% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
}

/* Success toast notification */
.voice-success-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(40, 167, 69, 0.95);
  color: white;
  padding: 20px 40px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 100000;
  animation: toastIn 0.5s ease;
}

@keyframes toastIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* RTL Support for Products Display */
.rtl .voice-products-display {
  left: auto;
  right: 20px;
  animation: slideInRightRTL 0.3s ease;
}

@keyframes slideInRightRTL {
  from {
    transform: translateX(50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Mobile Responsive for Products */
@media (max-width: 767.98px) {
  .voice-products-display {
    left: 10px;
    right: 10px;
    max-width: calc(100% - 20px);
    top: 60px;
  }
  
  .rtl .voice-products-display {
    left: 10px;
    right: 10px;
  }
}