/* ========================================
   AI CHATBOT STYLES
   ======================================== */

/* ========================================
   BASE CONTAINER STYLES
   ======================================== */
.ai-chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ========================================
   FLOATING ICON STYLES
   ======================================== */
.ai-chatbot-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  color: white;
}

.ai-chatbot-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

/* ========================================
   CHAT INTERFACE STYLES
   ======================================== */
.ai-chatbot-interface {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 450px;
  height: 600px;
  max-height: calc(100vh - 100px); /* Ensure it doesn't exceed viewport height */
  min-height: 400px; /* Minimum height for usability */
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.ai-chatbot-interface.active {
  display: flex;
}

/* ========================================
   HEADER STYLES
   ======================================== */
.ai-chatbot-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-chatbot-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.ai-chatbot-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.ai-chatbot-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ========================================
   MESSAGES CONTAINER STYLES
   ======================================== */
.ai-chatbot-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background: #f8f9fa;
}

/* ========================================
   MESSAGE STYLES
   ======================================== */
.ai-message {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.ai-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.ai-message-content {
  background: white;
  padding: 12px 16px;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  line-height: 1.4;
  max-width: 80%;
}

/* ========================================
   USER MESSAGE STYLES
   ======================================== */
.user-message {
  flex-direction: row-reverse;
}

.user-message .ai-avatar {
  background: #e9ecef;
  color: #495057;
}

.user-message .ai-message-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

/* ========================================
   INPUT CONTAINER STYLES
   ======================================== */
.ai-chatbot-input-container {
  padding: 15px;
  background: white;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 10px;
}

.ai-chatbot-input {
  flex: 1;
  border: 1px solid #e9ecef;
  border-radius: 20px;
  padding: 10px 15px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.ai-chatbot-input:focus {
  border-color: #667eea;
}

.ai-chatbot-send {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.ai-chatbot-send:hover {
  transform: scale(1.1);
}

/* ========================================
   TYPING INDICATOR STYLES
   ======================================== */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 80%;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #667eea;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { 
  animation-delay: -0.32s; 
}

.typing-dot:nth-child(2) { 
  animation-delay: -0.16s; 
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
.ai-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 12px;
  border: none;
  border-radius: 6px;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-header-action-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.ai-header-action-btn svg {
  color: currentColor;
}

@media (max-width: 768px) {
  .ai-chatbot-interface {
    width: 380px;
    height: 500px;
    max-height: calc(100vh - 90px); /* Adjust for smaller bottom margin */
    min-height: 350px;
    bottom: 70px;
  }
  
  .ai-chatbot-icon {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 480px) {
  .ai-chatbot-interface {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    min-height: 100vh;
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    border-radius: 0;
    position: fixed;
  }
  
  .ai-chatbot-icon {
    width: 45px;
    height: 45px;
  }
  
  .ai-chatbot-container {
    bottom: 15px;
    right: 15px;
  }
  
  /* Mobile-specific adjustments */
  .ai-chatbot-messages {
    padding: 20px 15px;
    padding-bottom: 120px; /* Increased space for input area (70px + 50px extra) */
  }
  
  .ai-chatbot-input-container {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 15px;
    background: white !important;
    border-top: 1px solid #e9ecef !important;
    z-index: 9999 !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
    /* Ensure it stays above keyboard */
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    /* Force hardware acceleration */
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  
  .ai-chatbot-header {
    padding: 20px 15px;
    position: sticky;
    top: 0;
    z-index: 1000;
  }
  
  /* Mobile swipe indicator */
  .ai-chatbot-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 2px;
  }
  
  /* Mobile touch improvements */
  .ai-chatbot-input {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px 16px;
    border-radius: 25px;
    border: 2px solid #e9ecef;
  }
  
  .ai-chatbot-send {
    width: 44px;
    height: 44px;
    min-width: 44px; /* Minimum touch target size */
    min-height: 44px;
  }
  
  .ai-product-btn {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .ai-suggestion-btn {
    min-height: 44px;
    padding: 12px 20px;
    font-size: 14px;
  }
  
  .ai-action-btn {
    min-height: 44px;
    padding: 12px 20px;
    font-size: 14px;
  }
  
  /* Mobile scroll improvements */
  .ai-chatbot-messages {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* Mobile modal improvements */
  .ai-modal-overlay {
    padding: 10px;
  }
  
  .ai-modal-content {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 12px 12px 0 0;
    max-height: 90vh;
  }
  
  /* Keyboard visible state */
  .ai-chatbot-interface.keyboard-visible {
    height: 100vh !important;
    max-height: 100vh !important;
  }
  
  .ai-chatbot-interface.keyboard-visible .ai-chatbot-input-container {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    background: white !important;
    border-top: 1px solid #e9ecef !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
  }
  
  .ai-chatbot-interface.keyboard-visible .ai-chatbot-messages {
    padding-bottom: 120px !important;
  }
  
  /* Force input container to be fixed on all mobile devices */
  @media (max-width: 768px) {
    .ai-chatbot-interface .ai-chatbot-input-container {
      position: fixed !important;
      bottom: 70px !important;
      left: 0 !important;
      right: 0 !important;
      z-index: 9999 !important;
      background: white !important;
      border-top: 1px solid #e9ecef !important;
      box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
      transform: translateZ(0) !important;
      -webkit-transform: translateZ(0) !important;
    }
  }
}

/* ========================================
   VERY SMALL MOBILE DEVICES
   ======================================== */
@media (max-width: 360px) {
  .ai-chatbot-interface {
    width: 100vw;
    height: 100vh;
  }
  
  .ai-chatbot-header {
    padding: 15px 12px;
  }
  
  .ai-chatbot-messages {
    padding: 15px 12px;
    padding-bottom: 120px; /* Increased space for input area */
  }
  
  .ai-chatbot-input-container {
    padding: 12px;
  }
  
  .ai-chatbot-input {
    font-size: 16px;
    padding: 10px 14px;
  }
  
  .ai-chatbot-send {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }
  
  .ai-product-btn {
    min-height: 40px;
    padding: 10px 14px;
    font-size: 13px;
  }
  
  .ai-suggestion-btn {
    min-height: 40px;
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .ai-action-btn {
    min-height: 40px;
    padding: 10px 16px;
    font-size: 13px;
  }
}

/* ========================================
   VERY SMALL SCREEN HEIGHT HANDLING
   ======================================== */
@media (max-height: 600px) {
  .ai-chatbot-interface {
    max-height: calc(100vh - 60px);
    min-height: 250px;
    bottom: 50px;
  }
}

@media (max-height: 500px) {
  .ai-chatbot-interface {
    max-height: calc(100vh - 40px);
    min-height: 200px;
    bottom: 30px;
  }
  
  .ai-chatbot-icon {
    width: 40px;
    height: 40px;
  }
}

@media (max-height: 400px) {
  .ai-chatbot-interface {
    max-height: calc(100vh - 20px);
    min-height: 150px;
    bottom: 10px;
    right: 10px;
  }
  
  .ai-chatbot-icon {
    width: 35px;
    height: 35px;
  }
  
  .ai-chatbot-container {
    bottom: 10px;
    right: 10px;
  }
}

/* ========================================
   AI RESPONSE STYLES
   ======================================== */
.ai-response-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Order Tracking Card */
.ai-order-card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.ai-order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.ai-order-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-order-label {
  font-size: 12px;
  color: #6c757d;
}

.ai-order-number {
  font-weight: 700;
  color: #333;
}

.ai-order-badges {
  display: flex;
  gap: 6px;
}

.ai-badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f3f5;
  color: #495057;
}

.ai-badge-status {
  background: #e9f7ef;
  color: #218838;
}

.ai-badge-fulfillment {
  background: #e7f1ff;
  color: #0b5ed7;
}

.ai-order-progress {
  margin: 10px 0 14px;
}

.ai-progress-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.ai-progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dee2e6;
  margin-bottom: 6px;
}

.ai-progress-step.completed .ai-progress-dot {
  background: #667eea;
}

.ai-progress-label {
  font-size: 11px;
  color: #6c757d;
}

.ai-order-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.ai-order-status-msg {
  margin-top: 6px;
  font-size: 12px;
  color: #495057;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 8px;
}

.ai-order-address {
  margin-top: 8px;
}

.ai-section-title {
  font-size: 12px;
  color: #6c757d;
  margin-bottom: 6px;
}

.ai-address-text {
  font-size: 13px;
  color: #333;
}

.ai-order-items {
  margin-top: 8px;
}

.ai-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.ai-item-name { color: #333; }
.ai-item-qty { color: #667eea; font-weight: 600; }

.ai-response-text {
  font-size: 14px;
  line-height: 1.5;
  color: #333;
}

/* ========================================
   PRODUCT CARDS STYLES
   ======================================== */
.ai-products-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.ai-product-card {
  background: white;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e9ecef;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
  transition: all 0.3s ease;
  cursor: default;
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
}

.ai-product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: #667eea;
}

.ai-product-image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ai-product-image:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}


.ai-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.2s ease;
}

.ai-product-image:hover img {
  transform: scale(1.1);
}

.ai-product-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  background: #f8f9fa;
  transition: all 0.2s ease;
}

.ai-product-placeholder:hover {
  color: #667eea;
  background: #f0f2ff;
}

.ai-product-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-product-top-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.ai-product-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.ai-product-title:hover {
  color: #667eea;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ai-product-price {
  font-size: 16px;
  font-weight: 700;
  color: #667eea;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.ai-product-price:hover {
  color: #5a67d8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ai-product-reason {
  font-size: 12px;
  color: #6c757d;
  font-style: italic;
  background: #f8f9fa;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
  max-width: fit-content;
}

.ai-product-buttons {
  display: flex;
  flex-direction: row;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.ai-product-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-product-btn-checkout {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  font-size: 10px;
  padding: 6px 8px;
  min-width: 80px;
}

.ai-product-btn-checkout:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.ai-product-btn-cart {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 10px;
  padding: 6px 8px;
  min-width: 80px;
}

.ai-product-btn-cart:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ai-product-btn-cart:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ai-product-btn-cart:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* ========================================
   SUGGESTIONS STYLES
   ======================================== */
.ai-suggestions-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ai-suggestion-btn {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 12px;
  color: #495057;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ai-suggestion-btn:hover {
  background: #e9ecef;
  border-color: #dee2e6;
  transform: translateY(-1px);
}

/* ========================================
   ACTIONS STYLES
   ======================================== */
.ai-actions-container {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.ai-action-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ai-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ========================================
   RESPONSIVE PRODUCT STYLES
   ======================================== */
@media (max-width: 768px) {
  .ai-product-card {
    align-items: center;
    text-align: center;
    padding: 12px;
  }
  
  .ai-product-top-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 12px;
  }
  
  .ai-product-image {
    width: 80px;
    height: 80px;
    margin-bottom: 8px;
  }
  
  .ai-product-buttons {
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
  }
  
  .ai-product-btn {
    width: 100%;
    padding: 10px 16px;
    font-size: 13px;
    min-height: 44px;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    min-width: auto;
  }
  
  .ai-product-btn-checkout,
  .ai-product-btn-cart {
    font-size: 13px;
    padding: 10px 16px;
    min-width: auto;
  }
  
  .ai-suggestions-container {
    justify-content: center;
  }
  
  .ai-actions-container {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .ai-product-card {
    padding: 10px;
    margin: 8px 0;
  }
  
  .ai-product-image {
    width: 70px;
    height: 70px;
  }
  
  .ai-product-title {
    font-size: 13px;
    line-height: 1.3;
    margin-bottom: 4px;
  }
  
  .ai-product-price {
    font-size: 14px;
    margin-bottom: 8px;
  }
  
  .ai-product-buttons {
    gap: 6px;
    margin-top: 10px;
  }
  
  .ai-product-btn {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 40px;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    min-width: auto;
  }
  
  .ai-product-btn-checkout,
  .ai-product-btn-cart {
    font-size: 12px;
    padding: 8px 12px;
    min-width: auto;
  }
  
  .ai-product-reason {
    font-size: 11px;
    padding: 3px 6px;
    margin-bottom: 6px;
  }
}

@media (max-width: 360px) {
  .ai-product-card {
    padding: 8px;
  }
  
  .ai-product-image {
    width: 60px;
    height: 60px;
  }
  
  .ai-product-title {
    font-size: 12px;
  }
  
  .ai-product-price {
    font-size: 13px;
  }
  
  .ai-product-btn {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 36px;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    min-width: auto;
  }
  
  .ai-product-btn-checkout,
  .ai-product-btn-cart {
    font-size: 11px;
    padding: 6px 10px;
    min-width: auto;
  }
}

/* ========================================
   FIX: PREVENT HORIZONTAL OVERFLOW IN SUGGESTIONS
   ======================================== */
.ai-chatbot-interface,
.ai-chatbot-messages,
.ai-message-content {
  overflow-x: hidden;
}

.ai-suggestions-container {
  max-width: 100%;
  overflow-x: hidden;
}

.ai-suggestion-btn {
  /* Allow long text to wrap instead of forcing horizontal scroll */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  display: inline-block;
}

/* ========================================
   VARIANT SELECTION MODAL STYLES
   ======================================== */
.ai-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.ai-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.ai-modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.ai-modal-overlay.active .ai-modal-content {
  transform: scale(1);
}

.ai-modal-header {
  padding: 20px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px 12px 0 0;
}

.ai-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.ai-modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ai-modal-body {
  padding: 20px;
}

.ai-modal-product-image {
  text-align: center;
  margin-bottom: 20px;
}

.ai-modal-product-image img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ai-modal-variants {
  margin-bottom: 20px;
}

.ai-modal-option-group {
  margin-bottom: 15px;
}

.ai-modal-option-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.ai-modal-option-select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.ai-modal-option-select:focus {
  outline: none;
  border-color: #667eea;
}

.ai-modal-quantity {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-modal-quantity-label {
  font-weight: 600;
  color: #333;
  font-size: 14px;
  min-width: 80px;
}

.ai-modal-quantity-input {
  width: 80px;
  padding: 10px 12px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  transition: border-color 0.2s ease;
}

.ai-modal-quantity-input:focus {
  outline: none;
  border-color: #667eea;
}

.ai-modal-price {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px solid #e9ecef;
}

.ai-modal-price .compare-price {
  color: #6c757d;
  text-decoration: line-through;
  font-size: 14px;
  margin-left: 8px;
}

.ai-modal-footer {
  padding: 20px;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.ai-modal-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ai-modal-btn-cancel {
  background: #e9ecef;
  color: #495057;
}

.ai-modal-btn-cancel:hover {
  background: #dee2e6;
  transform: translateY(-1px);
}

.ai-modal-btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.ai-modal-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ai-modal-btn-primary:disabled {
  background: #e9ecef;
  color: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.7;
}

.ai-modal-btn-primary:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* ========================================
   REGISTRATION FORM STYLES
   ======================================== */
.registration-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-weight: 600;
  color: #333;
  font-size: 14px;
  margin-bottom: 4px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input:invalid {
  border-color: #dc3545;
}

.form-input:valid {
  border-color: #28a745;
}

.checkbox-group {
  margin-top: 10px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  color: #495057;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid #e9ecef;
  border-radius: 4px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-top: 2px;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
  background: #667eea;
  border-color: #667eea;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.terms-link,
.privacy-link {
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
}

.terms-link:hover,
.privacy-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ========================================
   MODAL RESPONSIVE STYLES
   ======================================== */
@media (max-width: 768px) {
  .ai-modal-content {
    width: 95%;
    max-height: 85vh;
  }
  
  .ai-modal-header {
    padding: 15px;
  }
  
  .ai-modal-header h3 {
    font-size: 16px;
  }
  
  .ai-modal-body {
    padding: 15px;
  }
  
  .ai-modal-product-image img {
    max-width: 150px;
    max-height: 150px;
  }
  
  .ai-modal-footer {
    padding: 15px;
    flex-direction: column;
  }
  
  .ai-modal-btn {
    width: 100%;
  }
  
  .registration-form {
    gap: 16px;
  }
  
  .form-input {
    padding: 10px 14px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  .checkbox-label {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .ai-modal-content {
    width: 98%;
    margin: 10px;
  }
  
  .ai-modal-header {
    padding: 12px;
  }
  
  .ai-modal-body {
    padding: 12px;
  }
  
  .ai-modal-product-image img {
    max-width: 120px;
    max-height: 120px;
  }
  
  .ai-modal-quantity {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .ai-modal-quantity-label {
    min-width: auto;
  }
  
  .registration-form {
    gap: 14px;
  }
  
  .form-group {
    gap: 6px;
  }
  
  .form-label {
    font-size: 13px;
  }
  
  .form-input {
    padding: 10px 12px;
    font-size: 16px;
  }
  
  .checkbox-label {
    font-size: 12px;
    gap: 10px;
  }
  
  .checkmark {
    width: 18px;
    height: 18px;
  }
}