/* style.css */

:root {
    --google-blue: #4285F4;
    --google-yellow: #FBBC05;
    --background-light: #F8F9FA;
    --border-color: #E0E0E0;
    --text-dark: #202124;
    --text-light: #5f6368;
    --font-family: 'Roboto', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: #e9e9e9;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

#chat-container {
    width: 400px;
    height: 600px;
    max-width: 400px;
    max-height: 600px;
    background-color: var(--background-light);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#chat-header {
    background-color: #fff;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.header-avatar {
    width: 40px;       /* Dokładnie taki rozmiar, jak chciałeś */
    height: 40px;
    margin-right: 15px;  /* Utrzymuje odstęp od tekstu */
    object-fit: cover; /* Gwarantuje, że obrazek dobrze się wpasuje */
}

#chat-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
    color: var(--text-dark);
}

#chat-header p {
    margin: 0;
    font-size: 17px;
    color: #1e8e3e; /* Zielony "online" */
}

#chat-messages {
    flex: 1; /* Pozwala elastycznie rosnąć i kurczyć się */
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 20px;
    margin-bottom: 10px;
    line-height: 1.4;
    font-size: 18px;
}

.user-message {
    background-color: var(--google-blue);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.bot-message {
    background-color: #fff;
    color: var(--text-dark);
    align-self: flex-start;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 5px;
}

#chat-input-container {
    display: flex;
    padding: 5px 10px;
    border-top: 1px solid var(--border-color);
    background-color: #fff;
    flex-shrink: 0; /* Zapobiega kurczeniu się tego elementu */
}

#chat-input {
    flex-grow: 1;
    border: none;
    outline: none;
    padding: 10px;
    font-size: 18px;
    background: transparent;
}

#send-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-btn:hover {
    background-color: #f1f3f4;
}

#send-btn svg {
    fill: var(--google-blue);
}

/* Style dla wskaźnika pisania "..." */
.typing-indicator {
    padding: 15px;
    display: flex;
    align-items: center;
}
.typing-indicator span {
    height: 10px;
    width: 10px;
    background-color: #9E9E9E;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bob 1s infinite;
}
.typing-indicator span:nth-of-type(2) {
    animation-delay: 0.2s;
}
.typing-indicator span:nth-of-type(3) {
    animation-delay: 0.4s;
}
@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Zmiany dla responsywności i lepszego dopasowania */
#chat-container {
    width: 100%; /* Zmieniamy z fixed na 100% */
    height: 100%;
    max-width: 400px; /* Dodajemy max-width */
    max-height: 600px; /* Dodajemy max-height */
    border-radius: 16px;
    /* ... reszta stylów bez zmian ... */
}

/* ========================================================= */
/* === STYLE DLA URZĄDZEŃ MOBILNYCH I MAŁYCH TABLETÓW === */
/* ========================================================= */
@media (max-width: 768px) { /* <-- JEDYNA ZMIANA JEST TUTAJ */
    /* Upewniamy się, że body nie ma zbędnych marginesów */
    body {
        padding: 0;
        margin: 0;
    }

    /* Główne okno czatu ma zajmować CAŁY EKRAN */
    #chat-container {
        width: 100%;
        height: 100%; /* Używamy 100% zamiast vh dla lepszej kompatybilności */
        position: fixed;
        top: 0;
        left: 0;
        border-radius: 0;
        box-shadow: none;
        max-width: none;
        max-height: none;
        /* WAŻNE: Dodajemy padding na dole, aby system (np. iOS) nie zakrył nam pola do wpisywania */
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Dostosowujemy nagłówek do pełnego ekranu */
    #chat-header {
        border-radius: 0;
    }
}

/* ========================================================= */
/* === PRZYWRÓCENIE ORYGINALNYCH FONTÓW DLA MNIEJSZYCH EKRANÓW === */
/* ========================================================= */

/* Ta reguła aktywuje się, gdy szerokość ekranu 
   jest mniejsza niż 600 pikseli */
@media (max-width: 599px) {

  /* Przywracamy oryginalny rozmiar fontu w nagłówku */
  #chat-header h2 {
    font-size: 16px; 
  }

  /* Przywracamy oryginalny rozmiar fontu statusu "Online" */
  #chat-header p {
    font-size: 12px;
  }

  /* Przywracamy oryginalny rozmiar fontu w dymkach wiadomości */
  .message {
    font-size: 14px;
  }

  /* Przywracamy oryginalny rozmiar fontu w polu do wpisywania */
  #chat-input {
    font-size: 14px;
  }
}