/* CHANGE: Widget CSS styles extracted from main widget file */

:host {
  all: initial;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ========================================
   WIDGET ALAPSTÍLUSOK
   ======================================== */

.nexa-widget {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  z-index: 1000;
  animation: widgetFadeIn 0.3s ease-in-out;
}

/* Widget animációk */
@keyframes widgetFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

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

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Desktop (alapértelmezett) */
.nexa-widget {
  width: 400px;
  height: 500px;
  position: fixed;
  bottom: 2rem;
  right: 1rem;
  z-index: 9999;
  margin-bottom: 60px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease-in-out;
}

.nexa-widget.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .nexa-widget {
    width: 350px;
    height: 450px;
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 50;
  }
}

/* Mobil eszközök (768px alatt) */
@media (max-width: 767px) {
  .nexa-widget {
    width: 100vw !important;
    height: 100vh !important;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: 9999;
    margin: 0;
    border-radius: 0;
  }
}

/* iPhone-specifikus CSS javítások */
@supports (padding: max(0px)) {
  .nexa-widget {
    padding-left: max(env(safe-area-inset-left), 0px);
    padding-right: max(env(safe-area-inset-right), 0px);
    padding-top: max(env(safe-area-inset-top), 0px);
    padding-bottom: max(env(safe-area-inset-bottom), 0px);
  }
}

/* ========================================
   FLOATING ACTION BUTTONS
   ======================================== */

.chat-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #089ef6 0%, #05479b 80%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
}

.chat-fab.minimized {
  width: 56px;
  height: 56px;
}

.chat-fab.maximized {
  width: 48px;
  height: 48px;
}

.chat-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.chat-fab:active {
  transform: scale(0.95);
}

.chat-fab .ping-halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(8, 158, 246, 0.4);
  animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.chat-fab .icon {
  width: 24px;
  height: 24px;
  position: relative;
  z-index: 10;
}

/* ========================================
   WIDGET HEADER
   ======================================== */

.widget-header {
  background: linear-gradient(135deg, #089ef6 0%, #05479b 80%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.widget-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.mode-switcher {
  display: flex;
  gap: 8px;
}

.mode-button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.mode-button.active {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

.mode-button:hover:not(.active) {
  background: rgba(255, 255, 255, 0.1);
}

.mode-button .icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* ========================================
   TRANSCRIPT AREA
   ======================================== */

.transcript-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.transcript-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Scrollbar stílusok */
.transcript-content::-webkit-scrollbar {
  width: 6px;
}

.transcript-content::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

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

.transcript-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ========================================
   MESSAGE BUBBLES
   ======================================== */

.message-container {
  display: flex;
  margin: 4px 0;
}

.message-container.user {
  justify-content: flex-end;
}

.message-container.assistant {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  word-wrap: break-word;
  position: relative;
}

.message-bubble.user {
  background: #3b82f6;
  color: white;
  margin-left: auto;
}

.message-bubble.assistant {
  background: #f1f5f9;
  color: #1e293b;
  margin-right: auto;
  border: 1px solid #e2e8f0;
}

.message-timestamp {
  font-size: 11px;
  opacity: 0.7;
  margin-bottom: 4px;
}

.message-content {
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}

/* ========================================
   STATUS MESSAGES
   ======================================== */

.status-message {
  display: flex;
  justify-content: center;
  margin: 8px 0;
}

.status-bubble {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.status-bubble.info {
  background: #dbeafe;
  color: #1e40af;
}

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

.status-bubble.error {
  background: #fee2e2;
  color: #dc2626;
}

/* ========================================
   INPUT AREA
   ======================================== */

.input-container {
  display: flex;
  align-items: center;
  background: white;
  padding: 16px;
  gap: 8px;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.input-field {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  padding: 12px 16px;
  background: transparent;
  color: #374151;
}

.input-field:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.input-field::placeholder {
  color: #9ca3af;
}

.send-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #089ef6 0%, #05479b 80%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.2s ease;
  min-width: 44px;
  min-height: 44px;
  touch-action: manipulation;
}

.send-button:hover:not(:disabled) {
  transform: scale(1.05);
}

.send-button:active:not(:disabled) {
  transform: scale(0.95);
}

.send-button:disabled {
  background: #9ca3af;
  opacity: 0.5;
  cursor: not-allowed;
}

.send-button .icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* ========================================
   LOADING STATES
   ======================================== */

.loading-message {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #f1f5f9;
  border-radius: 18px;
  color: #64748b;
  font-size: 14px;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e2e8f0;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ========================================
   TOUCH INTERFACE
   ======================================== */

/* iPhone touch target méretezés */
button:not([data-chat-fab]) {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
}

/* iPhone keyboard overlap kezelése */
input, textarea {
  font-size: 16px;
}

/* ========================================
   BACKDROP
   ======================================== */

.backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.backdrop.show {
  opacity: 1;
  visibility: visible;
}

/* ========================================
   MOBILE SPECIFIC
   ======================================== */

@media (max-width: 767px) {
  .chat-fab {
    bottom: 20px;
    right: 20px;
  }
  
  .widget-header {
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
  }
  
  .input-container {
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}

