/* Saima Chatbot — frontend styles */

#saima-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    color: #1a1a1a;
}

#saima-chat-toggle {
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 28px;
    padding: 12px 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

#saima-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.saima-chat-icon { font-size: 18px; }

#saima-chat-window {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.saima-chat-header {
    background: #1e3a5f;
    color: #fff;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.saima-chat-title {
    font-weight: 600;
    font-size: 16px;
}

#saima-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

#saima-chat-close:hover { opacity: 0.7; }

.saima-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f7f8fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.saima-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.saima-msg-bot {
    background: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.saima-msg-user {
    background: #1e3a5f;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.saima-msg-error {
    background: #fee;
    color: #c00;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #fcc;
}

.saima-msg-typing {
    background: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: #999;
    font-style: italic;
}

.saima-chat-input-row {
    display: flex;
    border-top: 1px solid #e0e3e8;
    padding: 10px;
    background: #fff;
    gap: 8px;
    align-items: flex-end;
}

#saima-chat-input {
    flex: 1;
    border: 1px solid #d0d4da;
    border-radius: 8px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

#saima-chat-input:focus {
    border-color: #1e3a5f;
}

#saima-chat-send {
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

#saima-chat-send:hover { background: #2a4d7a; }
#saima-chat-send:disabled { background: #999; cursor: not-allowed; }

.saima-chat-footer {
    padding: 8px 14px;
    background: #f7f8fa;
    border-top: 1px solid #e0e3e8;
    color: #777;
    font-size: 11px;
}

.saima-chat-footer a {
    color: #1e3a5f;
    text-decoration: underline;
}

#saima-chat-widget.saima-collapsed #saima-chat-window {
    display: none;
}

/* Mobiili */
@media (max-width: 480px) {
    #saima-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    #saima-chat-widget {
        bottom: 10px;
        right: 10px;
    }
}


/* Vihjekupla (pomppaa esiin -ominaisuus) */
.saima-chat-hint {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: #fff;
    color: #1a1a1a;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    line-height: 1.4;
    max-width: 240px;
    cursor: pointer;
    z-index: 99998;
    animation: saimaHintFadeIn 0.4s ease-out;
    border-bottom-right-radius: 4px;
}
.saima-chat-hint:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}
.saima-chat-hint::after {
    content: "";
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #fff;
}
.saima-chat-hint-close {
    position: absolute;
    top: 2px;
    right: 6px;
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
}
.saima-chat-hint-close:hover { color: #1a1a1a; }
.saima-chat-hint.saima-hint-hiding {
    animation: saimaHintFadeOut 0.4s ease-in forwards;
}
@keyframes saimaHintFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes saimaHintFadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(10px); }
}
@media (max-width: 480px) {
    .saima-chat-hint { right: 10px; bottom: 70px; max-width: calc(100vw - 40px); }
}
