html,
body {
    height: 100%;
}

body {
    margin: 0;
}

#nortica-ia-page {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f7f7f7;
    color: #111;
    font-family: Arial, sans-serif;
}

#nortica-ia-header {
    flex: 0 0 90px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: #ffffff;
    border-bottom: 1px solid #e9e9e9;
}

.nortica-ia-brand {
    display: flex;
    align-items: center;
}

.nortica-ia-header-image {
    display: block;
    height: 50px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

#nortica-ia-new-chat {
    background: #111;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.25s;
}

#nortica-ia-new-chat:hover {
    background: #000;
}

#nortica-ia-new-chat:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

#nortica-ia-messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px 20px 140px;
    scroll-behavior: smooth;
}

.nortica-ai-message {
    width: min(820px, calc(100% - 32px));
    margin: 0 auto 18px;
    padding: 18px 20px;
    border-radius: 16px;
    line-height: 1.65;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

.nortica-ai-message > strong {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

.nortica-ai-message p {
    margin: 0 0 10px;
}

.nortica-ai-message p:last-child {
    margin-bottom: 0;
}

.nortica-ai-assistant {
    background: #fff;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.07);
}

.nortica-ai-user {
    background: #111;
    color: #fff;
}

/*
|--------------------------------------------------------------------------
| CONTENIDO FORMATEADO
|--------------------------------------------------------------------------
*/

.nortica-ai-content {
    line-height: 1.7;
}

.nortica-ai-content p {
    margin: 0 0 14px;
}

.nortica-ai-content h3 {
    margin: 22px 0 10px;
    font-size: 17px;
    line-height: 1.35;
}

.nortica-ai-content h3:first-child {
    margin-top: 0;
}

.nortica-ai-content ul,
.nortica-ai-content ol {
    margin: 8px 0 16px;
    padding-left: 24px;
}

.nortica-ai-content li {
    margin-bottom: 7px;
}

.nortica-ai-content strong {
    display: inline;
    margin: 0;
    font-size: inherit;
}

.nortica-ai-spacer {
    height: 10px;
}

/*
|--------------------------------------------------------------------------
| ENLACES CLICABLES
|--------------------------------------------------------------------------
*/

.nortica-ai-content a {
    color: #111;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

.nortica-ai-content a:hover {
    opacity: 0.65;
}

.nortica-ai-user .nortica-ai-content a {
    color: #fff;
}

/*
|--------------------------------------------------------------------------
| INDICADOR DE ESCRITURA
|--------------------------------------------------------------------------
*/

.nortica-ai-typing {
    opacity: 0.75;
}

.nortica-ai-typing p {
    font-style: italic;
}

#nortica-ia-footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    padding: 18px 20px 24px;
    background: linear-gradient(
        to top,
        #f7f7f7 70%,
        rgba(247, 247, 247, 0)
    );
}

.nortica-ia-input-wrapper {
    width: min(860px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px;
    border: 1px solid #d8d8d8;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
}

#nortica-ia-input {
    flex: 1;
    min-height: 24px;
    max-height: 160px;
    padding: 12px 10px;
    border: none;
    resize: none;
    outline: none;
    background: transparent;
    color: #111;
    font: inherit;
    line-height: 1.45;
}

#nortica-ia-send {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 14px;
    background: #000;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

#nortica-ia-send:hover {
    background: #222;
}

#nortica-ia-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 640px) {

    #nortica-ia-header {
        flex-basis: 68px;
        padding: 0 16px;
    }

    .nortica-ia-header-image {
        height: 38px;
        max-width: 170px;
    }

    #nortica-ia-new-chat {
        padding: 8px 10px;
        font-size: 12px;
    }

    #nortica-ia-messages {
        padding: 20px 10px 125px;
    }

    .nortica-ai-message {
        width: calc(100% - 12px);
        padding: 15px;
        border-radius: 14px;
    }

    .nortica-ai-content h3 {
        font-size: 16px;
    }

    #nortica-ia-footer {
        padding: 12px 8px 16px;
    }

    .nortica-ia-input-wrapper {
        width: calc(100% - 8px);
    }
}