/* Container principal */
#mia-chat-container {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Buton declanșare */
#mia-trigger-wrap {
    position: fixed;
    right: 0;
    z-index: 999999;
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), bottom 0.35s ease;
}

@media screen and (min-width: 769px) {
    #mia-trigger-wrap {
        top: auto;
        bottom: 100px;
    }
    #mia-trigger-wrap.mia-scrolled {
        bottom: 175px;
    }
    #mia-trigger:hover {
        transform: none;
        background: linear-gradient(135deg, #32d01c, #22b512);
        box-shadow: -6px 6px 28px rgba(43, 192, 22, 0.55);
    }
}

#mia-trigger {
    position: relative;
    border: none;
    cursor: pointer;
    border-radius: 16px 0 0 16px;
    background: linear-gradient(135deg, #2bc016, #209910);
    color: #fff;
    box-shadow: -5px 5px 25px rgba(43, 192, 22, 0.4);
    padding: 12px 14px 12px 12px;
    min-width: 148px;
    max-width: 190px;
    transition: box-shadow 0.3s ease, transform 0.25s ease;
}
#mia-trigger:hover {
    box-shadow: -8px 10px 32px rgba(43, 192, 22, 0.5);
    transform: translateX(-3px);
}

.mia-trigger-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    position: relative;
    overflow: hidden;
}
.mia-trigger-inner::after {
    content: '';
    position: absolute;
    top: 0;
    left: -55%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
    animation: miaShine 5s ease-in-out infinite;
    pointer-events: none;
}

.mia-trigger-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.mia-trigger-icon--logo {
    background: #fff;
    padding: 4px;
    border-radius: 50%;
}
.mia-trigger-icon img {
    display: block;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

@keyframes miaWiggle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    10% { transform: rotate(-12deg) scale(1.08); }
    20% { transform: rotate(12deg) scale(1.08); }
    30% { transform: rotate(-12deg) scale(1.08); }
    40% { transform: rotate(12deg) scale(1.08); }
    50% { transform: rotate(0deg) scale(1); }
}
.mia-trigger-icon svg {
    width: 20px;
    height: 20px;
    fill: #fff;
    animation: miaWiggle 4s infinite ease-in-out;
    animation-delay: 2s;
}
#mia-trigger:hover .mia-trigger-icon svg {
    animation: none;
    transform: scale(1.05);
}

.mia-trigger-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    line-height: 1.2;
}

.mia-trigger-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.mia-trigger-title--mobile { display: none; }

.mia-trigger-sub {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.92;
    white-space: nowrap;
    transition: opacity 0.25s ease;
}

.mia-trigger-badge {
    position: absolute;
    top: -7px;
    left: 10px;
    background: #fc4700;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.6px;
    padding: 3px 7px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(252, 71, 0, 0.45);
    line-height: 1;
    animation: miaBadgeSoft 2.8s ease-in-out infinite;
}

/* Fereastra de Chat — mobil rămâne popup; desktop e panel stânga */
#mia-chat-window {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999999;
    display: none; 
    width: 360px; 
    max-height: 650px;
    background: #ffffff; 
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15), 0 5px 15px rgba(0,0,0,0.08);
    overflow: hidden;
    animation: miaPopup 0.25s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    transform-origin: bottom right;
    border: 1px solid rgba(0,0,0,0.05);
}

@keyframes miaPopup {
    0% { opacity: 0; transform: scale(0.85) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes miaPanelIn {
    0% { opacity: 0; transform: translateX(28px); }
    100% { opacity: 1; transform: translateX(0); }
}

@media screen and (min-width: 769px) {
    #mia-chat-window {
        top: 0;
        bottom: 0;
        right: 0;
        left: auto;
        width: min(420px, 38vw);
        min-width: 380px;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        border: none;
        border-left: 1px solid #e5ebe5;
        box-shadow: -16px 0 48px rgba(16, 24, 16, 0.14);
        transform-origin: right center;
        animation: miaPanelIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
        display: none;
        flex-direction: column;
        overflow: hidden;
        overscroll-behavior: contain;
    }
    #mia-chat-body {
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}

/* Header panou deschis */
.mia-header {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbf8 100%);
    color: #2d3748;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #e8f0e8;
    position: relative;
    z-index: 2;
}
.mia-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2bc016, #22a611);
}

.mia-header-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.mia-header-logo-wrap {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(43, 192, 22, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    animation: miaLogoGlow 3.2s ease-in-out infinite;
}

.mia-header-logo {
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.mia-header-logo-fallback {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2bc016, #22a611);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mia-header-titles {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.mia-header-title-row {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.mia-header-name {
    font-size: 15px;
    font-weight: 700;
    color: #1a202c;
    letter-spacing: 0.2px;
    line-height: 1.1;
}

.mia-header-badge {
    display: inline-block;
    background: #fc4700;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 3px 7px;
    border-radius: 6px;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(252, 71, 0, 0.25);
}

.mia-header-sub {
    font-size: 11px;
    font-weight: 500;
    color: #718096;
    display: flex;
    align-items: center;
    gap: 5px;
    line-height: 1.2;
}

@keyframes pulseDot {
    0% { box-shadow: 0 0 0 0 rgba(43, 192, 22, 0.55); }
    70% { box-shadow: 0 0 0 6px rgba(43, 192, 22, 0); }
    100% { box-shadow: 0 0 0 0 rgba(43, 192, 22, 0); }
}
.mia-status-dot {
    width: 7px;
    height: 7px;
    background: #2bc016;
    border-radius: 50%;
    display: inline-block;
    animation: pulseDot 2s infinite;
    flex-shrink: 0;
}

.mia-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#mia-new-chat {
    font-size: 10px;
    background: #fff;
    border: 1px solid #d8e8d8;
    color: #2f855a;
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#mia-new-chat:hover {
    background: #f0fdf0;
    border-color: #2bc016;
    color: #209910;
}

#mia-close {
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #fc4700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(252, 71, 0, 0.35);
}
#mia-close:hover {
    background: #e03e00;
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(252, 71, 0, 0.45);
}
#mia-close svg { display: block; }

/* Corpul Chat-ului - Adăugat efect de fade pentru tranzitii fluide */
#mia-chat-body {
    height: 380px; overflow-y: auto; padding: 25px 20px;
    background: #f8fbf8; scroll-behavior: smooth;
    transition: opacity 0.3s ease-in-out;
    opacity: 1;
}
#mia-chat-body.fade-out { opacity: 0; }
#mia-chat-body::-webkit-scrollbar { width: 6px; }
#mia-chat-body::-webkit-scrollbar-thumb { background: #cce8cc; border-radius: 10px; }

/* Bule de mesaje - Soft UI */
.mia-msg { margin-bottom: 18px; display: flex; flex-direction: column; animation: fadeInMsg 0.32s ease forwards; }
.mia-msg-user { animation-name: miaMsgUser; animation-duration: 0.34s; animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
.mia-msg-bot { animation-name: miaMsgBot; animation-duration: 0.34s; animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
.mia-msg--static,
.mia-msg--static .mia-product-card,
.mia-msg--static .mia-qr,
.mia-msg--static .mia-view-all,
.mia-msg--static .mia-view-cart,
.mia-msg--static .mia-quick-replies,
.mia-msg--static .mia-feedback {
    animation: none !important;
}
@keyframes fadeInMsg {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes miaMsgUser {
    from { opacity: 0; transform: translateX(14px) translateY(4px); }
    to { opacity: 1; transform: none; }
}
@keyframes miaMsgBot {
    from { opacity: 0; transform: translateX(-10px) translateY(4px); }
    to { opacity: 1; transform: none; }
}

.mia-msg-content {
    max-width: 88%; padding: 14px 18px; font-size: 14px; line-height: 1.55;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
    letter-spacing: 0.2px;
}
.mia-msg-bot .mia-msg-content {
    background: #fff; color: #2d3748; 
    border-radius: 16px 16px 16px 4px; align-self: flex-start;
    border: 1px solid rgba(0,0,0,0.03);
}
.mia-msg-user .mia-msg-content {
    background: linear-gradient(135deg, #2bc016, #22a611); color: #fff;
    border-radius: 16px 16px 4px 16px; align-self: flex-end;
}

/* Produse: listă unică, fără bula de chat */
.mia-msg-products {
    width: 100%;
}
.mia-msg-products .mia-msg-content {
    max-width: 100%;
    width: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
}

.mia-product-list {
    background: #fff;
    border: 1px solid #e5ebe5;
    border-radius: 14px;
    overflow: hidden;
}

.mia-product-card {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 4px;
    align-items: center;
    padding: 10px 12px;
    margin: 0;
    background: #fff;
    border: 0;
    border-bottom: 1px solid #eef2ee;
    box-shadow: none;
    border-radius: 0;
    transform: none;
}
.mia-product-card:last-of-type { border-bottom: 0; }
.mia-product-list:has(.mia-view-all) .mia-product-card:last-of-type,
.mia-product-list:has(.mia-view-cart) .mia-product-card:last-of-type {
    border-bottom: 1px solid #eef2ee;
}
.mia-product-card-view { display: none !important; }
.mia-product-card:hover {
    background: #fafcf9;
    transform: none;
    box-shadow: none;
    border-color: transparent;
}
.mia-product-card {
    animation: miaCardIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.mia-product-card:nth-child(1) { animation-delay: 0.04s; }
.mia-product-card:nth-child(2) { animation-delay: 0.11s; }
.mia-product-card:nth-child(3) { animation-delay: 0.18s; }

.mia-product-card-media {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 56px;
    height: 56px;
    border: 0;
    background: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: none;
}
.mia-product-card-img,
.mia-product-card-media img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    display: block;
    background: none;
    border: 0 !important;
    outline: 0;
    box-shadow: none !important;
    border-radius: 0;
    transition: transform 0.25s ease;
}
.mia-product-card:hover .mia-product-card-img,
.mia-product-card:hover .mia-product-card-media img {
    transform: scale(1.07);
}

.mia-product-card-title {
    grid-column: 2 / span 2;
    grid-row: 1;
    color: #1a202c;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.35;
    text-decoration: none;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.mia-product-card-title:hover { color: #1f8f12; }

.mia-product-card-meta {
    grid-column: 2 / span 2;
    grid-row: 2;
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}
.mia-product-card-price {
    color: #1a202c;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
}
.mia-product-card-price .woocommerce-Price-amount,
.mia-product-card-price .amount {
    color: inherit;
    font-weight: 700;
}
.mia-product-card-stock { display: none !important; }

.mia-add-cart {
    margin-left: 0;
    width: auto;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: #2bc016;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: none;
    text-decoration: underline;
}
.mia-add-cart:hover {
    background: none;
    color: #1a7a10;
    text-decoration: underline;
}
.mia-add-cart.is-loading { opacity: 0.7; cursor: wait; text-decoration: none; }
.mia-add-cart.is-added {
    background: none;
    color: #276749;
    animation: miaAddedPop 0.45s ease;
}

.mia-msg-contact .mia-msg-content {
    max-width: 100%;
    width: 100%;
    padding: 12px;
}
.mia-contact-form { display: flex; flex-direction: column; gap: 7px; }
.mia-contact-hp {
    position: absolute; left: -9999px; height: 0; width: 0; opacity: 0;
}
.mia-contact-label {
    font-size: 11px; font-weight: 700; color: #4a5568; letter-spacing: 0.02em;
}
.mia-contact-hint {
    margin: 0; font-size: 12px; color: #4a5568; line-height: 1.4;
}
.mia-contact-hint strong { color: #1a202c; }
.mia-contact-input,
.mia-contact-textarea {
    width: 100%; box-sizing: border-box;
    border: 1px solid #e2e8f0; border-radius: 10px;
    padding: 9px 11px; font-size: 13px; font-family: inherit;
    background: #fff; color: #1a202c;
}
.mia-contact-textarea { resize: vertical; min-height: 72px; }
.mia-contact-input:focus,
.mia-contact-textarea:focus {
    outline: none; border-color: #2bc016;
    box-shadow: 0 0 0 3px rgba(43,192,22,0.12);
}
.mia-contact-submit {
    border: 0; cursor: pointer; border-radius: 10px;
    background: #2bc016; color: #fff;
    font-size: 13px; font-weight: 700;
    padding: 10px 12px;
}
.mia-contact-submit:hover { background: #209910; }
.mia-contact-submit:disabled { opacity: 0.7; cursor: wait; }
.mia-contact-note {
    margin: 0; font-size: 11px; color: #718096;
}
.mia-contact-done {
    font-size: 13px; line-height: 1.45; color: #276749;
    background: #f0fdf4; border: 1px solid #c6f6d5;
    border-radius: 10px; padding: 10px 12px;
}
.mia-contact-done.is-error {
    color: #9b2c2c; background: #fff5f5; border-color: #feb2b2;
}
.mia-contact-error {
    margin: 4px 0 0; font-size: 12px; color: #c53030;
}

.mia-view-all,
.mia-view-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 11px 12px;
    font-size: 13px;
    font-weight: 700;
    color: #1a7a10;
    text-decoration: none;
    background: #f3fbf2;
    border: 0;
    border-top: 1px solid #e5ebe5;
}
.mia-view-all::after,
.mia-view-cart::after {
    content: '→';
    font-weight: 700;
    line-height: 1;
}
.mia-view-all:hover,
.mia-view-cart:hover {
    background: #e7f8e4;
    color: #16730d;
}
.mia-view-all,
.mia-view-cart {
    animation: miaCardIn 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.24s;
}

/* Sugestii Rapide pe verticală */
.mia-quick-replies {
    display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px;
    animation: fadeInMsg 0.4s ease forwards;
}
.mia-qr-label {
    font-size: 12px; font-weight: 600; color: #718096; text-transform: none;
    letter-spacing: 0; margin-bottom: 2px; padding-left: 2px;
}
.mia-qr {
    background: #fff; border: 1px solid #e2e8f0; padding: 10px 14px; border-radius: 12px;
    font-size: 13px; font-weight: 500; cursor: pointer; color: #4a5568; 
    transition: all 0.2s ease; box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    text-align: left;
    animation: miaQrIn 0.32s ease both;
}
.mia-qr:nth-child(2) { animation-delay: 0.04s; }
.mia-qr:nth-child(3) { animation-delay: 0.09s; }
.mia-qr:nth-child(4) { animation-delay: 0.14s; }
.mia-qr:nth-child(5) { animation-delay: 0.19s; }
.mia-qr:hover { background: #f0fdf0; border-color: #2bc016; color: #2bc016; transform: translateX(3px); }

.mia-quick-replies--choice {
    margin-top: 2px;
    padding: 10px;
    background: #f3fbf2;
    border: 2px solid #2bc016;
    border-radius: 14px;
}
.mia-quick-replies--choice .mia-qr-label {
    color: #1a7a10;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    font-weight: 700;
}
.mia-quick-replies--choice .mia-qr {
    border: 1.5px solid #2bc016;
    background: #fff;
    color: #1a202c;
    font-weight: 600;
}
.mia-quick-replies--choice .mia-qr:hover {
    background: #e7f8e4;
    border-color: #209910;
    color: #16730d;
    transform: none;
}

.mia-product-list--choice {
    border: 2px solid #2bc016;
    box-shadow: 0 0 0 3px rgba(43, 192, 22, 0.12);
}

.mia-msg-nudge {
    width: 100%;
    margin-top: 12px;
}
.mia-msg-nudge .mia-msg-content {
    max-width: 100%;
    width: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
}
.mia-shipping-nudge,
.mia-cart-status {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 10px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.45;
    color: #1a202c;
    background: #f3fbf2;
    border: 1px solid #86efac;
    border-radius: 14px;
}
.mia-shipping-nudge strong,
.mia-cart-status strong {
    color: #16730d;
}

.mia-product-list--related {
    border-color: #c6f6d5;
}

.mia-msg-tip {
    width: 100%;
}
.mia-msg-tip .mia-msg-content {
    max-width: 100%;
    width: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
}
.mia-pharmacist-tip {
    font-size: 12px;
    line-height: 1.5;
    color: #4a5568;
    background: #f0fdf4;
    border: 1px solid #c6f6d5;
    border-radius: 12px;
    padding: 10px 14px;
    width: 100%;
    box-sizing: border-box;
}
.mia-pharmacist-tip strong { color: #2f855a; }

.mia-feedback {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    animation: fadeInMsg 0.3s ease forwards;
}
.mia-feedback-label {
    font-size: 12px;
    color: #718096;
    font-weight: 500;
    margin-right: 4px;
}
.mia-feedback-btn {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #4a5568;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}
.mia-feedback-yes:hover {
    background: #f0fdf0;
    border-color: #2bc016;
    color: #209910;
}
.mia-feedback-no:hover {
    background: #fff5f5;
    border-color: #fc8181;
    color: #c53030;
}
.mia-feedback-thanks {
    font-size: 12px;
    color: #2f855a;
    font-weight: 600;
}

/* Input area */
.mia-input-area {
    padding: 15px 20px; background: #fff; border-top: 1px solid #edf2f7;
    display: flex; align-items: center; gap: 12px;
}
#mia-input {
    flex: 1; border: 1px solid #e2e8f0; padding: 12px 16px;
    border-radius: 24px; outline: none; font-size: 14px;
    transition: all 0.3s ease; background: #f8fafc;
}
#mia-input:focus { border-color: #2bc016; background: #fff; box-shadow: 0 0 0 3px rgba(43,192,22,0.1); }

/* Buton Trimitere */
#mia-send {
    background: linear-gradient(135deg, #2bc016, #22a611); border: none; 
    width: 44px; height: 44px; border-radius: 50%; color: #fff; 
    cursor: pointer; display: flex; align-items: center; justify-content: center; 
    transition: all 0.2s ease; box-shadow: 0 4px 10px rgba(43,192,22,0.3);
}
#mia-send:hover { transform: scale(1.05); box-shadow: 0 6px 14px rgba(43,192,22,0.4); }
#mia-send:active { transform: scale(0.95); }
#mia-send:disabled {
    opacity: 0.72;
    cursor: wait;
    animation: miaSendPulse 0.9s ease-in-out infinite;
}
#mia-send svg { transition: transform 0.2s ease; }
#mia-send:hover svg { transform: translateX(1px) translateY(-1px); }

/* Typing animation */
.typing-container { display: flex; align-items: center; gap: 10px; }
.typing-text { font-size: 12px; color: #718096; font-style: italic; }
.typing { display: flex; gap: 4px; padding: 5px 0; }
.typing span { width: 6px; height: 6px; background: #a0aec0; border-radius: 50%; animation: blink 1.4s infinite both; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.2; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }

@media screen and (max-width: 768px) {
    #mia-trigger-wrap {
        top: auto;
        left: auto;
        /* Fallback: WooFlux bar (20px + 65px) + gap; JS îl ajustează fin dacă există #wooflux-nav */
        bottom: var(--mia-mobile-bottom, calc(97px + env(safe-area-inset-bottom, 0px)));
        right: 12px;
        transform: translateX(0);
    }

    #mia-trigger {
        min-width: 0;
        max-width: none;
        padding: 7px 11px 7px 7px;
        border-radius: 999px;
        box-shadow: 0 4px 16px rgba(43, 192, 22, 0.42);
    }
    #mia-trigger:hover {
        transform: translateY(-2px);
    }

    .mia-trigger-inner { gap: 7px; }
    .mia-trigger-icon {
        width: 30px;
        height: 30px;
        border-radius: 50%;
    }
    .mia-trigger-icon--logo {
        padding: 3px;
    }
    .mia-trigger-icon svg {
        width: 16px;
        height: 16px;
    }
    .mia-trigger-title--desktop { display: none; }
    .mia-trigger-title--mobile { display: inline; font-size: 12px; }
    .mia-trigger-sub { display: none; }

    .mia-trigger-badge {
        top: -4px;
        left: auto;
        right: -2px;
        font-size: 7px;
        padding: 2px 5px;
        letter-spacing: 0.4px;
    }
}

/* Optimizare Fullscreen pentru Mobil - Anti-Bounce */
@media screen and (max-width: 768px) {
    /* Transformăm containerul în flexbox doar când JS-ul îi dă display: block, evitând astfel modificarea fișierului JS */
    #mia-chat-window[style*="display: block"] {
        display: flex !important;
    }

    #mia-chat-window {
        width: 100% !important;
        height: 100% !important;
        height: 100dvh !important; /* Salvează layout-ul de bara de adrese care apare/dispare */
        max-height: 100% !important;
        max-height: 100dvh !important;
        bottom: 0 !important;
        right: 0 !important;
        top: 0 !important;
        border-radius: 0 !important;
        flex-direction: column !important;
        overscroll-behavior: none !important; /* Previne efectul de "elastic" (rubber-band) de pe marginea ecranului */
    }
    
    .mia-header {
        flex-shrink: 0 !important;
    }

    #mia-chat-body {
        /* Eliminăm funcția calc() și lăsăm flexbox-ul să acopere perfect spațiul */
        height: auto !important;
        flex: 1 1 auto !important;
        overscroll-behavior-y: contain !important; /* Izolează scroll-ul strict în chat, protejând input-ul */
        -webkit-overflow-scrolling: touch !important; /* Scroll fluid nativ iOS */
    }

    .mia-input-area {
        flex-shrink: 0 !important;
        /* Spațiu de siguranță la fel ca data trecută */
        padding-bottom: max(30px, env(safe-area-inset-bottom, 30px)) !important;
    }
}

@keyframes miaShine {
    0%, 70% { transform: translateX(0); opacity: 0; }
    78% { opacity: 1; }
    100% { transform: translateX(320%); opacity: 0; }
}
@keyframes miaBadgeSoft {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}
@keyframes miaLogoGlow {
    0%, 100% { box-shadow: 0 2px 10px rgba(43, 192, 22, 0.1); }
    50% { box-shadow: 0 4px 16px rgba(43, 192, 22, 0.28); }
}
@keyframes miaCardIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
@keyframes miaQrIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: none; }
}
@keyframes miaAddedPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.08); }
    100% { transform: scale(1); }
}
@keyframes miaSendPulse {
    0%, 100% { box-shadow: 0 4px 10px rgba(43, 192, 22, 0.3); }
    50% { box-shadow: 0 4px 16px rgba(43, 192, 22, 0.55); }
}

@media (prefers-reduced-motion: reduce) {
    .mia-trigger-inner::after,
    .mia-trigger-badge,
    .mia-trigger-icon svg,
    .mia-header-logo-wrap,
    .mia-status-dot,
    #mia-send:disabled,
    .mia-add-cart.is-added {
        animation: none !important;
    }
    .mia-msg,
    .mia-msg-user,
    .mia-msg-bot,
    .mia-product-card,
    .mia-qr,
    .mia-view-all,
    .mia-view-cart,
    .mia-quick-replies,
    .mia-feedback,
    #mia-chat-window {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
    }
}
/* ===== 1.6.0 — Mod „Construiește-ți rutina” ===== */
.mia-qr.mia-qr--routine {
    background: linear-gradient(135deg, #f3fbf2, #e7f8e4);
    border: 1.5px solid #2bc016;
    color: #16730d;
    font-weight: 700;
}
.mia-qr.mia-qr--routine:hover { background: #e7f8e4; color: #16730d; }

.mia-msg-routine .mia-msg-content { max-width: 100%; width: 100%; padding: 14px; box-sizing: border-box; }
.mia-rt-view { animation: fadeInMsg 0.2s ease both; contain: content; }
.mia-msg--static .mia-rt-view { animation: none; }
.mia-rt-title { font-size: 15px; font-weight: 700; color: #1a202c; line-height: 1.35; margin-bottom: 4px; }
.mia-rt-sub { font-size: 12.5px; color: #4a5568; margin: 0 0 10px; line-height: 1.45; }
.mia-rt-q { font-size: 13px; font-weight: 700; color: #1a7a10; margin: 8px 0 8px; }
.mia-rt-goalhead { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: #718096; text-transform: uppercase; letter-spacing: 0.3px; }
.mia-rt-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mia-rt-choice {
    display: flex; align-items: center; gap: 8px; text-align: left;
    background: #fff; border: 1.5px solid #e2e8f0; border-radius: 12px; padding: 10px 12px;
    font-size: 13px; font-weight: 600; color: #1a202c; cursor: pointer; line-height: 1.3;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.mia-rt-choice:hover, .mia-rt-choice:focus-visible { border-color: #2bc016; background: #f0fdf0; outline: none; }
.mia-rt-emoji { font-size: 18px; line-height: 1; flex-shrink: 0; }
.mia-rt-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.mia-rt-link { background: none; border: 0; padding: 4px 0; font-size: 12.5px; font-weight: 600; color: #4a5568; cursor: pointer; }
.mia-rt-link:hover { color: #1a7a10; text-decoration: underline; }
.mia-rt-loading { font-size: 13px; color: #4a5568; }
.mia-rt-dots::after { content: '…'; }

.mia-rt-cards { display: flex; flex-direction: column; background: #fff; border: 1px solid #e5ebe5; border-radius: 14px; overflow: hidden; margin: 6px 0 10px; }
.mia-rt-card {
    display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: auto auto auto;
    column-gap: 10px; row-gap: 3px; padding: 10px 12px; border-bottom: 1px solid #eef2ee;
    animation: miaCardIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.mia-rt-card:last-child { border-bottom: 0; }
.mia-rt-card:nth-child(2) { animation-delay: 0.05s; }
.mia-rt-card:nth-child(3) { animation-delay: 0.1s; }
.mia-rt-role { grid-column: 2; grid-row: 1; justify-self: start; font-size: 10.5px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; }
.mia-rt-role.is-main { background: #2bc016; color: #fff; }
.mia-rt-role.is-alt { background: #fff4ed; color: #c2410c; }
.mia-rt-role.is-comp { background: #eef6ff; color: #1d4ed8; }
.mia-rt-media { grid-column: 1; grid-row: 1 / span 3; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.mia-rt-media img { width: 64px; height: 64px; object-fit: contain; display: block; border: 0 !important; box-shadow: none !important; }
.mia-rt-name { grid-column: 2; grid-row: 2; color: #1a202c; font-weight: 600; font-size: 13px; line-height: 1.35; text-decoration: none; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.mia-rt-name:hover { color: #1f8f12; }
.mia-rt-meta { grid-column: 2; grid-row: 3; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mia-rt-price { font-weight: 700; font-size: 14px; color: #1a202c; }
.mia-rt-price del { color: #a0aec0; font-weight: 500; font-size: 12px; margin-right: 2px; }
.mia-rt-price ins { text-decoration: none; color: #e03e00; }
.mia-rt-add { background: none; border: 0; padding: 0; color: #2bc016; font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.mia-rt-add:hover { color: #1a7a10; text-decoration: underline; }
.mia-rt-add.is-loading { opacity: 0.7; cursor: wait; }
.mia-rt-add.is-added { color: #276749; animation: miaAddedPop 0.45s ease; }
.mia-rt-add.is-error { color: #c53030; }

.mia-rt-actions { display: flex; flex-direction: column; gap: 7px; }
.mia-rt-btn { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1.5px solid #2bc016; background: #fff; color: #16730d; font-size: 13px; font-weight: 700; cursor: pointer; transition: background-color 0.15s ease; }
.mia-rt-btn:hover { background: #f0fdf0; }
.mia-rt-btn--primary { background: linear-gradient(135deg, #2bc016, #22a611); color: #fff; border-color: transparent; }
.mia-rt-btn--primary:hover { background: #209910; }
.mia-rt-btn.is-loading { opacity: 0.75; cursor: wait; }
.mia-rt-btn.is-added { background: #f0fdf0; color: #276749; border-color: #2bc016; }
.mia-rt-btn.is-error { border-color: #c53030; color: #c53030; background: #fff; }
.mia-rt-cartlink { margin: 8px 0 0; font-size: 13px; font-weight: 700; text-align: center; }
.mia-rt-cartlink a { color: #16730d; }
.mia-rt-disclaimer { margin: 10px 0 0; font-size: 11px; line-height: 1.45; color: #718096; }

@media (max-width: 380px) {
    .mia-rt-choices { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .mia-rt-view, .mia-rt-card { animation: none; }
}
/* ===== 1.7.0 ===== */
/* „Vezi coșul” compact, inline */
.mia-product-list .mia-view-cart,
.mia-view-cart {
    display: inline-flex; width: auto; align-self: flex-start;
    margin: 8px 12px 10px; padding: 4px 12px;
    font-size: 12px; font-weight: 600; line-height: 1.5;
    color: #16730d; background: transparent;
    border: 1px solid #cfe6cb; border-top: 1px solid #cfe6cb; border-radius: 999px;
}
.mia-view-cart:hover { background: #f3fbf2; }
.mia-product-list:has(.mia-view-cart) { display: flex; flex-direction: column; }
/* Listă coș */
.mia-cart-list { list-style: none; margin: 0; padding: 4px 0; background: #fff; border: 1px solid #eef2ee; border-radius: 12px; }
.mia-cart-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 12px; font-size: 13px; border-top: 1px solid #f1f4f1; }
.mia-cart-list li:first-child { border-top: 0; }
.mia-cart-list-name { color: #1f2a1f; }
.mia-cart-list-meta { color: #5b6b5b; white-space: nowrap; }
.mia-cart-list + .mia-shipping-nudge { margin-top: 8px; }
/* Confirmare finalizare */
.mia-checkout-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mia-checkout-go { display: inline-flex; align-items: center; gap: 4px; padding: 7px 14px; border-radius: 999px; background: #22a611; color: #fff !important; font-size: 13px; font-weight: 600; text-decoration: none; }
.mia-checkout-go:hover { background: #1c8f0e; }
.mia-checkout-count { opacity: .8; font-weight: 400; }
.mia-checkout-cancel { padding: 6px 12px; border-radius: 999px; border: 1px solid #d9e2d9; background: #fff; color: #3d4b3d; font-size: 12px; cursor: pointer; }
.mia-checkout-note { flex-basis: 100%; margin: 2px 0 0; font-size: 11.5px; color: #6b7a6b; }
/* Onboarding */
.mia-onboard { position: relative; margin: 0 0 10px; padding: 10px 30px 10px 12px; border: 1px dashed #cfe6cb; border-radius: 12px; background: #f8fcf7; font-size: 12.5px; color: #2c3a2c; }
.mia-onboard strong { display: block; font-size: 13px; margin-bottom: 2px; }
.mia-onboard p { margin: 0 0 6px; }
.mia-onboard-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mia-onboard-close { position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 16px; line-height: 1; color: #6b7a6b; cursor: pointer; padding: 4px; }
/* Microfon */
#mia-mic { flex: 0 0 auto; width: 40px; height: 40px; margin-right: 6px; border-radius: 50%; border: 1px solid #e2e8f0; background: #fff; color: #3d4b3d; display: flex; align-items: center; justify-content: center; cursor: pointer; }
#mia-mic[hidden] { display: none; }
#mia-mic:hover { border-color: #2bc016; color: #16730d; }
#mia-mic.is-listening { background: #e5484d; border-color: #e5484d; color: #fff; animation: miaMicPulse 1.2s ease-in-out infinite; }
@keyframes miaMicPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(229,72,77,.45); } 50% { box-shadow: 0 0 0 7px rgba(229,72,77,0); } }
@media (prefers-reduced-motion: reduce) { #mia-mic.is-listening { animation: none; } }
/* ===== 1.7.2 – culoare brand (portocaliu farmaciabiomedica.ro) + contrast la hover ===== */
#mia-chat-container { --mia-orange: #fc4700; --mia-orange-dark: #c43700; --mia-orange-soft: #fff3ec; }
/* Tema site-ului pune button:hover {background;color:#fff}: fixăm explicit stările Mia */
#mia-chat-container .mia-qr:hover,
#mia-chat-container .mia-qr:focus-visible { background: #f0fdf0; border-color: #2bc016; color: #16730d; }
#mia-chat-container .mia-quick-replies--choice .mia-qr:hover { color: #16730d; }
#mia-chat-container .mia-rt-choice:hover,
#mia-chat-container .mia-rt-choice:focus-visible { background: #f0fdf0; border-color: #2bc016; color: #1f2a1f; }
#mia-chat-container .mia-rt-btn:hover { background: #f0fdf0; color: #16730d; }
#mia-chat-container .mia-rt-btn--primary:hover { background: #209910; color: #fff; }
#mia-chat-container .mia-rt-add:hover { background: transparent; color: #1a7a10; }
#mia-chat-container .mia-feedback-btn:hover { color: #16730d; }
#mia-chat-container .mia-checkout-cancel:hover { background: #fff; color: var(--mia-orange-dark); border-color: var(--mia-orange); }
#mia-chat-container .mia-onboard-close:hover { background: none; color: var(--mia-orange-dark); }
#mia-chat-container #mia-new-chat:hover { color: var(--mia-orange-dark); }
/* Chip rutină evidențiat portocaliu */
#mia-chat-container .mia-qr.mia-qr--routine { background: var(--mia-orange-soft); border-color: var(--mia-orange); color: var(--mia-orange-dark); font-weight: 700; }
#mia-chat-container .mia-qr.mia-qr--routine:hover,
#mia-chat-container .mia-qr.mia-qr--routine:focus-visible { background: #ffe6d6; border-color: var(--mia-orange-dark); color: #9a2c00; }
/* „Înapoi la chat” / „Începe din nou”: fără fundal, text portocaliu la hover */
#mia-chat-container .mia-rt-link,
#mia-chat-container .mia-rt-link:hover,
#mia-chat-container .mia-rt-link:focus { background: none; box-shadow: none; }
#mia-chat-container .mia-rt-link:hover,
#mia-chat-container .mia-rt-link:focus-visible { color: var(--mia-orange); text-decoration: none; }
/* Rol „Alternativă” */
#mia-chat-container .mia-rt-role.is-alt { background: var(--mia-orange-soft); color: var(--mia-orange-dark); }
/* Rezumat coș */
.mia-cart-summary { padding: 10px 12px; border-left: 3px solid var(--mia-orange, #fc4700); background: var(--mia-orange-soft, #fff3ec); border-radius: 8px; font-size: 13px; line-height: 1.5; color: #2c2c2c; }
.mia-cart-summary strong { color: var(--mia-orange-dark, #c43700); }
.mia-cart-progress { display: block; height: 4px; margin-top: 7px; border-radius: 4px; background: #ffd9c4; overflow: hidden; }
.mia-cart-progress > span { display: block; height: 100%; background: var(--mia-orange, #fc4700); border-radius: 4px; }
/* Microfon portocaliu */
#mia-chat-container #mia-mic { border-color: var(--mia-orange); color: var(--mia-orange); background: #fff; }
#mia-chat-container #mia-mic:hover { background: var(--mia-orange-soft); color: var(--mia-orange-dark); border-color: var(--mia-orange-dark); }
#mia-chat-container #mia-mic.is-listening { background: var(--mia-orange); border-color: var(--mia-orange); color: #fff; animation: miaMicPulseO 1.2s ease-in-out infinite; }
@keyframes miaMicPulseO { 0%,100% { box-shadow: 0 0 0 0 rgba(252,71,0,.45); } 50% { box-shadow: 0 0 0 7px rgba(252,71,0,0); } }
.mia-msg-mic-error .mia-msg-content { border-left: 3px solid #fc4700; }
