/* Zmienne CSS określające motyw (Theme) */
:root {
  --oze-primary: #0ca678;     /* Zgaszony elegancki ekologiczny zielony */
  --oze-accent: #20c997;
  --oze-bg: #f8f9fa;
  --oze-text: #212529;
  --oze-shadow: 0 10px 30px rgba(0,0,0,0.1);
  --oze-border: #e9ecef;
  
  --oze-bot-msg: #e9ecef;
  --oze-user-msg: var(--oze-primary);
  --oze-user-text: #ffffff;
}

/* Przycisk aktywacji (Floating Action Button) - podłużny, luksusowy "pill" */
#oze-chat-trigger {
  position: fixed;
  bottom: 95px;                /* Przeniesiony wyżej, aby uniknąć nakładania na reCAPTCHA */
  right: 25px;
  padding: 0 20px;
  height: 54px;
  background: linear-gradient(135deg, var(--oze-primary) 0%, var(--oze-accent) 100%);
  border-radius: 27px;
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(12, 166, 120, 0.4);
  cursor: pointer;
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
}

#oze-chat-trigger:hover {
  transform: scale(1.05);
}

#oze-chat-trigger svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.oze-trigger-text {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* Panel Chatu */
#oze-chat-window {
  position: fixed;
  bottom: 160px;               /* Przesunięty wyżej (11px nad przyciskiem aktywacji) */
  right: 25px;
  width: 380px;
  height: 600px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 20px;
  box-shadow: var(--oze-shadow);
  display: none;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

#oze-chat-window.oze-open {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* Nagłówek */
.oze-chat-header {
  background: linear-gradient(135deg, var(--oze-primary) 0%, var(--oze-accent) 100%);
  color: white;
  padding: 20px;
  display: flex;
  flex-direction: column;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  position: relative;
}

.oze-chat-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.oze-chat-header p {
  margin: 5px 0 0;
  font-size: 0.8rem;
  opacity: 0.85;
}

.oze-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.oze-close-btn:hover {
  opacity: 1;
}

/* Obszar Wiadomości */
.oze-chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: var(--oze-bg);
  scroll-behavior: smooth;
}

.oze-message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 15px;
  font-size: 0.95rem;
  line-height: 1.4;
  animation: ozeFadeIn 0.3s ease;
  word-wrap: break-word;
}

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

.oze-bot {
  background: var(--oze-bot-msg);
  color: var(--oze-text);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.oze-user {
  background: var(--oze-user-msg);
  color: var(--oze-user-text);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Preloader "Pisania..." */
.oze-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
  background: var(--oze-bot-msg);
  border-radius: 15px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: auto;
}

.oze-typing-dot {
  width: 6px;
  height: 6px;
  background: #6c757d;
  border-radius: 50%;
  animation: ozeBounce 1.4s infinite ease-in-out both;
}

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

@keyframes ozeBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Sekcja Wprowadzania */
.oze-chat-input-area {
  padding: 12px 15px;
  background: white;
  border-top: 1px solid var(--oze-border);
  display: flex;
  align-items: flex-end; /* Align items to the bottom of the input container */
  gap: 8px;
}

.oze-chat-input {
  flex: 1;
  border: 1px solid var(--oze-border);
  border-radius: 18px; /* Balanced border radius for multi-line display */
  padding: 10px 14px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
  height: 40px; /* Base initial height */
  max-height: 120px;
  font-family: inherit;
  line-height: 1.4;
  box-sizing: border-box;
  overflow-y: hidden; /* Hide scrollbars until max-height is reached */
}

.oze-chat-input:focus {
  border-color: var(--oze-primary);
}

.oze-btn {
  background: var(--oze-primary);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.oze-btn:hover {
  background: var(--oze-accent);
}

.oze-btn:active {
  transform: scale(0.95);
}

/* Wcisniety mikrofon (Voicebot active) */
.oze-btn.oze-recording {
  background: #e03131;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(224, 49, 49, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(224, 49, 49, 0); }
  100% { box-shadow: 0 0 0 0 rgba(224, 49, 49, 0); }
}

/* Responsywność dla małych ekranów (smartfony) */
@media (max-width: 480px) {
  #oze-chat-trigger {
    width: 54px;
    height: 54px;
    padding: 0;
    border-radius: 50%;
  }
  .oze-trigger-text {
    display: none;             /* Ukryj tekst na telefonach dla oszczędności miejsca */
  }
  #oze-chat-window {
    bottom: 160px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    height: calc(100vh - 180px);
  }
}

