/* Support Floating Widget CSS - Clean & Responsive */

#support-widget-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.support-floating-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

.support-floating-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.support-floating-icon svg {
  display: block;
  width: 32px;
  height: 32px;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  }
  50% {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.8);
  }
}

.support-widget-panel {
  position: fixed;
  bottom: 20px; 
  right: 20px;
  width: 90%; 
  max-width: 450px; 
  max-height: calc(100vh - 100px); 
  height: auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
  
  /* CRITICAL CHANGE HERE */
  display: none; 
  flex-direction: column;
  overflow: hidden; 
  z-index: 9998;
}

.support-widget-panel.open {
  display: flex !important; /* Forces visibility when JS adds the class */
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.support-panel-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.support-panel-header strong {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.support-header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.support-panel-home,
.support-panel-minimize {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.support-panel-home:hover,
.support-panel-minimize:hover {
  transform: scale(1.2);
}

/* Ensure the body is the only part that scrolls */
.support-panel-body {
  flex: 1; /* Takes up remaining space */
  overflow-y: auto; /* Enables scrollbar for chat messages */
  padding: 15px;
  display: flex;
  flex-direction: column;
}

/* MESSAGE STYLES */
.support-conversation {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  margin: 0;
}

.msg.bot {
  background: #f0f2f5;
  color: #333;
  align-self: flex-start;
  max-width: 85%;
}

.msg.user {
  background: #667eea;
  color: white;
  align-self: flex-end;
  max-width: 85%;
  text-align: right;
}

/* BUTTON & OPTION STYLES */
.support-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.support-option-btn {
  background: white;
  border: 1.5px solid #667eea;
  color: #667eea;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-align: left;
  line-height: 1.4;
  font-family: inherit;
}

.support-option-btn:hover {
  background: #667eea;
  color: white;
  transform: translateX(4px);
}

.support-option-btn:active {
  transform: translateX(2px);
}

/* INPUT STYLES */
.support-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.support-input input,
.support-input textarea {
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
  color: #333;
  background: white;
}

.support-input input {
  min-height: 36px;
}

.support-input textarea {
  min-height: 80px;
  resize: vertical;
}

.support-input input:focus,
.support-input textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Embedded send layout (input + send inside same row) */
.support-input .input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.support-input .input-row input,
.support-input .input-row textarea {
  flex: 1 1 auto;
  margin: 0;
}

.support-input .input-row.textarea-row textarea {
  min-height: 88px;
}

.support-input .embedded-send {
  background: #667eea;
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.support-input .embedded-send:hover {
  background: #5568d3;
}

.support-input .embedded-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.support-input .input-footer {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.input-footer .link-back {
  background: none;
  border: none;
  color: #667eea;
  cursor: pointer;
  padding: 6px 8px;
}

.input-footer .link-skip {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 6px 8px;
}

.support-input input::placeholder,
.support-input textarea::placeholder {
  color: #999;
}

/* ACTION BUTTONS */
.support-input .actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.support-input .actions button {
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  font-family: inherit;
}

.support-input .actions button.back {
  background: #f0f2f5;
  color: #667eea;
  padding: 8px 12px;
  border-radius: 6px;
  min-width: auto;
}

.support-input .actions button.back:hover {
  background: #e4e6eb;
}

.support-input .actions button.send {
  background: #667eea;
  color: white;
  padding: 8px 12px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
}

.support-input .actions button.send:hover {
  background: #5568d3;
}

.support-input .actions button.send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* RESPONSIVE DESIGN */
@media (max-width: 480px) {
  .support-widget-panel {
    width: calc(100vw - 40px);
    bottom: 80px;
    right: 20px;
    left: 20px;
    max-height: 80vh;
  }

  #support-widget-root {
    bottom: 10px;
    right: 10px;
  }

 .support-floating-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999; /* Higher than the panel */
}

  .support-panel-header strong {
    font-size: 14px;
  }

  .msg {
    font-size: 13px;
  }

  .support-option-btn {
    font-size: 12px;
    padding: 10px 14px;
  }

  .support-input input,
  .support-input textarea {
    font-size: 12px;
  }
}

/* ACCESSIBILITY */
.support-floating-icon:focus,
.support-option-btn:focus,
.support-input input:focus,
.support-input textarea:focus,
.support-input .actions button:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* SCROLLBAR STYLING */
.support-panel-body::-webkit-scrollbar {
  width: 6px;
}

.support-panel-body::-webkit-scrollbar-track {
  background: transparent;
}

.support-panel-body::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

.support-panel-body::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

/* PRINT STYLES */
@media print {
  #support-widget-root,
  .support-widget-panel,
  .support-floating-icon {
    display: none !important;
  }
}


.support-panel-home,
.support-panel-minimize {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.support-panel-home:hover,
.support-panel-minimize:hover {
  transform: scale(1.2);
}

.support-panel-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  font-size: 14px;
}

.support-conversation {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  margin-bottom: 8px;
}

.msg.bot {
  background: #f0f2f5;
  color: #333;
  align-self: flex-start;
  max-width: 85%;
}

.msg.user {
  background: #667eea;
  color: white;
  align-self: flex-end;
  max-width: 85%;
}

.support-message {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
  align-items: flex-end;
}

.support-message.customer {
  justify-content: flex-end;
}

.support-message-content {
  background: #f0f2f5;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
  color: #333;
  font-size: 14px;
  line-height: 1.4;
}

.support-message.customer .support-message-content {
  background: #667eea;
  color: white;
}

.support-suggestion-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.support-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.support-option-btn {
  background: white;
  border: 1.5px solid #667eea;
  color: #667eea;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-align: left;
  line-height: 1.3;
}

.support-option-btn:hover {
  background: #667eea;
  color: white;
  transform: translateX(4px);
}

.support-suggestion-btn {
  background: white;
  border: 1.5px solid #667eea;
  color: #667eea;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-align: left;
  line-height: 1.3;
}

.support-suggestion-btn:hover {
  background: #667eea;
  color: white;
  transform: translateX(4px);
}

.support-input-group {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.support-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.support-input input,
.support-input textarea {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
  resize: none;
}

.support-input input:focus,
.support-input textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.support-input input::placeholder,
.support-input textarea::placeholder {
  color: #999;
}

.support-input textarea {
  min-height: 80px;
  resize: vertical;
}

.support-input-field {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}

.support-input-field:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.support-input-field::placeholder {
  color: #999;
}

.support-input .actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.support-action-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.support-btn-send {
  background: #667eea;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background 0.2s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 40px;
}

.support-btn-send:hover {
  background: #5568d3;
}

.support-btn-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.support-btn-back {
  background: #f0f2f5;
  color: #667eea;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s ease;
  min-width: auto;
}

.support-btn-back:hover {
  background: #e4e6eb;
}

/* Template-based button styles (no prefix) */
.support-input .actions button.send {
  background: #667eea;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background 0.2s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 40px;
}

.support-input .actions button.send:hover {
  background: #5568d3;
}

.support-input .actions button.back {
  background: #f0f2f5;
  color: #667eea;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s ease;
  min-width: auto;
}

.support-input .actions button.back:hover {
  background: #e4e6eb;
}

.support-btn-skip {
  background: #f0f2f5;
  color: #667eea;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s ease;
}

.support-btn-skip:hover {
  background: #e4e6eb;
}

.support-status-msg {
  padding: 12px;
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  margin-top: 12px;
}

.support-status-msg.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.support-status-msg.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.support-form {
  margin: 0;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #333;
}

.form-control {
  display: block;
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.5;
  color: #495057;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: 4px;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  box-sizing: border-box;
}

.form-control:focus {
  color: #495057;
  background-color: #fff;
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-control::placeholder {
  color: #6c757d;
  opacity: 1;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 28px;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.btn {
  display: inline-block;
  font-weight: 400;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
  border: 1px solid transparent;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.5;
  border-radius: 4px;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  cursor: pointer;
  box-sizing: border-box;
}

.btn-primary {
  color: #fff;
  background-color: #667eea;
  border-color: #667eea;
  width: 100%;
  padding: 8px;
  margin-top: 8px;
}

.btn-primary:hover {
  color: #fff;
  background-color: #5568d3;
  border-color: #5568d3;
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

#support-status-msg {
  margin-top: 8px;
  font-size: 11px;
  color: #666;
  text-align: center;
  min-height: 16px;
}

/* Responsive Design */
@media (max-width: 480px) {
  .support-widget-panel {
    width: calc(100vw - 40px);
    bottom: 80px;
    right: 20px;
    left: 20px;
    max-height: 80vh;
  }

  #support-widget-root {
    bottom: 10px;
    right: 10px;
  }

  .support-floating-icon {
    width: 50px;
    height: 50px;
  }
}

/* Accessibility */
.support-floating-icon:focus,
.btn:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  #support-widget-root,
  .support-widget-panel,
  .support-floating-icon {
    display: none !important;
  }
}
