/* =============================================
   SynergIA Bot - Afanion
   Desarrollado por Synergy Internet S.L.
   https://www.synergyweb.es/
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Lato:wght@400;700&display=swap');

:root {
    --primary:        #D92A89;   /* Coral/magenta Afanion – botones opciones */
    --primary-dark:   #b51e6f;
    --primary-light:  #fce4f2;
    --primary-xlight: #fff5fb;
    --header-bg:      #223A90;   /* Azul oscuro Afanion – cabecera */
    --header-dark:    #182b6e;
    --user-bubble:    #223A90;   /* Azul oscuro – burbujas usuario */
    --user-text:      #ffffff;
    --accent:         #f7a828;   /* Amarillo cálido del logo */
    --text-dark:      #2b2b2b;
    --text-mid:       #555;
    --text-soft:      #888;
    --bg-chat:        #f8f6fa;
    --bot-bubble:     #ffffff;
    --border-color:   #e8dff0;
    --shadow-card:    0 8px 32px rgba(34, 58, 144, 0.13), 0 2px 8px rgba(0,0,0,0.07);
    --shadow-btn:     0 2px 8px rgba(217, 42, 137, 0.22);
    --radius-chat:    20px;
    --radius-bubble:  18px;
    --radius-btn:     50px;
    --font-main:      'Nunito', 'Segoe UI', sans-serif;
    --font-body:      'Lato', 'Segoe UI', sans-serif;
    --header-height:  68px;
    --footer-height:  36px;
}

/* ── Contenedor principal ─────────────────── */
.afanion-bot-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.afanion-bot-container {
    width: 100%;
    max-width: 420px;
    height: 680px;
    background-color: var(--bg-chat);
    border-radius: var(--radius-chat);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--font-main);
    border: 1.5px solid var(--border-color);
    position: relative;
}

/* Móvil: ocupa casi toda la pantalla */
@media (max-width: 600px) {
    .afanion-bot-container {
        max-width: 100%;
        width: 100%;
        height: 100dvh;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }
}

/* ── Cabecera ─────────────────────────────── */
.bot-header {
    background: linear-gradient(135deg, var(--header-bg) 0%, var(--header-dark) 100%);
    color: #fff;
    padding: 0 18px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.bot-header::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 90px;
    height: 90px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
}

.bot-header-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.3);
    overflow: hidden;
    padding: 3px;
}

.bot-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.bot-header-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.bot-header-title {
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 1em;
    letter-spacing: 0.01em;
}

.bot-header-sub {
    font-size: 0.73em;
    opacity: 0.82;
    font-weight: 400;
}

.bot-header-dot {
    width: 9px;
    height: 9px;
    background: #4ddb8b;
    border-radius: 50%;
    margin-left: auto;
    box-shadow: 0 0 0 2px rgba(77,219,139,0.3);
    flex-shrink: 0;
    animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 2px rgba(77,219,139,0.3); }
    50%       { box-shadow: 0 0 0 5px rgba(77,219,139,0.15); }
}

/* ── Área de mensajes ─────────────────────── */
.chat-messages {
    flex: 1;
    padding: 18px 16px 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Burbujas */
.message {
    max-width: 84%;
    padding: 11px 15px;
    border-radius: var(--radius-bubble);
    font-size: 0.92em;
    line-height: 1.5;
    font-family: var(--font-body);
    animation: msg-in 0.28s cubic-bezier(.22,.68,0,1.2) both;
    word-break: break-word;
}

@keyframes msg-in {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bot-message {
    background: var(--bot-bubble);
    color: var(--text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.user-message {
    background: var(--user-bubble);
    color: var(--user-text);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    font-weight: 600;
}

/* ── Área de opciones ─────────────────────── */
.options-container {
    padding: 12px 14px 10px;
    background: #fff;
    border-top: 1.5px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex-shrink: 0;
    max-height: 320px;
    overflow-y: auto;
}

@media (min-width: 820px) {
    .options-container { max-height: 360px; }
    .afanion-bot-container { max-width: 480px; }
}

.option-btn {
    background: #fff;
    border: 1.5px solid var(--primary);
    color: var(--primary);
    padding: 9px 15px;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: background 0.18s, color 0.18s, transform 0.12s, box-shadow 0.18s;
    font-size: 0.875em;
    font-family: var(--font-main);
    font-weight: 700;
    text-align: left;
    line-height: 1.35;
}

.option-btn:hover,
.option-btn:focus-visible {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-btn);
    transform: translateY(-1px);
    outline: none;
}

.option-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Botones "Volver" */
.option-btn.restart {
    border-color: #ccc;
    color: var(--text-soft);
    font-weight: 600;
}
.option-btn.restart:hover,
.option-btn.restart:focus-visible {
    background: #666;
    border-color: #666;
    color: #fff;
}

/* ── Footer créditos ──────────────────────── */
.bot-footer {
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-top: 1px solid var(--border-color);
    font-size: 0.72em;
    color: var(--text-soft);
    font-family: var(--font-body);
    gap: 3px;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

.bot-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.15s;
}
.bot-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ── Scrollbar ────────────────────────────── */
.chat-messages::-webkit-scrollbar,
.options-container::-webkit-scrollbar {
    width: 5px;
}
.chat-messages::-webkit-scrollbar-thumb,
.options-container::-webkit-scrollbar-thumb {
    background: #e0c8cc;
    border-radius: 4px;
}

/* ── Typing indicator ─────────────────────── */
.typing-indicator {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 10px 14px;
    background: var(--bot-bubble);
    border-radius: var(--radius-bubble);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    animation: msg-in 0.25s ease both;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: var(--header-bg);
    border-radius: 50%;
    opacity: 0.5;
    animation: bounce-dot 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce-dot {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* ── Formulario de contacto inline ───────── */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.contact-intro {
    font-size: 0.83em;
    color: var(--text-mid);
    font-family: var(--font-body);
    margin-bottom: 2px;
}
.contact-input {
    padding: 9px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.87em;
    font-family: var(--font-body);
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    background: #fff;
}
.contact-input:focus { border-color: var(--header-bg); }
.contact-input[rows] { resize: vertical; min-height: 70px; }

.contact-lopd {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 6px 0 2px;
  font-size: .78rem;
  color: var(--gray-text);
  line-height: 1.4;
  cursor: pointer;
}
.contact-lopd input[type="checkbox"] {
  margin-top: 2px;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--primary);
}
.contact-lopd a {
  color: var(--primary);
  text-decoration: underline;
}
.contact-lopd a:hover { opacity: .8; }
.contact-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 2px;
}
