:root { --brand:#0d6efd; --radius:14px; }
.page { min-height:120vh; padding:24px 16px; font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Arial; }

/* Floating button */
.chat-fab {
  position: fixed; right: 20px; bottom: 20px;
  width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand); color: #fff; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  z-index: 1000; border: 0;
}
.chat-fab:focus-visible { outline: 3px solid #a9d1ff; outline-offset: 2px; }

/* Floating button - New Tab Demo */
.chat-fab-tab {
  position: fixed; right: 35px; bottom: 150px;
  width: 90px; height: 90px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand); color: #fff; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  z-index: 1000; border: 0;
}
.chat-fab-tab:focus-visible { outline: 3px solid #a9d1ff; outline-offset: 2px; }
.chat-fab-tab img {
  width: 73px;
  height: 90px;
}

/* Overlay + modal */
.overlay {
  position: fixed; inset: 0; background: transparent;
  display: none; z-index: 999; pointer-events: none;
}
.overlay[aria-hidden="false"] { display: block; }

.modal {
  position: fixed; bottom: 20px; right: 20px; display: flex; justify-content: flex-end; align-items: flex-end;
  z-index: 1000; pointer-events: none; width: auto; height: auto;
}
.modal[aria-hidden="false"] { pointer-events: auto; }

.dialog {
  width: min(800px, calc(100vw - 40px)); height: min(1000px, calc(100vh - 40px));
  background: #fff; border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0,0,0,.28);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(16px); opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}
.modal[aria-hidden="false"] .dialog { transform: none; opacity: 1; }

/* Header */
.dialog__header {
  background: linear-gradient(135deg, #1a0033 0%, #330066 100%); color: #fff; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.dialog__title { 
  font: 600 16px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial; 
  display: flex;
  align-items: center;
}

.dialog__ai-icon {
  margin-right: 8px;
  font-size: 18px; /* Można dostosować rozmiar */
}

.dialog__controls {
  display: flex;
  align-items: center;
  gap: 8px; /* Odstęp między przyciskami */
}

.dialog__close,
.dialog__minimize,
.dialog__maximize {
  background: transparent; border: 0; color: #fff; cursor: pointer;
  font-size: 20px; line-height: 1; padding: 6px 8px; border-radius: 8px;
  margin-left: 0; /* Resetujemy indywidualne marginesy */
}

.dialog__close:focus-visible,
.dialog__minimize:focus-visible,
.dialog__maximize:focus-visible {
  outline: 3px solid #ffd27a;
  outline-offset: 2px;
}

/* Maximized state */
.modal.maximized {
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal.maximized .dialog {
  width: 100%;
  height: 100%;
}

/* Minimized state */
.modal.minimized .dialog {
  height: 50px;
  width: 300px;
  overflow: hidden;
}
.modal.minimized .dialog__content {
  display: none;
}

.modal.minimized .dialog__title {
  cursor: pointer;
}

/* Hide chat launcher when minimized - using class instead of CSS selector */
.chat-fab.hidden {
  display: none;
}

/* Content area */
.dialog__content { flex: 1; background: #f8f9fb; }

/* Basic responsive: full-bleed on very small screens */
@media (max-width: 768px) {
  .modal {
    position: fixed; inset: 0; display: flex;
    justify-content: center; align-items: center;
    padding: 10px; width: 100vw; height: 100vh;
  }
  .dialog { 
    width: calc(100vw - 20px); 
    height: calc(100vh - 20px); 
    border-radius: var(--radius); 
  }
}

@media (max-width: 480px) {
  .dialog { 
    width: 100vw; 
    height: 100vh; 
    border-radius: 0; 
  }
  .modal {
    padding: 0;
  }
}

/* Motion-reduction */
@media (prefers-reduced-motion: reduce) {
  .dialog { transition: none; }
}

/* Placeholder “loading” state for 3rd-party chat mount */
.mount {
  height: 100%; display: grid; place-items: center; color: #666;
  font: 500 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial;
}
