/* ============================================================================
   GLOBAL AI HELPER WIDGET
   Provides contextual assistance across the entire website
   ============================================================================ */

.global-ai-helper-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1rem;
}

.global-ai-helper-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #000000 0%, #333333 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .global-ai-helper-button {
  background: linear-gradient(135deg, #ffffff 0%, #e6e6e6 100%);
  color: #000000;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.2);
}

.global-ai-helper-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.global-ai-helper-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .global-ai-helper-button:hover {
  box-shadow: 0 6px 24px rgba(255, 255, 255, 0.3);
}

.global-ai-helper-button:hover::before {
  opacity: 1;
}

.global-ai-helper-button:active {
  transform: scale(0.95);
}

.global-ai-helper-button svg {
  width: 28px;
  height: 28px;
  z-index: 1;
}

.global-ai-helper-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  animation: globalAiPulse 2s infinite;
  opacity: 0.5;
}

@keyframes globalAiPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.1);
    opacity: 0;
  }
}

.global-ai-helper-panel {
  width: 380px;
  max-height: 600px;
  background: var(--color-bg-elevated, #ffffff);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: globalAiSlideInUp 0.3s ease;
}

[data-theme="dark"] .global-ai-helper-panel {
  background: #1a1a1a;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.global-ai-helper-panel.active {
  display: flex;
}

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

.global-ai-helper-header {
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #000000 0%, #333333 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

[data-theme="dark"] .global-ai-helper-header {
  background: linear-gradient(135deg, #ffffff 0%, #e6e6e6 100%);
  color: #000000;
}

.global-ai-helper-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.global-ai-helper-header h3 svg {
  animation: globalAiRotate 3s linear infinite;
}

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

.global-ai-helper-close {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.global-ai-helper-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

[data-theme="dark"] .global-ai-helper-close:hover {
  background: rgba(0, 0, 0, 0.2);
}

.global-ai-helper-body {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.global-ai-helper-body::-webkit-scrollbar {
  width: 6px;
}

.global-ai-helper-body::-webkit-scrollbar-track {
  background: transparent;
}

.global-ai-helper-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

[data-theme="dark"] .global-ai-helper-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.global-ai-suggestion {
  padding: 1rem;
  background: var(--color-bg-secondary, #f5f5f5);
  border-radius: 10px;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

[data-theme="dark"] .global-ai-suggestion {
  background: #2d2d2d;
}

.global-ai-suggestion:last-child {
  margin-bottom: 0;
}

.global-ai-suggestion:hover {
  border-color: #000000;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .global-ai-suggestion:hover {
  border-color: #ffffff;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

.global-ai-suggestion-title {
  font-weight: 600;
  color: var(--color-text, #000000);
  margin-bottom: 0.25rem;
  font-size: 0.9375rem;
}

[data-theme="dark"] .global-ai-suggestion-title {
  color: #ffffff;
}

.global-ai-suggestion-desc {
  font-size: 0.875rem;
  color: var(--color-text-secondary, #666666);
  line-height: 1.5;
}

[data-theme="dark"] .global-ai-suggestion-desc {
  color: #9ca3af;
}

.global-ai-helper-input {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border, #e0e0e0);
  display: flex;
  gap: 0.75rem;
}

[data-theme="dark"] .global-ai-helper-input {
  border-color: #333333;
}

.global-ai-helper-input input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--color-border, #e0e0e0);
  border-radius: 24px;
  font-size: 0.875rem;
  background: var(--color-bg, #ffffff);
  color: var(--color-text, #000000);
  transition: all 0.2s ease;
}

[data-theme="dark"] .global-ai-helper-input input {
  background: #0d0d0d;
  border-color: #333333;
  color: #ffffff;
}

.global-ai-helper-input input:focus {
  outline: none;
  border-color: #000000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .global-ai-helper-input input:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.global-ai-helper-input input::placeholder {
  color: var(--color-text-secondary, #999999);
}

.global-ai-helper-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #000000;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

[data-theme="dark"] .global-ai-helper-send {
  background: #ffffff;
  color: #000000;
}

.global-ai-helper-send:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .global-ai-helper-send:hover {
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
}

.global-ai-helper-send:active {
  transform: scale(0.95);
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */
@media (max-width: 768px) {
  .global-ai-helper-widget {
    bottom: 1rem;
    right: 1rem;
  }

  .global-ai-helper-button {
    width: 56px;
    height: 56px;
  }

  .global-ai-helper-button svg {
    width: 26px;
    height: 26px;
  }

  .global-ai-helper-panel {
    width: calc(100vw - 2rem);
    max-width: 360px;
    max-height: 500px;
  }

  .global-ai-helper-body {
    padding: 1rem;
  }

  .global-ai-helper-input {
    padding: 0.75rem 1rem;
  }
}

@media (max-width: 480px) {
  .global-ai-helper-widget {
    bottom: 0.75rem;
    right: 0.75rem;
  }

  .global-ai-helper-button {
    width: 52px;
    height: 52px;
  }

  .global-ai-helper-button svg {
    width: 24px;
    height: 24px;
  }

  .global-ai-helper-panel {
    width: calc(100vw - 1.5rem);
    max-height: 450px;
  }

  .global-ai-helper-header {
    padding: 1rem 1.25rem;
  }

  .global-ai-helper-header h3 {
    font-size: 1rem;
  }

  .global-ai-suggestion {
    padding: 0.875rem;
  }

  .global-ai-suggestion-title {
    font-size: 0.875rem;
  }

  .global-ai-suggestion-desc {
    font-size: 0.8125rem;
  }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  .global-ai-helper-button,
  .global-ai-helper-panel,
  .global-ai-suggestion,
  .global-ai-helper-close,
  .global-ai-helper-send {
    animation: none;
    transition: none;
  }

  .global-ai-helper-pulse {
    animation: none;
  }

  .global-ai-helper-header h3 svg {
    animation: none;
  }
}

/* Focus styles for keyboard navigation */
.global-ai-helper-button:focus,
.global-ai-helper-close:focus,
.global-ai-helper-send:focus,
.global-ai-helper-input input:focus {
  outline: 2px solid #000000;
  outline-offset: 2px;
}

[data-theme="dark"] .global-ai-helper-button:focus,
[data-theme="dark"] .global-ai-helper-close:focus,
[data-theme="dark"] .global-ai-helper-send:focus {
  outline-color: #ffffff;
}

.global-ai-suggestion:focus {
  outline: 2px solid #000000;
  outline-offset: -2px;
}

[data-theme="dark"] .global-ai-suggestion:focus {
  outline-color: #ffffff;
}
