/* ============================================
                    .i.
   ============================================ */

#smars-chat {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    max-width: 500px;
    height: 700px;
    margin: 0 auto;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    background-color: #ffffff;
    position: relative;
}

.chat-header {
    background: linear-gradient(135deg, #19199f, #ffbb32);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.chat-header p {
    margin: 8px 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.btn-reset {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.btn-reset:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: #ffffff;
}

.pregunta-usuario {
    align-self: flex-end;
    background: #ffbb32;
    color: white;
    border-radius: 18px 18px 0 18px;
    padding: 12px 16px;
    max-width: 80%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

.respuesta-detallada {
    align-self: flex-start;
    background: #19199f;
    color: #ffbb32;
    border-radius: 18px 18px 18px 0;
    padding: 12px 16px;
    max-width: 80%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

.respuesta-detallada p {
    margin: 0.5em 0;
}

.respuesta-detallada a {
    color: #6e8efb;
    text-decoration: none;
}

.respuesta-detallada a:hover {
    text-decoration: underline;
}

.respuesta-detallada code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.respuesta-detallada pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
}

.respuesta-detallada pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.typing {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #ffbb32;
    border-radius: 18px;
    align-self: flex-start;
    margin-top: 5px;
}

.dot {
    width: 8px;
    height: 8px;
    background: #a777e3;
    border-radius: 50%;
    margin: 0 3px;
    opacity: 0.6;
    animation: pulse 1.5s infinite ease-in-out;
}

.dot:nth-child(2) {
    animation-delay: 0.5s;
}

.dot:nth-child(3) {
    animation-delay: 1s;
}

.error-chat {
    align-self: center;
    background: #ffebee;
    color: #c62828;
    border-radius: 8px;
    padding: 10px 15px;
    margin: 10px 0;
    max-width: 90%;
    text-align: center;
    animation: shake 0.5s ease;
}

.chat-input-container {
    display: flex;
    padding: 15px;
    background: #fff;
    border-top: 1px solid #ffbb32;
}

#consulta-usuario {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #000000;
    border-radius: 24px;
    outline: none;
    font-size: 1rem;
    transition: border-color 0.3s;
}

#consulta-usuario:focus {
    border-color: #a777e3;
    box-shadow: 0 0 0 2px rgba(167, 119, 227, 0.2);
}

#enviar-consulta {
    background: #19199f;
    color: white;
    border: none;
    border-radius: 24px;
    padding: 12px 24px;
    margin-left: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

#enviar-consulta:hover {
    background: #19199f;
}

#enviar-consulta:disabled {
    background: #19199f;
    cursor: not-allowed;
}

.chat-footer-note {
    text-align: center;
    padding: 8px;
    background: #ffebee;
    color: #c62828;
    font-size: 0.8rem;
}

.chat-error {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    margin: 10px;
    border-radius: 8px;
    text-align: center;
    animation: shake 0.5s ease;
}

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

@keyframes pulse {
    0%, 100% { opacity: 0.6; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #c5c5c5;
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #a777e3;
}

@media (max-width: 500px) {
    #smars-chat {
        height: 80vh;
        max-width: 100%;
        border-radius: 0;
    }
    
    .pregunta-usuario,
    .respuesta-detallada {
        max-width: 90%;
    }
}