/* Agents24x7 WordPress Plugin Admin Styles */

/* WordPress Admin Interface Overrides - Make plugin full-width */
#wpcontent {
  padding-left: 0 !important;
}

#wpbody-content {
  padding-bottom: 0 !important;
  padding-top: 0 !important; /* Remove padding between admin bar and content */
}

.wp-admin #wpbody-content > div:not(#agents24x7-admin-root) {
  display: none !important;
}

#agents24x7-admin-root {
  margin: 0;
  min-height: calc(100vh - 32px - 40px); /* Account for admin bar height */
  display: flex;
}

/* Hide admin notices on this page after showing */
.notice, .update-nag {
  position: absolute;
  top: 40px;
  left: 20px;
  right: 20px;
  z-index: 100;
}

/* Adjust for admin bar on mobile */
@media screen and (max-width: 782px) {
  #agents24x7-admin-root {
    min-height: calc(100vh - 46px); /* Mobile admin bar is taller */
  }
}

/* Override WordPress forms.css card border for all our cards */
.agents24x7-admin .card {
  border: none;
}

.agents24x7-admin {
  width: 100%;
  min-height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
}



/* Welcome/Error States */
.agents24x7-welcome,
.agents24x7-error,
.agents24x7-loading {
  text-align: center;
  padding: 40px 20px;
}

.agents24x7-admin .agents24x7-welcome .card,
.agents24x7-admin .agents24x7-error .card {
  max-width: 600px;
  margin: 0 auto;
  padding: 30px;
  border: none;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.agents24x7-welcome h2 {
  color: #2271b1;
  margin-bottom: 15px;
}

.agents24x7-welcome p {
  font-size: 16px;
  color: #666;
  margin-bottom: 25px;
}

/* Connection Setup */
.agents24x7-setup {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #f9fafb;
}

.agents24x7-setup .setup-header {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 16px 24px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.agents24x7-setup .header-brand {
  display: flex;
  align-items: center;
}

.agents24x7-setup .brand-name {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.agents24x7-setup .brand-agents {
  color: #1978e5;
}

.agents24x7-setup .brand-24x7 {
  color: #111418;
}

.agents24x7-setup .setup-main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 16px;
}

.agents24x7-setup .main-card,
.agents24x7-setup .agent-card {
  width: 100%;
  max-width: 672px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  padding: 40px;
  border: none;
}

.agents24x7-setup .card-header {
  text-align: center;
  margin-bottom: 32px;
}

.agents24x7-setup .card-header h2 {
  margin: 0 0 24px 0;
  font-size: 30px;
  font-weight: 700;
  color: #111418;
  line-height: 1.2;
}

.agents24x7-setup .subtitle {
  margin: 0;
  font-size: 18px;
  color: #525866;
  line-height: 1.4;
}

/* Site Information Section */
.agents24x7-setup .site-info-section {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 32px;
}

.agents24x7-setup .site-info-section h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: #111418;
}

.agents24x7-setup .info-content p {
  margin: 4px 0;
  font-size: 14px;
}

.agents24x7-setup .label {
  font-weight: 500;
  color: #111418;
}

.agents24x7-setup .value {
  color: #525866;
}

.agents24x7-setup .site-link {
  color: #1978e5;
  text-decoration: none;
}

.agents24x7-setup .site-link:hover {
  text-decoration: underline;
}

/* Secure Connection Section */
.agents24x7-setup .secure-connection-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 32px;
}

.agents24x7-setup .section-title {
  display: flex;
  align-items: center;
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: #111418;
}

.agents24x7-setup .icon-lock {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  color: #22c55e;
}

.agents24x7-setup .section-content {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #525866;
}

.agents24x7-setup .section-content strong {
  color: #111418;
}

/* Benefits Section */
.agents24x7-setup .benefits-section {
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 40px;
}

.agents24x7-setup .icon-benefit {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  color: #a855f7;
}

/* Actions */
.agents24x7-setup .actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 24px 0;
}

.agents24x7-setup .connect-button {
  width: 100%;
  max-width: 320px;
  padding: 12px 24px;
  background-color: #1978e5;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.agents24x7-setup .connect-button:hover {
  background-color: #1563c1;
}

.agents24x7-setup .connect-button:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.agents24x7-setup .disclaimer {
  text-align: center;
  font-size: 12px;
  color: #6b7280;
  margin: 0;
}

/* Sign In button specific styles */
.agents24x7-setup .signin-button {
  background-color: white;
  color: #374151;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-weight: 500;
}

.agents24x7-setup .signin-button:hover {
  background-color: #f9fafb;
  border-color: #d1d5db;
  color: #111827;
}

/* Global Footer */
.agents24x7-footer {
  background: white;
  border-top: 1px solid #e5e7eb;
  padding: 24px;
  text-align: center;
  font-size: 14px;
  color: #525866;
  margin-top: auto;
}

/* Header user button styles */
.header-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* User Credits Badge */
.user-credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.user-credits-badge:hover {
  border-color: #1978e5;
  transform: scale(1.05);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.credits-label {
  color: #64748b;
}

.credits-amount {
  font-weight: 600;
}

.credits-amount.text-red-600 {
  color: #dc2626;
}

.credits-amount.text-amber-600 {
  color: #d97706;
}

.credits-amount.text-emerald-600 {
  color: #059669;
}

.agents24x7-setup .card-title {
  margin: 0 0 8px 0;
  font-size: 30px;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
}

.agents24x7-setup .card-subtitle {
  margin: 0 0 32px 0;
  font-size: 16px;
  color: #64748b;
  text-align: center;
}

.agents24x7-setup .agent-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
}

.agents24x7-setup .avatar-container {
  position: relative;
}

.agents24x7-setup .agent-card .agent-avatar,
.agents24x7-setup .agent-card .agent-avatar-placeholder {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: 4px solid white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  object-fit: cover;
}

.agents24x7-setup .agent-card .agent-avatar-placeholder {
  background-color: #1978e5;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 600;
}

.agents24x7-setup .avatar-refresh-btn {
  position: absolute;
  bottom: -8px;
  right: -8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #1978e5;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: background-color 0.15s ease;
}

.agents24x7-setup .avatar-refresh-btn:hover:not(:disabled) {
  background-color: #1563c1;
}

.agents24x7-setup .avatar-refresh-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.agents24x7-setup .refresh-icon {
  width: 20px;
  height: 20px;
}

.agents24x7-setup .refresh-icon.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.agents24x7-setup .agent-card .agent-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.agents24x7-setup .name-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 4px;
  width: 100%;
}

.agents24x7-setup .name-container .name-edit-btn {
  position: absolute;
  right: 0;
}

.agents24x7-setup .agent-name {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #0f172a;
  padding: 4px 8px;
  border: 2px solid transparent;
  border-radius: 4px;
  line-height: 1.2;
  box-sizing: border-box;
}

.agents24x7-setup .name-input {
  font-size: 24px;
  font-weight: 600;
  color: #0f172a;
  border: 2px solid #1978e5;
  border-radius: 4px;
  padding: 4px 8px;
  outline: none;
  line-height: 1.2;
  box-sizing: border-box;
  background: white;
  text-align: center;
}

.agents24x7-setup .name-edit-btn,
.agents24x7-setup .name-save-btn,
.agents24x7-setup .name-cancel-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s ease;
}

.agents24x7-setup .name-edit-btn:hover {
  color: #1978e5;
}

.agents24x7-setup .name-save-btn {
  color: #22c55e;
}

.agents24x7-setup .name-save-btn:hover {
  color: #16a34a;
}

.agents24x7-setup .name-cancel-btn {
  color: #ef4444;
}

.agents24x7-setup .name-cancel-btn:hover {
  color: #dc2626;
}

.agents24x7-setup .edit-icon-small,
.agents24x7-setup .check-icon,
.agents24x7-setup .x-icon {
  width: 20px;
  height: 20px;
}

.agents24x7-setup .agent-role {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: #1978e5;
}

.agents24x7-setup .locale-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.agents24x7-setup .locale-label {
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
}

.agents24x7-setup .locale-select {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
  background-color: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  min-width: 200px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' 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 12px center;
  padding-right: 40px;
}

.agents24x7-setup .locale-select:hover {
  border-color: #1978e5;
}

.agents24x7-setup .locale-select:focus {
  outline: none;
  border-color: #1978e5;
  box-shadow: 0 0 0 2px rgba(25, 120, 229, 0.2);
}

/* Compact locale selector for dashboard header */
.locale-selector-compact {
  display: flex;
  align-items: center;
  margin-bottom: 0;
}

.locale-select-compact {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
  background-color: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  min-width: 140px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' 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;
  padding-right: 32px;
}

.locale-select-compact:hover {
  border-color: #1978e5;
}

.locale-select-compact:focus {
  outline: none;
  border-color: #1978e5;
  box-shadow: 0 0 0 2px rgba(25, 120, 229, 0.2);
}

.agents24x7-setup .agent-description {
  background-color: #f8fafc;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 32px;
}

.agents24x7-setup .agent-description p {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: #475569;
  text-align: center;
}

.agents24x7-setup .description-textarea {
  width: 100%;
  font-size: 16px;
  line-height: 1.6;
  color: #475569;
  border: 2px solid #1978e5;
  border-radius: 4px;
  padding: 12px;
  resize: vertical;
}


.agents24x7-setup .hire-button {
  width: auto;
  min-width: 120px;
  max-width: 320px;
  padding: 11px 24px;
  background-color: #1978e5;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: background-color 0.15s ease;
}

.agents24x7-setup .hire-button:hover {
  background-color: #1563c1;
}

.agents24x7-setup .hire-button:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.agents24x7-setup .disclaimer-text {
  text-align: center;
  font-size: 14px;
  color: #64748b;
  margin: 0;
}

.agents24x7-setup .disclaimer-text .link {
  color: #1978e5;
  font-weight: 500;
  text-decoration: none;
}

.agents24x7-setup .disclaimer-text .link:hover {
  text-decoration: underline;
}

.agents24x7-setup .disconnect-action {
  display: flex;
  justify-content: center;
  margin-top: 8px;
  margin-bottom: 24px;
}

.agents24x7-setup .disconnect-button {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 14px;
  cursor: pointer;
  padding: 8px 16px;
  text-decoration: underline;
  transition: color 0.15s ease, background-color 0.15s ease;
  border-radius: 8px;
}

.agents24x7-setup .disconnect-button:hover {
  color: #dc2626;
  text-decoration: underline;
  background-color: rgba(220, 38, 38, 0.05);
}

/* Dashboard */
.agents24x7-admin .agents24x7-dashboard .card {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px;
  border: none;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  background: white;
  border-radius: 12px;
}

.success-message {
  display: flex;
  align-items: center;
  gap: 15px;
  background: #d1edff;
  padding: 20px;
  border-radius: 5px;
  margin-bottom: 25px;
}

.success-message .dashicons {
  color: #2271b1;
  font-size: 24px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin: 15px 0;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 4px;
}

.status-connected {
  color: #00a32a;
  font-weight: bold;
}

.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.capability-item {
  text-align: center;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
}

.capability-item .dashicons {
  font-size: 32px;
  color: #2271b1;
  margin-bottom: 10px;
}

.capability-item h4 {
  margin: 10px 0 8px 0;
  color: #23282d;
}

.capability-item p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.next-steps {
  background: #fff3cd;
  padding: 20px;
  border-radius: 5px;
  margin: 25px 0;
}

.next-steps h3 {
  margin-top: 0;
  color: #856404;
}

.next-steps ol {
  margin-left: 20px;
}

.next-steps li {
  margin-bottom: 8px;
}

.support-info {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 5px;
  margin-top: 25px;
}

.support-info h3 {
  margin-top: 0;
}

/* Actions */
.actions {
  margin-top: 25px;
  text-align: center;
}

.actions .button {
  margin: 0 5px;
}

.button-large {
  font-size: 16px;
  padding: 10px 20px;
  height: auto;
}

/* Responsive */
@media (max-width: 640px) {
  .agents24x7-setup .brand-name,
  .agents24x7-setup .brand-name {
    font-size: 20px;
  }
}

@media (max-width: 768px) {
  
  .avatar-selection {
    justify-content: center;
  }
  
  .detail-grid {
    grid-template-columns: 1fr;
  }
  
  .capabilities-grid {
    grid-template-columns: 1fr;
  }
  
  .actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  
  .actions .button {
    margin: 0;
  }
}

/* Agent Chat Interface - works within SetupLayout */
.agents24x7-dashboard {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
}

.agent-chat-container {
  width: 100%;
  max-width: 672px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 300px);
  min-height: 500px;
}

/* Agent Header */
.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
  background-color: #f3f4f6;
}

.agent-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #1978e5;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.agent-avatar .dashicons {
  font-size: 24px;
  color: white;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agent-name-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-details h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #111418;
  line-height: 1.2;
}

.agent-role {
  margin: 4px 0;
  font-size: 14px;
  color: #637488;
}

.agent-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  margin: 0;
}

.status-active {
  background-color: #d1fae5;
  color: #065f46;
}

.status-suspended {
  background-color: #fef3c7;
  color: #92400e;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Agent Header Actions */
.agent-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Telegram Button */
.telegram-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: #0088cc;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.telegram-button:hover:not(:disabled) {
  background-color: #0077b5;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 136, 204, 0.3);
}

.telegram-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.telegram-button .telegram-icon {
  font-size: 16px;
  line-height: 1;
  width: 16px;
  height: 16px;
}

.telegram-button .dashicons {
  font-size: 14px;
  line-height: 1;
  width: 14px;
  height: 14px;
}

.telegram-button .dashicons-external {
  margin-left: 2px;
}

.telegram-button-text {
  font-size: 13px;
}

/* Agent Actions Dropdown */
.agent-actions {
  position: relative;
}

.action-menu-button {
  background: none;
  border: none;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.15s ease;
  color: #637488;
}

.action-menu-button:hover {
  background-color: #e5e7eb;
  color: #111418;
}

.action-menu-button .dashicons {
  font-size: 20px;
}

.action-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  min-width: 192px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  padding: 4px;
  z-index: 50;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  color: #111418;
  cursor: pointer;
  transition: background-color 0.15s ease;
  text-align: left;
}

.dropdown-item:hover:not(:disabled) {
  background-color: #f0f2f4;
}

.dropdown-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dropdown-item .dashicons {
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropdown-item .dashicons-controls-pause {
  color: #f59e0b;
}

.dropdown-item .dashicons-controls-play {
  color: #22c55e;
}

.dropdown-item-danger {
  color: #dc2626;
}

.dropdown-item-danger:hover {
  background-color: #fef2f2;
  color: #dc2626;
}

.dropdown-item-danger .dashicons {
  color: #dc2626;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 70%;
}

.message-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #e3e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid #e5e7eb;
}

.message-user .message-avatar {
  background-color: #dbeafe;
}

.message-avatar .dashicons {
  font-size: 18px;
  color: #637488;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-user .message-content {
  align-items: flex-end;
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.message-user .message-header {
  flex-direction: row-reverse;
}

.message-sender {
  font-size: 12px;
  font-weight: 500;
  color: #637488;
  margin: 0;
}

.message-timestamp {
  font-size: 11px;
  color: #9ca3af;
  opacity: 0.8;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  background-color: #f0f2f4;
  color: #111418;
}

.message-user .message-bubble {
  background-color: #1978e5;
  color: white;
  border-bottom-right-radius: 4px;
}

.message-agent .message-bubble {
  border-bottom-left-radius: 4px;
}

.message-bubble p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.message-link {
  color: #1978e5;
  text-decoration: underline;
  word-break: break-all;
}

.message-link:hover {
  color: #1563c1;
  text-decoration: underline;
}

.message-user .message-link {
  color: #a7c3f0;
}

.message-user .message-link:hover {
  color: #ffffff;
}

/* Chat Input */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  background-color: #f3f4f6;
}

.chat-input {
  flex: 1;
  resize: none;
  border: 1px solid #e3e7eb;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  background-color: white;
  color: #111418;
  outline: none;
  transition: border-color 0.15s ease;
  min-height: 44px;
  max-height: 120px;
}

.chat-input:focus {
  border-color: #1978e5;
  box-shadow: 0 0 0 1px #1978e5;
}

.chat-input::placeholder {
  color: #637488;
}

.send-button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background-color: #1978e5;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
  background-color: #1563c1;
}

.send-button:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.send-button .dashicons {
  font-size: 20px;
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #f0f2f4;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Responsive Chat Interface */
@media (max-width: 768px) {
  .agent-chat-container {
    height: calc(100vh - 250px);
    min-height: 400px;
  }
  
  .message {
    max-width: 85%;
  }
  
  .agent-header {
    padding: 12px;
  }
  
  .agent-info {
    gap: 10px;
  }
  
  .agent-avatar {
    width: 40px;
    height: 40px;
  }
  
  .agent-avatar .dashicons {
    font-size: 20px;
  }
  
  .agent-details h2 {
    font-size: 16px;
  }
  
  .agent-status {
    font-size: 11px;
    padding: 3px 8px;
  }
  
  .status-dot {
    width: 6px;
    height: 6px;
  }
  
  .chat-messages {
    padding: 16px;
  }
  
  .chat-input-area {
    padding: 12px;
  }
}

/* Agent Avatar Image */
.agent-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Loading State */
.chat-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  color: #637488;
  font-size: 14px;
}

/* Typing Indicator */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background-color: #637488;
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing-bounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Credit Warning */
.credit-warning {
  background-color: #fef3c7;
  border-top: 1px solid #fbbf24;
  padding: 12px 16px;
  text-align: center;
}

.credit-warning p {
  margin: 0;
  font-size: 13px;
  color: #92400e;
  font-weight: 500;
}

/* Error Boundary Styles */
.agents24x7-error .error-boundary-card {
  max-width: 600px;
  margin: 40px auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  padding: 32px;
  border: none;
}

.error-boundary-card .error-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.error-boundary-card .error-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: #fef2f2;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dc2626;
}

.error-boundary-card .error-title {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
  color: #111418;
}

.error-boundary-card .error-subtitle {
  margin: 0;
  font-size: 16px;
  color: #525866;
  line-height: 1.5;
}

.error-boundary-card .error-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.error-boundary-card .error-details {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-top: 24px;
}

.error-boundary-card .error-details summary {
  font-weight: 500;
  color: #111418;
  cursor: pointer;
  margin-bottom: 12px;
}

.error-boundary-card .error-stack {
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.error-boundary-card .error-stack h4 {
  margin: 12px 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #111418;
}

.error-boundary-card .error-stack pre {
  background: #1f2937;
  color: #f9fafb;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Chat Error Fallback */
.chat-error-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 32px;
  background: #f9fafb;
  border-radius: 12px;
  margin: 16px;
}

.chat-error-fallback .error-content {
  text-align: center;
  max-width: 400px;
}

.chat-error-fallback .error-icon {
  margin: 0 auto 16px;
  width: 64px;
  height: 64px;
  background: #fef2f2;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dc2626;
}

.chat-error-fallback h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: #111418;
}

.chat-error-fallback p {
  margin: 0 0 24px 0;
  font-size: 14px;
  color: #525866;
  line-height: 1.5;
}

.chat-error-fallback .error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Connection Error Fallback */
.connection-error-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 40px;
}

.connection-error-fallback .error-content {
  text-align: center;
  max-width: 500px;
}

.connection-error-fallback .error-icon {
  margin: 0 auto 20px;
  width: 80px;
  height: 80px;
  background: #fef2f2;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dc2626;
}

.connection-error-fallback h3 {
  margin: 0 0 12px 0;
  font-size: 24px;
  font-weight: 700;
  color: #111418;
}

.connection-error-fallback p {
  margin: 0 0 32px 0;
  font-size: 16px;
  color: #525866;
  line-height: 1.6;
}

.connection-error-fallback .error-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

/* Loading Error Fallback */
.loading-error-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  padding: 24px;
}

.loading-error-fallback .error-content {
  text-align: center;
  max-width: 400px;
}

.loading-error-fallback .error-icon {
  margin: 0 auto 16px;
  width: 56px;
  height: 56px;
  background: #fef2f2;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dc2626;
}

.loading-error-fallback h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #111418;
}

.loading-error-fallback p {
  margin: 0 0 20px 0;
  font-size: 14px;
  color: #525866;
  line-height: 1.5;
}

.loading-error-fallback .error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Agent Initialization Styles */
.message-initializing {
  opacity: 0;
  animation: fadeInSlide 0.6s ease-out 0.3s forwards;
}

.message-initializing .message-bubble-system {
  background-color: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1e40af;
}

.message.message-system.message-initializing .message-avatar .dashicons.dashicons-info.system-icon {
  color: #3b82f6;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  width: auto;
  height: auto;
}

.status-initializing {
  background-color: #fef3c7;
  color: #d97706;
  animation: pulse 2s infinite;
}

.status-initializing .status-dot {
  background-color: #f59e0b;
  animation: pulse 1.5s infinite;
}

.agent-initializing {
  position: relative;
}

.agent-initializing::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #3b82f6, #8b5cf6, #06b6d4, #3b82f6);
  background-size: 400% 400%;
  border-radius: 12px;
  opacity: 0.3;
  z-index: -1;
  animation: gradientShift 3s ease-in-out infinite;
}

@keyframes fadeInSlide {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Enhanced initialization message styling */
.message-system {
  margin: 16px 0;
}

.message-system .message-sender {
  font-weight: 600;
  color: #1e40af;
  margin-bottom: 4px;
}

.message-system .message-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message-system .message-bubble p {
  margin: 0;
  line-height: 1.5;
  font-size: 14px;
}

/* User avatar styling */
.user-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* WordPress Notice Styles for Error Display */
.agents24x7-error .notice,
.agents24x7-admin .notice,
.agents24x7-setup .notice {
  background: #fff;
  border: 1px solid #c3c4c7;
  border-left-width: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
  margin: 20px 0;
  padding: 12px;
  position: relative;
}

.agents24x7-error .notice-error,
.agents24x7-admin .notice-error,
.agents24x7-setup .notice-error {
  border-left-color: #d63638;
}

.agents24x7-error .notice p,
.agents24x7-admin .notice p,
.agents24x7-setup .notice p {
  margin: 0.5em 0;
  padding: 2px;
  font-size: 13px;
  line-height: 1.5;
}

.agents24x7-error .notice p strong,
.agents24x7-admin .notice p strong,
.agents24x7-setup .notice p strong {
  font-weight: 600;
}

.agents24x7-error .notice .button,
.agents24x7-admin .notice .button,
.agents24x7-setup .notice .button {
  margin-top: 5px;
}

/* Error container styling */
.agents24x7-error {
  padding: 20px;
  max-width: 600px;
  margin: 40px auto;
}

/* Ensure error content is always visible */
.agents24x7-error,
.agents24x7-error * {
  visibility: visible !important;
  opacity: 1 !important;
  display: block !important;
}

/* Error Banner for inline errors */
.agents24x7-error-banner {
  max-width: 672px;
  margin: 0 auto 20px;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.agents24x7-error-banner .notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.agents24x7-error-banner .notice p {
  flex: 1;
  margin: 0;
}

.agents24x7-error-banner .button-small {
  flex-shrink: 0;
  padding: 4px 12px;
  font-size: 12px;
  line-height: 1.5;
  height: auto;
}

/* Connection Error Section */
.connection-error-section {
  margin: 0 0 20px 0;
}

.connection-error-section .error-notice {
  background: #fff;
  border: 1px solid #c3c4c7;
  border-left-width: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  position: relative;
  display: block;
}

.connection-error-section .error-notice-error {
  border-left-color: #d63638;
}

.connection-error-section .error-notice p {
  margin: 0.5em 0;
  padding: 2px;
  font-size: 14px;
  line-height: 1.5;
}

/* Connection Button Loading State */
.connect-button {
  position: relative;
  transition: all 0.2s ease;
}

.connect-button.connecting {
  opacity: 0.8;
  cursor: not-allowed !important;
}

.connect-button:disabled {
  opacity: 0.6;
  cursor: not-allowed !important;
  pointer-events: none;
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Button states for better UX */
.connect-button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.connect-button:not(:disabled):active {
  transform: translateY(0);
}

/* Credits Button Spinner */
.credits-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(34, 113, 177, 0.2);
  border-radius: 50%;
  border-top-color: #2271b1;
  animation: credits-spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes credits-spin {
  to { transform: rotate(360deg); }
}