/* =========================================
   PM Digital Chatbot – Alvariini Brand Style
   Brand color: #8A253F
   ========================================= */

/* 1. CHAT-IKKUNA */
#pm-v55-container {
    display: none;
    position: fixed;
    bottom: 85px;
    right: 25px;
    width: 380px;
    height: 600px;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.4);
    flex-direction: column;
    overflow: hidden;
    z-index: 2147483647 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#pm-v55-container.active {
    display: flex;
}

/* 2. AVAUSPAINIKE */
#pm-v55-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #8A253F !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2147483646;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    transition: transform 0.2s;
    animation: bot-pulse 2s infinite;
    overflow: visible !important;
}

#pm-v55-toggle:active {
    transform: scale(0.95);
}

#pm-v55-toggle img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

#pm-v55-toggle svg {
    width: 30px;
    height: 30px;
    stroke: white;
    fill: none;
    stroke-width: 2.5;
}

/* 3. HEADER */
#pm-v55-header {
    height: 60px;
    padding: 0 15px;
    background-color: #8A253F;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.pm-v55-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.3);
    margin-right: 10px;
}

#pm-v55-header-actions {
    display: flex;
    align-items: center;
}

#pm-v55-close-btn,
#pm-v55-clear-btn {
    background: transparent !important;
    border: none !important;
    color: white !important;
    cursor: pointer !important;
    margin-left: 15px !important;
    opacity: 0.9;
}

#pm-v55-close-btn:hover,
#pm-v55-clear-btn:hover {
    opacity: 1;
}

/* 4. VIESTIALUE */
#pm-v55-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f4f7f9;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

.pm-v55-msg {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.5;
    max-width: 85%;
    word-wrap: break-word;
}

.pm-v55-user {
    background: #8A253F;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.pm-v55-bot {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    align-self: flex-start;
    color: #333333;
    border-bottom-left-radius: 2px;
}

.pm-v55-bot strong,
.pm-v55-bot b {
    font-weight: 700;
    color: #000000;
}

.pm-v55-bot a {
    color: #8A253F;
    text-decoration: underline;
    font-weight: 600;
}

/* 5. INPUT */
#pm-v55-inputbar {
    padding: 10px;
    background: #ffffff;
    border-top: 1px solid #eeeeee;
    display: flex;
    align-items: center;
}

#pm-v55-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #dddddd;
    border-radius: 25px;
    outline: none;
    font-size: 16px;
}

#pm-v55-input:focus {
    border-color: #8A253F;
}

#pm-v55-send-btn {
    margin-left: 10px;
    background: #8A253F;
    color: #ffffff;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* 6. DISCLAIMER */
#pm-v55-disclaimer {
    font-size: 11px;
    color: #999999;
    text-align: center;
    padding: 6px 10px;
    background: #ffffff;
    line-height: 1.3;
}

/* 7. TYPING */
#pm-v55-typing {
    padding: 15px;
    display: none;
    background: #ffffff;
    border-radius: 10px;
    width: fit-content;
    margin-bottom: 10px;
    border: 1px solid #eeeeee;
    align-items: center;
    gap: 10px;
}

.pm-typing-dots {
    display: flex;
    gap: 4px;
}

.pm-typing-dot {
    width: 6px;
    height: 6px;
    background-color: #8A253F;
    border-radius: 50%;
    animation: pm-bounce 1.4s infinite ease-in-out both;
}

.pm-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.pm-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes pm-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 8. SYKE-ANIMAATIO */
@keyframes bot-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(138, 37, 63, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(138, 37, 63, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(138, 37, 63, 0);
    }
    
}


/* 9. MOBIILI */
@media (max-width: 768px) {
    #pm-v55-container {
        width: 94% !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        border-radius: 16px !important;
        bottom: auto !important;
    }

    body.pm-chat-open #pm-v55-toggle {
        display: none !important;
    }
}
/* Roskakorin väri valkoiseksi */
#pm-v55-clear-btn,
#pm-v55-clear-btn svg {
    color: #ffffff !important;
    fill: #ffffff !important;
}
/* =========================================
   KORJAUS: ROSKAKORIN TYYLI
   ========================================= */

/* 1. VÄRI: Pakotetaan kirkkaan valkoiseksi */
#pm-v55-clear-btn,
#pm-v55-clear-btn svg,
#pm-v55-clear-btn svg path {
    color: #ffffff !important;
    fill: #ffffff !important;     /* Vaikuttaa täyttöväriin */
    stroke: #ffffff !important;   /* Vaikuttaa viivojen väriin */
    opacity: 1 !important;        /* Poistaa alkuperäisen 0.9 läpinäkyvyyden */
}

/* 2. MOBIILI: Suurennus ja litistymisen esto */
@media (max-width: 768px) {
    #pm-v55-clear-btn svg {
        width: 26px !important;       /* Isompi leveys mobiilissa */
        height: 26px !important;      /* Isompi korkeus mobiilissa */
        min-width: 26px !important;   /* TÄRKEÄ: Estää ikonin litistymisen pisteeksi */
        min-height: 26px !important;
    }

    #pm-v55-clear-btn {
        margin-left: 10px !important; /* Hieman väliä tekstiin */
        padding: 8px !important;      /* Suurempi kosketusalue sormelle */
        flex-shrink: 0 !important;    /* Estää napin koon pienenemisen, kun tila on tiukilla */
    }
    
}
/* Chat-kuvakkeen vieressä oleva teksti */
#pm-v55-toggle::after {
    content: "Kuinka voin auttaa sinua?";
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: #ffffff;
    color: #8A253F;
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
    opacity: 1;
    pointer-events: none;
}

/* Piilotetaan teksti mobiilissa */
@media (max-width: 768px) {
    #pm-v55-toggle::after {
        display: none;
    }
}

