/* ESTILOS DEL COMPONENTE EMILY CHATBOT */
:root {
    --emily-bg: #FFFFFF;
    --emily-header: #1A2C5B;
    --emily-bubble-emily: #F1F5F9;
    --emily-bubble-user: #1A2C5B;
    --emily-text-emily: #1E293B;
    --emily-text-user: #FFFFFF;
    --emily-text-secondary: #94A3B8;
    --emily-accent: #F5A623;
    --emily-border: #E2E8F0;
    --emily-shadow: 0 4px 24px rgba(0,0,0,0.12);
    --emily-radius: 16px;
}

#emily-chatbot-app {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
    line-height: 1.5;
    height: 100%;
    width: 100%;
}

#emily-chatbot-app * {
    box-sizing: inherit;
}

/* MODO EMBEBIDO (ADAPTADO PARA MOCKUP) */
.emily-mode-embedded {
    width: 100%;
    height: 100%;
    background: var(--emily-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    /* Eliminamos bordes, sombras y min/max heights fijos para que el mockup controle el contenedor */
}

/* MODO WIDGET (FLOTANTE) */
.emily-mode-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.emily-widget-bubble {
    width: 60px;
    height: 60px;
    background-color: var(--emily-header);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--emily-shadow);
    cursor: pointer;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.emily-widget-bubble:hover {
    transform: scale(1.05);
}

.emily-widget-bubble-icon {
    color: var(--emily-accent);
    font-weight: 700;
    font-size: 28px;
}

.emily-widget-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--emily-accent);
    color: var(--emily-header);
    font-size: 12px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #FFFFFF;
}

.emily-widget-tooltip {
    position: absolute;
    right: 75px;
    background: var(--emily-bg);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    font-size: 14px;
    font-weight: 500;
    color: var(--emily-text-emily);
    white-space: nowrap;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.5s;
}

.emily-widget-tooltip.fade-out {
    opacity: 0;
}

.emily-widget-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent transparent var(--emily-bg);
}

.emily-mode-widget {
    width: 380px;
    height: 550px;
    background: var(--emily-bg);
    border-radius: var(--emily-radius);
    box-shadow: var(--emily-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 80px;
    right: 0;
    transform-origin: bottom right;
    transform: scale(0);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
    pointer-events: none;
}

.emily-mode-widget.open {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* HEADER */
.emily-header {
    background: var(--emily-header);
    color: #FFFFFF;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    /* Ajuste para el mockup, dar espacio superior para el notch */
    padding-top: 24px;
}

.emily-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.emily-avatar {
    width: 48px;
    height: 48px;
    background: #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--emily-header);
    font-weight: 700;
    font-size: 14px;
    border: 2px solid var(--emily-accent);
    overflow: hidden;
}

.emily-header-text {
    display: flex;
    flex-direction: column;
}

.emily-name {
    font-weight: 600;
    font-size: 15px;
}

.emily-role {
    font-size: 12px;
    color: #CBD5E1;
}

.emily-demo-badge {
    background: rgba(245, 166, 35, 0.2);
    color: var(--emily-accent);
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    letter-spacing: 0.5px;
}

.emily-close-btn {
    background: transparent;
    border: none;
    color: #FFFFFF;
    cursor: pointer;
    padding: 4px;
    display: none;
}

.emily-mode-widget .emily-close-btn {
    display: block;
}

/* CHAT BODY */
.emily-body {
    flex: 1;
    padding: 16px;
    padding-right: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--emily-bg);
    scroll-behavior: smooth;
}

.emily-body::-webkit-scrollbar {
    width: 4px;
}

.emily-body::-webkit-scrollbar-track {
    background: transparent;
}

.emily-body::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}

/* MESSAGES */
.emily-message-row {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.emily-message-emily {
    align-items: flex-start;
}

.emily-message-user {
    align-items: flex-end;
}

.emily-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    animation: fadeIn 0.4s ease-out;
    white-space: pre-line;
    word-wrap: break-word;
}

.emily-bubble-emily {
    background: var(--emily-bubble-emily);
    color: var(--emily-text-emily);
    border-bottom-left-radius: 4px;
}

.emily-bubble-user {
    background: var(--emily-bubble-user);
    color: var(--emily-text-user);
    border-bottom-right-radius: 4px;
}

/* TYPING INDICATOR */
.emily-typing {
    background: var(--emily-bubble-emily);
    padding: 10px 14px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
    width: fit-content;
}

.emily-dot {
    width: 6px;
    height: 6px;
    background: var(--emily-text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

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

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

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

/* OPTIONS */
.emily-options-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
    align-items: stretch;
    animation: fadeIn 0.4s ease-out;
    width: fit-content;
    max-width: 90%;
    margin-left: auto;
}

.emily-option-btn {
    background: #FFFFFF;
    border: 1px solid var(--emily-header);
    color: var(--emily-header);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    max-width: 100%;
    word-break: break-word;
    font-family: inherit;
}

.emily-option-btn:hover {
    background: var(--emily-accent);
    border-color: var(--emily-accent);
}

/* CTA BUTTONS */
.emily-cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px 0;
    width: 100%;
}

.emily-cta-primary {
    background: var(--emily-accent);
    color: var(--emily-header);
    border: none;
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s;
}

.emily-cta-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 166, 35, 0.3);
}

/* FOOTER */
.emily-footer {
    background: var(--emily-bg);
    padding: 12px;
    text-align: center;
    border-top: 1px solid var(--emily-border);
    font-size: 11px;
    color: var(--emily-text-secondary);
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

/* MODAL RESERVA */
.emily-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(17, 29, 61, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.emily-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.emily-modal-content {
    background: #FFFFFF;
    width: 90%;
    max-width: 800px;
    height: 90vh;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    margin: auto;
}

.emily-modal-overlay.open .emily-modal-content {
    transform: scale(1);
}

.emily-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #F3F4F6;
    color: #1F2937;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.emily-modal-close:hover {
    background: #E5E7EB;
}

.emily-modal-header {
    background: #1A2C5B;
    color: #FFFFFF;
    padding: 24px;
    text-align: center;
    flex-shrink: 0;
}

.emily-modal-header h3 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.emily-modal-body {
    flex-grow: 1;
    overflow: hidden;
    background: #F9FAFB;
    padding: 16px;
}

.emily-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

@media (min-width: 768px) {
    .emily-modal-content {
        height: 80vh;
    }
}
