/* Titan — burbuja flotante (placeholder "proximamente").
   Sin dependencias: no usa bootstrap ni jQuery. */

.titan {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: inherit;
}

.titan-fab {
    width: 58px;
    height: 58px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #510e7c 0%, #38095a 100%);
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(56, 9, 90, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 200ms ease, box-shadow 200ms ease;
}

.titan-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 9px 24px rgba(56, 9, 90, 0.5);
}

.titan-fab:active {
    transform: scale(0.94);
}

.titan-fab:focus-visible {
    outline: 3px solid #17d1e0;
    outline-offset: 3px;
}

.titan-fab__icon--close {
    display: none;
}

.titan-fab[aria-expanded="true"] .titan-fab__icon--sparkle {
    display: none;
}

.titan-fab[aria-expanded="true"] .titan-fab__icon--close {
    display: block;
}

.titan-panel {
    width: 340px;
    max-width: calc(100vw - 40px);
    margin-bottom: 14px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 14px 40px rgba(20, 8, 40, 0.3);
    overflow: hidden;
    animation: titan-panel-in 220ms ease-out;
}

.titan-panel[hidden] {
    display: none;
}

.titan-panel__header {
    display: flex;
    align-items: center;
    padding: 14px 12px 14px 14px;
    background: linear-gradient(135deg, #510e7c 0%, #38095a 100%);
    color: #ffffff;
}

.titan-panel__avatar {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    margin-right: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #17d1e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.titan-panel__identity {
    flex: 1 1 auto;
    min-width: 0;
}

.titan-panel__name {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
}

.titan-panel__subtitle {
    margin: 2px 0 0;
    font-size: 12px;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.75);
}

.titan-panel__close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.titan-panel__close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.titan-lead-form {
    padding: 16px 16px 8px;
}

.titan-field {
    margin-bottom: 12px;
}

.titan-field input[type="text"],
.titan-field input[type="email"] {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1px solid #dcdce6;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
}

.titan-field input[type="text"]:focus,
.titan-field input[type="email"]:focus {
    outline: 2px solid #17d1e0;
    outline-offset: 1px;
}

.titan-field--checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.titan-field--checkbox input {
    margin-top: 3px;
    flex: 0 0 auto;
}

.titan-field--checkbox span {
    font-size: 12px;
    line-height: 1.4;
    color: #5a5a6b;
}

.titan-field--checkbox a {
    color: #510e7c;
}

.titan-submit {
    width: 100%;
    padding: 10px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #510e7c 0%, #38095a 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.titan-submit:disabled {
    opacity: 0.6;
    cursor: default;
}

.titan-error {
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #fdeceb;
    color: #b3261e;
    font-size: 12px;
    line-height: 1.4;
}

.titan-chat {
    display: flex;
    flex-direction: column;
    padding: 12px 14px 0;
}

.titan-chat[hidden] {
    display: none;
}

.titan-messages {
    max-height: 280px;
    min-height: 80px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 6px;
}

.titan-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.titan-msg--user {
    align-self: flex-end;
    background: #510e7c;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.titan-msg--assistant {
    align-self: flex-start;
    background: #f2f0f6;
    color: #333340;
    border-bottom-left-radius: 4px;
}

.titan-msg--loading {
    min-width: 40px;
    color: #9a9aa8;
}

.titan-msg--loading::after {
    content: '\2026';
    animation: titan-loading-pulse 1.2s ease-in-out infinite;
}

.titan-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 0 12px;
}

.titan-input-row textarea {
    flex: 1 1 auto;
    resize: none;
    min-height: 36px;
    max-height: 96px;
    padding: 8px 10px;
    border: 1px solid #ececf2;
    border-radius: 14px;
    font-family: inherit;
    font-size: 14px;
}

.titan-send {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #510e7c;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.titan-send:disabled {
    opacity: 0.5;
    cursor: default;
}

.titan-panel__disclaimer {
    margin: 0;
    padding: 10px 16px 14px;
    border-top: 1px solid #ececf2;
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
    color: #9a9aa8;
}

@keyframes titan-loading-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

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

@media (max-width: 480px) {
    .titan {
        right: 14px;
        bottom: 14px;
    }

    .titan-fab {
        width: 52px;
        height: 52px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .titan-fab,
    .titan-panel {
        transition: none;
        animation: none;
    }
}
