/* EMVE Chat Order Bot - iOS Style */

:root {
    --emve-primary: #007AFF;
    --emve-bg: #F2F2F7;
    --emve-bubble-user: #007AFF;
    --emve-bubble-bot: #E9E9EB;
    --emve-text-light: #FFFFFF;
    --emve-text-dark: #000000;
    --emve-border: #C7C7CC;
    --emve-success: #34C759;
    --emve-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* Chat Toggle Button */
.emve-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.4);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.emve-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 122, 255, 0.5);
}

.emve-chat-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.emve-chat-toggle.hidden {
    display: none;
}

/* Tooltip "Poți plasa comanda aici" */
.emve-chat-tooltip {
    position: fixed !important;
    bottom: 94px !important;
    right: 24px !important;
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%) !important;
    color: white !important;
    padding: 12px 18px !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif !important;
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.4) !important;
    z-index: 99998 !important;
    white-space: nowrap !important;
    opacity: 0 !important;
    -webkit-transform: translateX(100px) !important;
    -moz-transform: translateX(100px) !important;
    -ms-transform: translateX(100px) !important;
    transform: translateX(100px) !important;
    -webkit-transition: all 0.5s ease-out !important;
    -moz-transition: all 0.5s ease-out !important;
    -ms-transition: all 0.5s ease-out !important;
    transition: all 0.5s ease-out !important;
}

.emve-chat-tooltip.slide-in {
    opacity: 1 !important;
    -webkit-transform: translateX(0) !important;
    -moz-transform: translateX(0) !important;
    -ms-transform: translateX(0) !important;
    transform: translateX(0) !important;
}

.emve-chat-tooltip.slide-out {
    opacity: 0 !important;
    -webkit-transform: translateX(100px) !important;
    -moz-transform: translateX(100px) !important;
    -ms-transform: translateX(100px) !important;
    transform: translateX(100px) !important;
}

.emve-chat-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 24px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #5856D6;
}

/* Fullscreen Chat Container */
.emve-chat-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--emve-bg);
    z-index: 999999;
    display: none;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.emve-chat-container.active {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

/* Prevent body scroll when chat is open */
body.emve-chat-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Chat Header */
.emve-chat-header {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}

.emve-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.emve-chat-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emve-chat-avatar svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.emve-chat-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--emve-text-dark);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
}

.emve-chat-subtitle {
    font-size: 13px;
    color: #8E8E93;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}

.emve-chat-close {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.emve-chat-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.emve-chat-close svg {
    width: 14px;
    height: 14px;
    fill: #8E8E93;
}

/* Chat Messages Area */
.emve-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
}

/* Message Bubbles */
.emve-message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 16px;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    animation: messageIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.emve-message.bot {
    background: var(--emve-bubble-bot);
    color: var(--emve-text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 6px;
}

.emve-message.user {
    background: var(--emve-bubble-user);
    color: var(--emve-text-light);
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}

/* Quick Action Buttons */
.emve-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.emve-quick-btn {
    padding: 10px 18px;
    background: white;
    border: 1.5px solid var(--emve-primary);
    border-radius: 20px;
    color: var(--emve-primary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}

.emve-quick-btn:hover {
    background: var(--emve-primary);
    color: white;
}

/* Product Card */
.emve-product-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 12px;
    align-items: center;
    max-width: 320px;
}

.emve-product-card img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
}

.emve-product-info {
    flex: 1;
}

.emve-product-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--emve-text-dark);
    margin-bottom: 4px;
}

.emve-product-price {
    font-size: 14px;
    color: var(--emve-primary);
    font-weight: 600;
}

.emve-product-select {
    padding: 8px 14px;
    background: var(--emve-primary);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.emve-product-select:hover {
    background: #0056b3;
}

/* Form Inputs */
.emve-form-group {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin: 8px 0;
    max-width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.emve-form-label {
    font-size: 13px;
    color: #8E8E93;
    margin-bottom: 8px;
    display: block;
    font-weight: 500;
}

.emve-form-input,
.emve-form-select {
    width: 100%;
    padding: 0px 15px;
    border: 1.5px solid #E5E5EA;
    border-radius: 12px;
    font-size: 16px;
    background: #F9F9F9;
    transition: all 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
    color: #000000;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.emve-form-select {
    background: #F9F9F9 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238E8E93' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 16px center;
    padding-right: 40px;
    cursor: pointer;
}

.emve-form-select option {
    color: #000000;
    background: #FFFFFF;
    padding: 12px;
    font-size: 16px;
}

.emve-form-input:focus,
.emve-form-select:focus {
    outline: none;
    border-color: var(--emve-primary);
    background-color: white;
}

.emve-form-select:focus {
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23007AFF' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 16px center;
}

.emve-form-submit {
    width: 100%;
    padding: 16px;
    background: var(--emve-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.2s;
}

.emve-form-submit:hover {
    background: #0056b3;
}

.emve-form-submit:disabled {
    background: #C7C7CC;
    cursor: not-allowed;
}

/* Order Summary */
.emve-order-summary {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin: 12px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    max-width: 100%;
}

.emve-order-summary h4 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--emve-text-dark);
}

.emve-order-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 15px;
}

.emve-order-row:last-of-type {
    border-bottom: none;
}

.emve-order-row.total {
    font-weight: 700;
    font-size: 18px;
    color: var(--emve-text-dark);
    padding-top: 16px;
    margin-top: 8px;
    border-top: 2px solid #E5E5EA;
    border-bottom: none;
}

.emve-order-row span:last-child {
    font-weight: 600;
    color: var(--emve-primary);
}

.emve-order-row.total span:last-child {
    color: var(--emve-success);
}

/* Terms Checkbox */
.emve-terms-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 16px 0;
    font-size: 14px;
    color: #8E8E93;
}

.emve-terms-check input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-top: 2px;
    accent-color: var(--emve-primary);
    cursor: pointer;
}

.emve-terms-check a {
    color: var(--emve-primary);
    text-decoration: none;
}

.emve-terms-check a:hover {
    text-decoration: underline;
}

/* Success Message */
.emve-success-message {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.emve-success-icon {
    width: 80px;
    height: 80px;
    background: var(--emve-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    animation: successPop 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.emve-success-icon svg {
    width: 40px;
    height: 40px;
    fill: white;
}

.emve-success-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--emve-text-dark);
    margin-bottom: 8px;
}

.emve-success-order {
    font-size: 16px;
    color: #8E8E93;
}

.emve-success-order strong {
    color: var(--emve-primary);
}

/* Typing Indicator */
.emve-typing {
    display: flex;
    gap: 4px;
    padding: 16px;
    align-self: flex-start;
}

.emve-typing span {
    width: 8px;
    height: 8px;
    background: #C7C7CC;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat Input Area */
.emve-chat-input-area {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 12px 16px;
    border-top: 0.5px solid rgba(0, 0, 0, 0.1);
    display: none;
}

.emve-chat-input-area.active {
    display: flex;
    gap: 12px;
    align-items: center;
}

.emve-chat-input {
    flex: 1;
    padding: 12px 18px;
    border: none;
    border-radius: 24px;
    background: #E5E5EA;
    font-size: 16px;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}

.emve-chat-input:focus {
    background: #D1D1D6;
}

.emve-chat-send {
    width: 44px;
    height: 44px;
    background: var(--emve-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.emve-chat-send:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.emve-chat-send svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Loading Spinner */
.emve-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Quantity Selector */
.emve-quantity-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
}

.emve-qty-btn {
    width: 36px;
    height: 36px;
    background: #E5E5EA;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.emve-qty-btn:hover {
    background: #D1D1D6;
}

.emve-qty-value {
    font-size: 18px;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .emve-message {
        max-width: 85%;
    }
    
    .emve-product-card {
        max-width: 100%;
    }
    
    .emve-order-summary {
        max-width: 100%;
    }
}

/* Similar Products Grid */
.emve-similar-products {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0;
    width: 100%;
    max-width: 320px;
}

.emve-similar-product {
    background: white;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: all 0.2s;
}

.emve-similar-product:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.emve-similar-product img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
}

.emve-similar-product-info {
    flex: 1;
}

.emve-similar-product-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--emve-text-dark);
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.emve-similar-product-price {
    font-size: 13px;
    color: var(--emve-primary);
    font-weight: 600;
}

/* Original Product Card */
.emve-original-product-card {
    margin-top: 16px;
    max-width: 320px;
}

.emve-original-label {
    font-size: 13px;
    color: #8E8E93;
    margin-bottom: 8px;
    font-weight: 500;
}

.emve-original-product-card .emve-similar-product {
    border: 2px solid var(--emve-primary);
    background: #F0F7FF;
}
