/* Virtual Try-On Button and Modal Styles */

.try-on-container {
  margin: 20px 0;
}

.try-on-button {
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.try-on-button:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Authentication Styles */
.auth-container {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  max-width: 400px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.auth-tabs {
  display: flex;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.auth-tab {
  flex: 1;
  padding: 16px 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: #6c757d;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
}

.auth-tab.active {
  background: white;
  color: #007bff;
  border-bottom-color: #007bff;
  font-weight: 600;
}

.auth-tab:hover:not(.active) {
  background: #e9ecef;
  color: #495057;
}

.auth-form-container {
  padding: 32px 24px 24px 24px;
}

.auth-form {
  display: none !important;
}

.auth-form.active {
  display: block !important;
  animation: fadeInUp 0.3s ease;
}

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

.auth-form h3 {
  margin: 0 0 24px 0;
  color: #212529;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #495057;
  font-size: 14px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 15px;
  transition: all 0.3s ease;
  box-sizing: border-box;
  background: #fff;
}

.form-group input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-group input:invalid {
  border-color: #dc3545;
}

.auth-btn {
  width: 100%;
  padding: 14px 16px;
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 8px;
}

.auth-btn:hover {
  background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
}

.auth-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
}

.auth-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  position: relative;
}

.auth-btn:disabled::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  margin: auto;
  border: 2px solid transparent;
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.error-message {
  background: #f8d7da;
  color: #721c24;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-top: 16px;
  border-left: 4px solid #dc3545;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.auth-footer {
  background: #f8f9fa;
  padding: 16px 24px;
  text-align: center;
  border-top: 1px solid #e9ecef;
}

.auth-footer p {
  margin: 0;
  color: #6c757d;
  font-size: 12px;
}

/* User Info Styles */
.user-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%);
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  border: 1px solid #bbdefb;
}

.user-info span {
  color: #1976d2;
  font-weight: 500;
}

.logout-btn {
  background: transparent;
  border: 1px solid #1976d2;
  color: #1976d2;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.logout-btn:hover {
  background: #1976d2;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

/* Modal styles */
.try-on-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7);
  transition: all 0.3s ease;
}

.modal-content {
  position: relative;
  background-color: #fff;
  margin: 5% auto;
  padding: 20px;
  width: 90%;
  max-width: 800px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: modalFadeIn 0.5s;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Try-on interface styles */
.try-on-interface {
  text-align: center;
  padding: 20px;
}

.try-on-interface h2 {
  margin-bottom: 20px;
  color: #333;
}

.try-on-options {
  margin-bottom: 20px;
}

.try-on-options button {
  background: #4a90e2;
  color: white;
  border: none;
  padding: 12px 24px;
  margin: 0 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.3s ease;
}

.try-on-options button:hover {
  background: #357abd;
}

.try-on-preview {
  margin: 20px 0;
}

.product-image {
  max-width: 200px;
  max-height: 300px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.image-options {
  margin-top: 20px;
}

.image-options h4 {
  margin-bottom: 10px;
  color: #333;
}

.image-thumbnails {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.thumbnail-p {
  width: 60px;
  max-width: 60px;
  max-height: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border 0.3s ease;
}

.thumbnail:hover {
  border-color: #4a90e2;
}

.thumbnail.selected {
  border-color: #4a90e2;
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.loading-spinner {
  padding: 40px;
  text-align: center;
  color: #666;
}

.error-message {
  padding: 20px;
  text-align: center;
  color: #d32f2f;
}

.close-button {
  position: absolute;
  top: 10px;
  right: 15px;
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
}

.close-button:hover {
  color: #333;
}

/* Try-on container styles */
#try-on-container {
  min-height: 400px;
  padding: 20px;
}

/* Loading spinner */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  font-size: 18px;
  color: #666;
  text-align: center;
}

.loading-spinner::after {
  content: "";
  display: block;
  width: 40px;
  height: 40px;
  margin-left: 10px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4a90e2;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Try-on interface */
.try-on-interface {
  padding: 10px;
}

.try-on-interface h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
}

.try-on-options {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.try-on-options p {
  margin: 0 15px;
  color: #666;
}

.upload-photo-btn,
.use-camera-btn {
  padding: 10px 20px;
  margin: 10px;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

.upload-photo-btn:hover,
.use-camera-btn:hover {
  background-color: #3a80d2;
}

.try-on-preview {
  text-align: center;
  margin-top: 20px;
}

.product-image {
  max-width: 100%;
  max-height: 300px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* Camera capture */
.camera-capture {
  text-align: center;
}

#camera-preview {
  width: 100%;
  max-width: 600px;
  margin-bottom: 20px;
  border-radius: 8px;
  border: 1px solid #ddd;
}

#capture-btn,
#cancel-camera-btn {
  padding: 10px 20px;
  margin: 0 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

#capture-btn {
  background-color: #4caf50;
  color: white;
}

#cancel-camera-btn {
  background-color: #f44336;
  color: white;
}

/* Error message */
.error-message {
  text-align: center;
  color: #f44336;
  padding: 20px;
}

.error-message button {
  padding: 8px 16px;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 15px;
}

/* Try-on result */
.try-on-result {
  text-align: center;
}

.try-on-result h2 {
  margin-bottom: 20px;
}

.result-image-container {
  margin: 20px 0;
}

.result-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.result-actions {
  margin-top: 20px;
}

#try-again-btn,
#add-to-cart-btn {
  padding: 10px 20px;
  margin: 0 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

#try-again-btn {
  background-color: #757575;
  color: white;
}

#add-to-cart-btn {
  background-color: #4caf50;
  color: white;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 15px;
  }

  #try-on-container {
    padding: 10px;
    min-height: 300px;
  }

  .try-on-options {
    flex-direction: column;
  }

  .try-on-options p {
    margin: 10px 0;
  }

  .result-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  #try-again-btn,
  #add-to-cart-btn {
    margin: 10px 0;
    width: 80%;
  }
}

.vton-widget-btn {
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.75em 1.5em;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: background 0.2s;
}
.vton-widget-btn:hover {
  background: #155ab6;
}

/* Authentication Styles */
.auth-container {
  font-family: Arial, sans-serif;
  max-width: 400px;
  margin: 0 auto;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.auth-tabs {
  display: flex;
  background: #f5f5f5;
}

.auth-tab {
  flex: 1;
  padding: 12px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  transition: all 0.3s ease;
}

.auth-tab.active {
  background: white;
  color: #1a73e8;
  border-bottom: 2px solid #1a73e8;
}

.auth-form-container {
  padding: 24px;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.auth-form h3 {
  margin: 0 0 20px 0;
  color: #333;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: #555;
  font-size: 14px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.auth-btn {
  width: 100%;
  padding: 12px;
  background: #1a73e8;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
  margin-top: 8px;
}

.auth-btn:hover {
  background: #155ab6;
}

.auth-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.error-message {
  background: #ffebee;
  color: #c62828;
  padding: 12px;
  border-radius: 4px;
  font-size: 14px;
  margin-top: 12px;
  border-left: 4px solid #c62828;
}

.auth-footer {
  background: #f9f9f9;
  padding: 16px 24px;
  text-align: center;
}

.auth-footer p {
  margin: 0;
  color: #666;
  font-size: 12px;
}

/* User Info Styles */
.user-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f0f7ff;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}

.user-info span {
  color: #1a73e8;
  font-weight: 500;
}

.logout-btn {
  background: transparent;
  border: 1px solid #1a73e8;
  color: #1a73e8;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.logout-btn:hover {
  background: #1a73e8;
  color: white;
}

.vton-modal-overlay {
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.vton-modal {
  background: #fff;
  border-radius: 10px;
  max-width: 400px;
  width: 95vw;
  padding: 2em 1.5em 1.5em 1.5em;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  position: relative;
  font-family: inherit;
}
.vton-modal-close {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  background: none;
  border: none;
  font-size: 2em;
  color: #888;
  cursor: pointer;
}
.vton-form {
  display: flex;
  flex-direction: column;
  gap: 1.2em;
}
.vton-label {
  font-weight: 500;
  margin-bottom: 0.5em;
}
.vton-options {
  margin-bottom: 1em;
}
.vton-thumbnails {
  display: flex;
  gap: 0.5em;
  margin-top: 0.5em;
}
.vton-thumbnails img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border 0.2s;
}
.vton-thumbnails img.selected {
  border: 2px solid #1a73e8;
}
.vton-submit {
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.7em 1.2em;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
  margin-top: 0.5em;
}
.vton-submit:disabled {
  background: #b3c6e6;
  cursor: not-allowed;
}
.vton-result {
  margin-top: 1.5em;
  text-align: center;
}
.vton-result img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 0.5em;
}

/* New Try-On Interface Styles */
.try-on-main-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2em;
  margin-top: 2em;
  margin-bottom: 2em;
}

.user-image-section,
.product-images-section,
.result-section {
  background: #f9f9f9;
  padding: 1.5em;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.user-image-section h3,
.product-images-section h3,
.result-section h3 {
  margin: 0 0 0 0;
  color: #333;
  font-size: 1.1em;
  font-weight: 600;
}

.image-container {
  text-align: center;
}

.user-image {
  width: 100%;
  max-width: 200px;
  height: auto;
  border-radius: 8px;
  margin-bottom: 1em;
  border: 2px solid #ddd;
}

.change-photo-btn {
  background: #6c757d;
  color: white;
  border: none;
  padding: 0.5em 1em;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
}

.change-photo-btn:hover {
  background: #5a6268;
}

.product-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 0.5em;
  margin-bottom: 1em;
}

.product-thumbnail {
  width: 100%;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  transition:
    border 0.2s,
    transform 0.2s;
}

.product-thumbnail:hover {
  transform: scale(1.05);
}

.product-thumbnail.selected {
  border: 3px solid #1a73e8;
}

.selected-product-display {
  text-align: center;
}

.selected-product-image {
  width: 100%;
  max-width: 150px;
  height: auto;
  border-radius: 8px;
  border: 2px solid #ddd;
}

.result-container {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #ddd;
  border-radius: 8px;
  margin-bottom: 1em;
}

.result-placeholder {
  text-align: center;
  color: #666;
  font-style: italic;
}

.result-placeholder.processing {
  color: #1a73e8;
}

.result-placeholder.error {
  color: #dc3545;
}

.result-image {
  width: 100%;
  max-width: 200px;
  height: auto;
  border-radius: 8px;
}

.try-on-controls {
  text-align: center;
}

.try-on-button {
  background: #28a745;
  color: white;
  border: none;
  padding: 0.8em 2em;
  border-radius: 6px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 0.5em;
}

.try-on-button:hover:not(.disabled) {
  background: #218838;
}

.try-on-button.disabled {
  background: #6c757d;
  cursor: not-allowed;
}

.countdown {
  font-size: 0.9em;
  color: #666;
  margin-top: 0.5em;
}

.countdown.hidden {
  display: none;
}

.countdown.visible {
  display: block;
}

.upload-instruction {
  text-align: center;
  padding: 2em;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #dee2e6;
  margin-top: 2em;
}

.upload-instruction h3 {
  color: #495057;
  margin-bottom: 0.5em;
}

.upload-instruction p {
  color: #6c757d;
  margin-bottom: 1.5em;
  line-height: 1.5;
}

.upload-photo-btn.primary {
  background: #007bff;
  color: white;
  border: none;
  padding: 1em 2em;
  border-radius: 6px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.upload-photo-btn.primary:hover {
  background: #0056b3;
}

/* Floating Chat Styles */
.try-on-chat {
  position: fixed;
  bottom: 8px;
  right: 12px;
  width: 400px;
  height: 600px;
  background: white;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border: 1px solid #e1e5e9;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
}

.try-on-chat.visible {
  transform: translateY(0);
}

.try-on-chat-header {
  background: #45c0b6;
  color: white;
  padding: 16px 20px;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.try-on-chat-title {
  font-weight: 600;
  font-size: 16px;
  flex: 1;
}

.try-on-chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.try-on-chat-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.try-on-chat-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 90px;
}

.auth-message {
  margin-bottom: 0px !important;
}

.try-on-chat-content::-webkit-scrollbar {
  width: 6px;
}

.try-on-chat-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.try-on-chat-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.try-on-chat-content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.chat-message {
  animation: slideInUp 0.3s ease-out;
}

/* User Image Section Styles */
.user-image-section {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #e1e5e9;
  margin-bottom: 16px;
  max-width: 100%;
  position: relative;
}

.change-image-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: #45c0b6;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(69, 192, 182, 0.3);
  text-decoration: none;
}

.change-image-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(69, 192, 182, 0.4);
  background: linear-gradient(135deg, #3aa89e, #2f8a82);
}

.change-image-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(69, 192, 182, 0.3);
}

.change-image-btn .btn-icon {
  font-size: 16px;
  line-height: 1;
}

.change-image-btn .btn-text {
  font-weight: 400;
  letter-spacing: 0.5px;
  font-size: 12px;
}

.change-image-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Image Loading Overlay Styles */
.image-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(248, 249, 250, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 12px;
  z-index: 10;
}

.image-loading-overlay .loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #e1e5e9;
  border-top: 2px solid #45c0b6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.image-loading-overlay p {
  margin: 0;
  color: #666;
  font-size: 12px;
  font-weight: 500;
}

/* Image Loader Styles */
.image-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #e1e5e9;
  min-height: 80px;
}

.loader-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e1e5e9;
  border-top: 3px solid #45c0b6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.image-loader p {
  margin: 0;
  color: #666;
  font-size: 14px;
  font-weight: 500;
}

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

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  color: #666;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #45c0b6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Chat Auth Styles */
.auth-container {
  width: 100%;
}

.auth-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid #e1e5e9;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 500;
  color: #666;
  transition: all 0.2s;
}

.auth-tab.active {
  color: #45c0b6;
  border-bottom-color: #45c0b6;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.auth-form h3 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 18px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #45c0b6;
  box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.1);
}

.auth-btn {
  width: 100%;
  background: #45c0b6;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.auth-btn:hover {
  background: #1e3d6f;
}

.auth-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.error-message {
  background: #fee;
  color: #c33;
  padding: 10px;
  border-radius: 4px;
  margin-top: 10px;
  font-size: 14px;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
}

.auth-footer p {
  color: #666;
  font-size: 12px;
  margin: 0;
}

/* Chat Interface Styles */
.try-on-interface {
  width: 100%;
}

.user-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e1e5e9;
  margin-bottom: 16px;
}

.user-info span {
  font-weight: 500;
  color: #333;
}

.logout-btn {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.logout-btn:hover {
  background: #c0392b;
}

.try-on-interface h2 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 20px;
}

.try-on-interface h3 {
  margin: 16px 0 8px 0;
  color: #333;
  font-size: 16px;
}

.try-on-interface h4 {
  margin: 0 0 8px 0;
  color: #333;
  font-size: 14px;
}

.upload-instruction {
  text-align: center;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  margin: 16px 0;
}

.upload-instruction p {
  color: #666;
  margin: 10px 0 20px 0;
  font-size: 14px;
}

.upload-photo-btn {
  background: #45c0b6;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.upload-photo-btn:hover {
  background: #1e3d6f;
}

.try-on-main-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.user-image-section,
.product-images-section,
.result-section {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 0px;
}

.image-container {
  position: relative;
  text-align: center;
}

.user-image,
.selected-product-image {
  width: 100%;
  max-width: 200px;
  height: auto;
  border-radius: 6px;
  border: 1px solid #ddd;
  margin-left: auto;
}

.change-photo-btn {
  background: #17a2b8;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  margin-top: 8px;
  transition: background-color 0.2s;
}

.change-photo-btn:hover {
  background: #138496;
}

.result-container {
  min-height: 100px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
}

.result-placeholder {
  color: #666;
  font-size: 14px;
  text-align: center;
  padding: 20px;
}

.result-image {
  width: 100%;
  max-width: 200px;
  height: auto;
  border-radius: 6px;
}

.try-on-controls {
  text-align: center;
  margin: 12px 0;
}

.try-on-button {
  background: #28a745;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  width: 100%;
}

.try-on-button:hover:not(.disabled) {
  background: #218838;
}

.try-on-button.disabled {
  background: #ccc;
  cursor: not-allowed;
}

.countdown {
  margin-top: 8px;
  font-size: 12px;
  color: #666;
  display: none;
}

.countdown.visible {
  display: block;
}

.product-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.product-thumbnail {
  width: 100%;
  height: 60px;
  object-fit: cover;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.product-thumbnail:hover {
  border-color: #45c0b6;
}

.product-thumbnail.selected {
  border-color: #28a745;
}

/* Mobile Responsive for Chat */
@media (max-width: 480px) {
  .try-on-chat {
    width: calc(100vw - 40px);
    height: 70vh;
    bottom: 10px;
    right: 10px;
    left: 10px;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .try-on-main-layout {
    grid-template-columns: 1fr;
    gap: 1em;
  }

  .product-gallery {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  }

  .product-thumbnail {
    height: 60px;
  }
}

/* Admin Selected Product Styles */
.admin-selected-note {
  margin-top: 8px;
  font-size: 12px;
  color: #6c757d;
  text-align: center;
  font-style: italic;
  background: #f8f9fa;
  padding: 6px 10px;
  border-radius: 4px;
  border-left: 3px solid #28a745;
}

.selected-product-display {
  text-align: center;
}

.selected-product-display h4 {
  margin-bottom: 10px;
  color: #333;
  font-size: 16px;
  font-weight: 600;
}

.selected-product-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 2px solid #28a745;
}

/* Update product images section for admin-only selection */
.product-images-section {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

/* Chat Interface Styles */
.try-on-chat-user-info {
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  padding: 10px 20px;
}

.user-welcome {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.welcome-text {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.logout-btn-small {
  background: #dc3545;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.logout-btn-small:hover {
  background: #c82333;
}

/* Chat message alignment for new layout */
.chat-message.user-message {
  display: flex;
  justify-content: flex-end;
  /* margin: 10px 0; */
}

.chat-message.history-message {
  display: flex;
  justify-content: flex-start;
}

.chat-message.system-message {
  display: flex;
  justify-content: center;
}

.chat-message.user-message .message-content {
  background: #45c0b670;
  color: white;
  padding: 0px;
  border-radius: 18px 18px 2px 18px;
  overflow: hidden;
  max-width: 80%;
}

.chat-message.history-message .message-content {
  background: #f1f3f4;
  color: #000;
  padding: 0px;
  border-radius: 18px 18px 18px 2px;
  overflow: hidden;
  max-width: 80%;
}

.chat-message.system-message .message-content {
  background: #fff3cd;
  color: #856404;
  padding: 8px 12px;
  border-radius: 18px;
  border: 1px solid #ffeaa7;
  text-align: center;
}

.chat-message.system-message.loading .message-content {
  background: #e3f2fd;
  color: #1976d2;
  border: 1px solid #bbdefb;
}

.chat-message.system-message.error .message-content {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

/* User profile image on right side */
.user-profile-image {
  width: 100%;
  height: 100%;
  max-height: 300px;
  /* border-radius: 50%; */
  object-fit: contain;
}

/* Updated chat history styles */
.chat-history-item {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
  max-width: max-content;
}

.history-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.history-images {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.history-garment-img,
.history-result-img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.history-info {
  flex: 1;
}

.history-info-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.history-date {
  font-size: 12px;
  color: #666;
  margin: 0 0 4px 0;
}

.history-status {
  font-size: 12px;
  font-weight: 500;
  margin: 0;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

.status-completed {
  background: #d4edda;
  color: #155724;
}

.status-in_queue {
  background: #fff3cd;
  color: #856404;
}

.status-failed {
  background: #f8d7da;
  color: #721c24;
}

.processing-indicator {
  font-size: 11px;
  color: #856404;
  margin-top: 4px;
  font-style: italic;
}

/* Chat upload interface */
.chat-upload-interface {
  text-align: center;
  padding: 20px;
}

.upload-photo-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  margin-top: 12px;
}

.upload-photo-btn:hover {
  background: #218838;
}

/* Chat try-on section */
.chat-try-on-section {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #eee;
  padding: 12px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1000 !important;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  max-height: 100px;
  min-height: 80px;
}

.chat-history-text {
  padding: 12px;
  margin-bottom: 0px;
  font-size: 12px;
  color: #000;
  background: #17a2b820;
}

.current-product {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.current-product h4 {
  display: none; /* Hide the heading in the flex layout */
}

.current-product-img {
  width: 60px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid #28a745;
  flex-shrink: 0;
}

.product-title {
  font-size: 12px;
  color: #666;
  margin: 0;
  flex: 1;
}

.chat-try-on-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin: 0;
  transition: all 0.2s ease;
  min-width: 100px;
  flex-shrink: 0;
}

.chat-try-on-btn:hover {
  background: #218838;
  transform: translateY(-1px);
}

.chat-try-on-btn.again {
  background: #17a2b8;
  color: white;
}

.chat-try-on-btn.again:hover {
  background: #138496;
}

.processing-status {
  background: #fff3cd;
  color: #856404;
  padding: 8px 12px;
  border-radius: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  margin: 0;
  border: 1px solid #ffeaa7;
  flex-shrink: 0;
  min-width: 120px;
}

/* History image styles */
.history-garment-img,
.history-result-img {
  width: 200px;
  height: 200px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #ddd;
}

.history-result-img {
  border: 2px solid #28a745;
}

/* History image container with action buttons */
.history-image-container {
  position: relative;
  display: inline-block;
}

.history-image-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
  z-index: 10;
}

.history-info {
  flex: 1;
}

.history-date {
  font-size: 12px;
  color: #666;
  margin: 0 0 4px 0;
}

.history-status {
  font-size: 12px;
  font-weight: 500;
  margin: 0 0 4px 0;
  padding: 2px 6px;
  border-radius: 12px;
  display: inline-block;
}

.status-completed {
  background: #d4edda;
  color: #155724;
}

.status-in_queue {
  background: #fff3cd;
  color: #856404;
}

.status-failed {
  background: #f8d7da;
  color: #721c24;
}

.processing-indicator {
  font-size: 11px;
  color: #856404;
  font-style: italic;
  margin-top: 2px;
}

.completed-result-img {
  width: 100px;
  height: auto;
  border-radius: 8px;
  border: 2px solid #28a745;
  margin-left: 8px;
}

.chat-try-on-btn {
  background: linear-gradient(45deg, #ff6b6b, #ee5a24);
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-try-on-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Completed result images */
.completed-result-img {
  max-width: 150px;
  height: auto;
  border-radius: 8px;
  border: 2px solid #28a745;
  margin: 8px 0;
}

/* Enhanced Result UI Styles */
.result-image-wrapper {
  position: relative;
  display: inline-block;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.result-image-wrapper:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.result-image-wrapper img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 12px;
}

.result-image-wrapper:hover .image-overlay {
  opacity: 1;
}

.share-btn {
  background: linear-gradient(45deg, #007bff, #0056b3);
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
  background: linear-gradient(45deg, #0056b3, #004085);
}

.share-btn svg {
  width: 18px;
  height: 18px;
}

.result-message {
  text-align: center;
  margin-top: 16px;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 12px;
  border: 1px solid #dee2e6;
}

.success-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.result-message h4 {
  margin: 0 0 8px 0;
  color: #28a745;
  font-size: 18px;
  font-weight: 600;
}

.result-message p {
  margin: 0;
  color: #6c757d;
  font-size: 14px;
  line-height: 1.5;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.try-again-btn,
.download-btn {
  padding: 2px 2px;
  border: none;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
}

.try-again-btn {
  background: linear-gradient(45deg, #28a745, #20c997);
  color: white;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.try-again-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
  background: linear-gradient(45deg, #20c997, #17a2b8);
}

.download-btn {
  background: linear-gradient(45deg, #6c757d, #495057);
  color: white;
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
  background: linear-gradient(45deg, #495057, #343a40);
}

.share-success-message {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(135deg, #d4edda, #c3e6cb);
  border-radius: 12px;
  border: 1px solid #c3e6cb;
  margin: 16px 0;
  animation: slideInRight 0.3s ease;
}

.share-success-message.error {
  background: linear-gradient(135deg, #f8d7da, #f5c6cb);
  border-color: #f5c6cb;
}

.share-success-message .success-icon {
  font-size: 24px;
  margin: 0;
  flex-shrink: 0;
}

.share-success-message .success-content h5 {
  margin: 0 0 8px 0;
  color: #155724;
  font-size: 16px;
  font-weight: 600;
}

.share-success-message.error .success-content h5 {
  color: #721c24;
}

.share-success-message .success-content p {
  margin: 0;
  color: #155724;
  font-size: 14px;
  line-height: 1.5;
}

.share-success-message.error .success-content p {
  color: #721c24;
}

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

/* Chat result container improvements */
.try-on-result-container {
  text-align: center;
  padding: 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid #e9ecef;
}

/* Image container with action buttons */
.image-container {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
}

.image-actions {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  gap: 4px;
  z-index: 10;
}

.action-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5f6368;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  position: relative;
  z-index: 20;
  font-size: 12px;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.action-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.action-btn {
  font-size: 12px;
  line-height: 1;
}

.share-btn:hover {
  color: #007bff;
}

.download-btn:hover {
  color: #28a745;
}

/* Copy success popup styles */
.copy-popup {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(40, 167, 69, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  max-width: 300px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.copy-popup.show {
  transform: translateX(0);
  opacity: 1;
}

.copy-popup-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.copy-popup-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.copy-popup-text {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

/* Mobile responsive popup */
@media (max-width: 768px) {
  .copy-popup {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
    transform: translateY(-100px);
  }

  .copy-popup.show {
    transform: translateY(0);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .result-actions {
    flex-direction: column;
    align-items: center;
  }

  .try-again-btn,
  .download-btn {
    width: 100%;
    max-width: 200px;
    justify-content: center;
  }

  .share-btn {
    padding: 4px 8px;
    font-size: 10px;
  }

  .result-message {
    padding: 16px;
  }

  .result-message h4 {
    font-size: 16px;
  }

  .image-actions {
    top: 4px;
    left: 4px;
    gap: 6px;
  }

  .action-btn {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .history-image-actions {
    top: 4px;
    right: 4px;
    gap: 4px;
  }
}
