/* Explain: Styles for the chat assistant widget and panel. */
/* ===== Βοηθός Pleasure — πλωτός βοηθός συνομιλίας (chat) σε όλες τις σελίδες ===== */

.chat-launcher {
    position: fixed;
    z-index: 100;
    right: 1rem;
    bottom: 5.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border: 0;
    border-radius: 999px;
    background: var(--footer-bg);
    color: var(--accent-color);
    box-shadow: 0 18px 40px rgba(16, 38, 58, 0.34);
    transition: transform 250ms ease, background 250ms ease, color 250ms ease, box-shadow 250ms ease;
}

.chat-launcher:hover {
    background: var(--primary-color);
    color: #f4cd97;
    transform: translateY(-2px);
    box-shadow: 0 22px 46px rgba(16, 38, 58, 0.4);
}

.chat-launcher i {
    font-size: 1.4rem;
}

.chat-launcher::after {
    content: "";
    position: absolute;
    top: -2px;
    right: -2px;
    width: 0.85rem;
    height: 0.85rem;
    border: 2px solid var(--background-color);
    border-radius: 999px;
    background: #35c07a;
}

.chat-panel {
    position: fixed;
    z-index: 100;
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: var(--background-color);
    color: var(--text-color);
    box-shadow: 0 30px 80px rgba(16, 38, 58, 0.35);
}

.chat-panel.is-open {
    display: flex;
}

.chat-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    background: linear-gradient(135deg, var(--footer-bg), var(--primary-color));
    color: #ffffff;
}

.chat-header-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: var(--accent-color);
}

.chat-header-text {
    flex: 1;
    min-width: 0;
}

.chat-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.chat-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    opacity: 0.85;
}

.chat-close {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    transition: background 200ms ease;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.26);
}

.chat-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.7rem;
    overflow-y: auto;
    padding: 1.1rem;
}

.chat-msg {
    display: flex;
}

.chat-msg-user {
    justify-content: flex-end;
}

.chat-msg-bot {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 85%;
    padding: 0.7rem 0.95rem;
    border-radius: 1.1rem;
    font-size: 0.9rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.chat-msg-bot .chat-bubble {
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 0.35rem;
    background: var(--surface-color);
    color: var(--text-color);
}

.chat-msg-user .chat-bubble {
    border-bottom-right-radius: 0.35rem;
    background: var(--primary-color);
    color: #ffffff;
}

.chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.chat-typing span {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: var(--text-muted);
    animation: chatBlink 1.2s infinite ease-in-out;
}

.chat-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chatBlink {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-2px); }
}

.chat-quick {
    display: flex;
    flex: 0 0 auto;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.65rem 1.1rem 0;
    scrollbar-width: none;
}

.chat-quick::-webkit-scrollbar {
    display: none;
}

.chat-quick-chip {
    flex: 0 0 auto;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    padding: 0.5rem 0.9rem;
    color: var(--text-color);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    transition: border-color 200ms ease, color 200ms ease;
}

.chat-quick-chip:hover {
    border-color: var(--accent-color);
    color: var(--accent-hover);
}

.chat-form {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.1rem 0.6rem;
}

.chat-input {
    flex: 1;
    min-height: 2.9rem;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: var(--field-bg);
    padding: 0.5rem 1.1rem;
    color: var(--text-color);
    font-size: 0.9rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-send {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.9rem;
    height: 2.9rem;
    border: 0;
    border-radius: 999px;
    background: var(--accent-color);
    color: #10263a;
    transition: background 200ms ease;
}

.chat-send:hover {
    background: var(--accent-hover);
}

.chat-send:disabled {
    opacity: 0.55;
    cursor: default;
}

.chat-book-link {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0 1.1rem 1rem;
    min-height: 2.9rem;
    border-radius: 999px;
    background: var(--primary-color);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 200ms ease;
}

.chat-book-link:hover {
    background: var(--primary-hover);
}

@media (max-width: 767px) {
    .chat-panel {
        inset: 0;
    }
}

@media (min-width: 768px) {
    .chat-launcher {
        right: 1.25rem;
        bottom: 1.5rem;
    }

    .chat-panel {
        right: 1.25rem;
        bottom: 5.75rem;
        width: 23rem;
        max-width: calc(100vw - 2.5rem);
        height: min(72dvh, 40rem);
        border: 1px solid var(--glass-border);
        border-radius: 1.6rem;
    }
}

/* Ο βοηθός παραμένει πάνω από κάθε στοιχείο της σελίδας και ανταποκρίνεται καλύτερα στο άγγιγμα */
.chat-widget {
    position: relative;
    z-index: 120;
}

.chat-launcher,
.chat-close,
.chat-send,
.chat-quick-chip {
    touch-action: manipulation;
}

@media (max-width: 767px) {
    .chat-launcher {
        bottom: calc(5.5rem + env(safe-area-inset-bottom));
    }
}