/* DermaOnline Chatbot – culori și stiluri aliniate la site, responsiv */

.derma-chatbot {
    --derma-primary: #1565c0;
    --derma-primary-dark: #0d47a1;
    --derma-bg: #ffffff;
    --derma-bg-msg-bot: #f5f8fc;
    --derma-bg-msg-user: #e3f2fd;
    --derma-text: #333333;
    --derma-border: #bbdefb;
    --derma-shadow: rgba(21, 101, 192, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    box-sizing: border-box;
}

.derma-chatbot *,
.derma-chatbot *::before,
.derma-chatbot *::after {
    box-sizing: border-box;
}

/* Buton flotant – dreapta, ridicat ca să nu acopere butonul To Top */
#derma-chatbot-widget .derma-chatbot-toggle {
    position: fixed;
    bottom: 70px;
    right: 20px;
    left: auto;
    z-index: 999998;
    min-width: 56px;
    height: 56px;
    padding: 0 18px;
    border: none;
    border-radius: 999px !important;
    background: var(--derma-primary);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--derma-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.2s, transform 0.2s;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
}

.derma-chatbot-toggle:hover {
    background: var(--derma-primary-dark);
    transform: scale(1.02);
}

.derma-chatbot-toggle:active {
    transform: scale(0.98);
}

.derma-chatbot-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center/contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.derma-chatbot-toggle-text {
    white-space: nowrap;
}

/* Panou chat – deschide din dreapta */
.derma-chatbot-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    left: auto;
    z-index: 999999;
    width: 100%;
    max-width: 400px;
    max-height: 85vh;
    height: 560px;
    background: var(--derma-bg);
    border: 1px solid var(--derma-border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px var(--derma-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

.derma-chatbot-panel[hidden] {
    display: none !important;
}

.derma-chatbot-header {
    flex-shrink: 0;
    padding: 14px 16px;
    background: var(--derma-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.derma-chatbot-title {
    font-weight: 600;
    font-size: 1rem;
}

.derma-chatbot-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.12);
    color: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 999px !important;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.derma-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.derma-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--derma-bg-msg-bot);
    -webkit-overflow-scrolling: touch;
}

.derma-msg {
    margin-bottom: 12px;
    max-width: 90%;
}

.derma-msg-user {
    margin-left: auto;
}

.derma-msg-user .derma-msg-content {
    background: var(--derma-primary);
    color: #fff;
    padding: 10px 14px;
    border-radius: 14px 14px 4px 14px;
}

.derma-msg-bot .derma-msg-content {
    background: var(--derma-bg);
    color: var(--derma-text);
    padding: 10px 14px;
    border-radius: 14px 14px 14px 4px;
    border: 1px solid var(--derma-border);
}

.derma-msg-content p {
    margin: 0 0 8px 0;
}

.derma-msg-content p:last-child {
    margin-bottom: 0;
}

.derma-msg-content strong {
    font-weight: 600;
}

.derma-msg-content a {
    color: var(--derma-primary);
    text-decoration: underline;
}
.derma-msg-content a:hover {
    color: var(--derma-primary-dark);
}

.derma-msg-content a[href^="tel:"] {
    color: var(--derma-primary);
    text-decoration: underline;
    white-space: nowrap;
}

.derma-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0 8px 0;
}

.derma-quick-btn {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 36px;
    padding: 8px 14px;
    border: 2px solid var(--derma-primary);
    border-radius: 12px !important;
    background: var(--derma-primary);
    color: #fff !important;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.1s;
    position: relative;
    z-index: 2;
    pointer-events: auto;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.derma-quick-btn:hover {
    background: var(--derma-primary-dark);
    color: #fff !important;
    border-color: var(--derma-primary-dark);
    transform: translateY(-1px);
}

.derma-quick-btn:active {
    transform: translateY(0);
}

.derma-quick-hint {
    margin-top: 4px;
    font-size: 13px;
    color: #666;
}

.derma-msg-links {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.derma-link-btn {
    display: inline-block;
    padding: 8px 12px;
    background: var(--derma-primary);
    color: #fff !important;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    transition: background 0.2s;
}

.derma-link-btn:hover {
    background: var(--derma-primary-dark);
    color: #fff;
}

.derma-loading {
    padding: 10px 14px;
}

.derma-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.derma-typing span {
    width: 8px;
    height: 8px;
    background: var(--derma-primary);
    border-radius: 50%;
    animation: derma-bounce 0.6s ease-in-out infinite;
}

.derma-typing span:nth-child(2) { animation-delay: 0.15s; }
.derma-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes derma-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.derma-chatbot-input-wrap {
    flex-shrink: 0;
    padding: 12px 16px;
    background: var(--derma-bg);
    border-top: 1px solid var(--derma-border);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
}

.derma-chatbot-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 42px;
    max-height: 120px;
    padding: 10px 12px;
    border: 1px solid var(--derma-border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.35;
    resize: none;
    overflow-y: auto;
    transition: border-color 0.2s;
}

.derma-chatbot-input::placeholder {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.derma-chatbot-input:focus {
    outline: none;
    border-color: var(--derma-primary);
}

.derma-chatbot-send {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 48px;
    width: auto;
    min-height: 44px;
    height: 44px;
    padding: 0 16px;
    background: var(--derma-primary);
    color: #fff;
    border: none;
    border-radius: 14px !important;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--derma-shadow);
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
}

.derma-chatbot-send:hover:not(:disabled) {
    background: var(--derma-primary-dark);
    box-shadow: 0 4px 12px var(--derma-shadow);
    transform: translateY(-1px);
}

.derma-chatbot-send:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px var(--derma-shadow);
}

.derma-chatbot-send:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.derma-send-icon {
    width: 18px;
    height: 18px;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2L11 13'/%3E%3Cpath d='M22 2L15 22L11 13L2 9L22 2Z'/%3E%3C/svg%3E") center/contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2L11 13'/%3E%3Cpath d='M22 2L15 22L11 13L2 9L22 2Z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.derma-send-text {
    white-space: nowrap;
}

/* Mobil – același format ca Mango Creditaki: fereastră cu margin, dimensiuni fixe */
@media (max-width: 640px) {
    #derma-chatbot-widget {
        left: auto;
        right: 12px;
        bottom: 12px;
    }

    .derma-chatbot-toggle {
        left: auto;
        right: 12px;
        bottom: 60px;
        max-width: calc(100vw - 24px);
        height: 48px;
        padding: 0 16px;
        gap: 6px;
        border-radius: 999px !important;
        font-size: 15px;
    }

    .derma-chatbot-toggle-text {
        font-size: 14px;
    }

    .derma-chatbot-icon {
        width: 18px;
        height: 18px;
    }

    /* Fereastră ca la Mango: margin 12px, nu full-screen, colțuri rotunjite */
    .derma-chatbot-panel {
        left: auto;
        right: 12px;
        bottom: 12px;
        top: auto;
        width: min(360px, calc(100vw - 24px));
        max-width: min(360px, calc(100vw - 24px));
        max-height: calc(100vh - 24px);
        height: auto;
        min-height: 400px;
        border-radius: 20px;
        box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
    }

    .derma-chatbot-header {
        padding: 12px 16px;
        font-size: 15px;
    }

    .derma-chatbot-close {
        width: 28px;
        height: 28px;
        font-size: 20px;
        border-radius: 999px;
    }

    /* Zona mesaje – înălțime ca la Mango */
    .derma-chatbot-messages {
        flex: none;
        height: min(380px, calc(100vh - 220px));
        padding: 12px 14px;
        -webkit-overflow-scrolling: touch;
    }

    .derma-msg {
        max-width: 90%;
        margin-bottom: 10px;
        font-size: 15px;
    }

    .derma-msg-user .derma-msg-content,
    .derma-msg-bot .derma-msg-content {
        padding: 10px 12px;
        border-radius: 18px;
    }

    /* Zona input + Trimite – la fel ca Mango: padding 8px 10px, gap 8px */
    .derma-chatbot-input-wrap {
        padding: 8px 10px;
        gap: 8px;
        align-items: center;
        background: #f5f5f5;
        border-top: 1px solid rgba(15, 23, 42, 0.06);
    }

    .derma-chatbot-input {
        flex: 1;
        min-width: 0;
        min-height: 34px;
        max-height: 100px;
        height: auto;
        padding: 10px 12px;
        font-size: 15px;
        border-radius: 999px;
        border: none;
        background: #fff;
    }

    .derma-chatbot-input:focus {
        box-shadow: 0 0 0 1px var(--derma-primary);
    }

    /* Buton Trimite – pill 34px înălțime, colțuri rotunjite */
    .derma-chatbot-send {
        flex-shrink: 0;
        height: 34px;
        min-height: 34px;
        padding: 0 16px;
        border-radius: 999px !important;
        font-size: 15px;
        box-shadow: none;
    }

    .derma-quick-btn {
        border-radius: 12px !important;
        min-height: 36px;
        padding: 8px 14px;
        font-size: 14px;
    }

    .derma-chatbot-send:hover:not(:disabled) {
        transform: none;
        filter: brightness(1.05);
    }

    .derma-chatbot-send:active:not(:disabled) {
        transform: scale(0.96);
    }

    .derma-send-icon {
        width: 16px;
        height: 16px;
    }
}

/* Branding line */
.derma-chatbot-brand {
    flex-shrink: 0;
    padding: 10px 16px 12px 16px;
    background: var(--derma-bg);
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    font-family: inherit;
    font-size: 11px;
    line-height: 1.2;
    color: rgba(100, 116, 139, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

.derma-chatbot-brand a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

.derma-chatbot-brand a:hover {
    color: var(--derma-primary-dark);
}

@media (max-width: 640px) {
    .derma-chatbot-brand {
        padding: 8px 10px 10px 10px;
        background: #f5f5f5;
        border-top: 1px solid rgba(15, 23, 42, 0.06);
        font-size: 11px;
    }
}
