/* Chatbot Widget - Autobro */

/* Trigger Wrapper */
.chatbot-trigger-wrapper {
    position: fixed;
    bottom: 100px;
    left: 20px;
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    gap: 0;
}

.chatbot-trigger-wrapper.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Buton Dismiss (X) */
.chatbot-dismiss {
    position: absolute;
    top: -64px;
    left: -10px;
    width: 24px;
    height: 24px;
    background: #fff;
    color: #999;
    border: 2px solid #eee;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    opacity: 0;
    pointer-events: none;
}

.chatbot-trigger-wrapper:hover .chatbot-dismiss {
    opacity: 1;
    pointer-events: auto;
}

.chatbot-dismiss:hover {
    background: #ff4444;
    color: #fff;
    border-color: #ff4444;
    transform: scale(1.15);
}

/* Buton Trigger */
.chatbot-trigger {
    position: relative;
    bottom: auto;
    right: auto;
    background: #013950;
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    top: -4em;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(1, 57, 80, 0.3);
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    font-family: inherit;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

.chatbot-trigger:hover {
    background: #025a7a;
    box-shadow: 0 4px 16px rgba(1, 57, 80, 0.4);
    transform: translateY(-2px);
}

.chatbot-trigger i {
    font-size: 15px;
}

.chatbot-trigger.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

/* Link restore */
.chatbot-restore {
    position: fixed;
    bottom: 20px;
    left: 20px;
    color: #013950;
    font-size: 12px;
    cursor: pointer;
    z-index: 9996;
    opacity: 0;
    pointer-events: none;
    text-decoration: underline;
    transition: opacity 0.25s;
}

.chatbot-restore.visible {
    opacity: 0.7;
    pointer-events: auto;
}

.chatbot-restore:hover {
    opacity: 1;
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    left: 20px;
    width: 320px;
    max-height: 460px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.chatbot-header {
    background: #013950;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-header h4 i {
    font-size: 16px;
    opacity: 0.9;
}

.chatbot-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.chatbot-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    max-height: 300px;
    background: linear-gradient(180deg, #f8f9fa 0%, #fff 100%);
}

.chatbot-message {
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(8px);
    animation: msgFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes msgFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message.bot .message-content {
    background: #fff;
    color: #333;
    border-radius: 2px 12px 12px 12px;
    padding: 12px 14px;
    max-width: 88%;
    display: inline-block;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    font-size: 13px;
    line-height: 1.5;
}

.chatbot-message.user {
    text-align: right;
}

.chatbot-message.user .message-content {
    background: #013950;
    color: #fff;
    border-radius: 12px 12px 2px 12px;
    padding: 12px 14px;
    max-width: 88%;
    display: inline-block;
    font-size: 13px;
    line-height: 1.5;
}

/* Input Area */
.chatbot-input-area {
    padding: 14px;
    background: #fff;
    border-top: 1px solid #eee;
    opacity: 0;
    animation: inputFadeIn 0.3s 0.1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes inputFadeIn {
    to { opacity: 1; }
}

.chatbot-input-area input[type="text"],
.chatbot-input-area input[type="tel"],
.chatbot-input-area textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chatbot-input-area input:focus,
.chatbot-input-area textarea:focus {
    border-color: #013950;
    box-shadow: 0 0 0 3px rgba(1, 57, 80, 0.1);
}

.chatbot-input-area textarea {
    resize: none;
    height: 60px;
}

/* Option Buttons */
.chatbot-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chatbot-option-btn {
    padding: 10px 18px;
    border: 1px solid #013950;
    background: #fff;
    color: #013950;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-option-btn:hover {
    background: #013950;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(1, 57, 80, 0.25);
}

.chatbot-option-btn.selected {
    background: #013950;
    color: #fff;
}

/* Submit Button */
.chatbot-submit-btn {
    width: 100%;
    padding: 12px;
    background: #013950;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-submit-btn:hover {
    background: #025a7a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(1, 57, 80, 0.3);
}

/* Typing indicator */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 0;
}

.chatbot-typing span {
    width: 7px;
    height: 7px;
    background: #013950;
    border-radius: 50%;
    opacity: 0.4;
    animation: typingPulse 1.4s infinite;
}

.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* Error */
.chatbot-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 6px;
    animation: shake 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Success */
.chatbot-success {
    text-align: center;
    padding: 30px 20px;
    animation: successPop 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes successPop {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

.chatbot-success i {
    font-size: 48px;
    color: #28a745;
    margin-bottom: 14px;
    display: block;
    animation: checkPop 0.5s 0.1s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes checkPop {
    0% { opacity: 0; transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

.chatbot-success h5 {
    color: #333;
    margin: 0 0 8px 0;
    font-size: 17px;
}

.chatbot-success p {
    color: #666;
    font-size: 13px;
    margin: 0;
}

@media(max-width: 992px){
    .chatbot-trigger{
    display: none;
}
}
/* Tablet */
@media (max-width: 768px) {
    .chatbot-window {
        width: 300px;
        bottom: 140px;
        left: 15px;
    }

    .chatbot-trigger-wrapper {
        bottom: 65px;
        left: 12px;
    }

    .chatbot-trigger {
        padding: 9px 14px;
        font-size: 12px;
    }

    .chatbot-dismiss {
        width: 20px;
        height: 20px;
        font-size: 14px;
        top: -6px;
        left: -6px;
    }
}

/* Mobile */
@media (max-width: 520px) {
    .chatbot-window {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: none;
        height: 100%;
        border-radius: 0;
        transform: translateY(100%);
        box-shadow: none;
    }

    .chatbot-window.active {
        transform: translateY(0);
    }

    .chatbot-header {
        padding: 16px;
        padding-top: max(16px, env(safe-area-inset-top));
    }

    .chatbot-header h4 {
        font-size: 15px;
    }

    .chatbot-close {
        font-size: 28px;
        padding: 4px;
    }

    .chatbot-messages {
        flex: 1;
        max-height: none;
        padding: 16px;
        padding-bottom: 8px;
    }

    .chatbot-message.bot .message-content,
    .chatbot-message.user .message-content {
        max-width: 85%;
        padding: 12px 16px;
        font-size: 14px;
    }

    .chatbot-input-area {
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        border-top: 1px solid #e5e5e5;
    }

    .chatbot-input-area input,
    .chatbot-input-area textarea {
        padding: 14px 16px;
        font-size: 16px; /* Previne zoom pe iOS */
        border-radius: 10px;
    }

    .chatbot-input-area textarea {
        height: 70px;
    }

    .chatbot-submit-btn {
        padding: 14px;
        font-size: 15px;
        border-radius: 10px;
    }

    .chatbot-options {
        gap: 10px;
    }

    .chatbot-option-btn {
        padding: 12px 20px;
        font-size: 14px;
        border-radius: 25px;
    }

    /* Hide the floating chatbot trigger on mobile - it's now in footer */
    .chatbot-trigger-wrapper {
        display: none !important;
    }

    .chatbot-restore {
        display: none !important;
    }

    .chatbot-success {
        padding: 40px 24px;
    }

    .chatbot-success i {
        font-size: 56px;
    }

    .chatbot-success h5 {
        font-size: 20px;
    }

    .chatbot-success p {
        font-size: 14px;
    }

    .chatbot-error {
        font-size: 13px;
        margin-top: 8px;
    }
}

/* Extra small phones */
@media (max-width: 360px) {
    .chatbot-header {
        padding: 14px;
    }

    .chatbot-messages {
        padding: 12px;
    }

    .chatbot-input-area {
        padding: 10px 12px;
    }

    .chatbot-option-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .chatbot-window {
        height: 100%;
    }

    .chatbot-messages {
        max-height: calc(100vh - 130px);
    }

    .chatbot-header {
        padding: 10px 14px;
    }

    .chatbot-input-area {
        padding: 8px 12px;
    }
}
