/**
 * BMB WhatsApp Web Widget - Styles
 */

/* Widget Container */
#bmb-whatsapp-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Position classes */
.bmb-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.bmb-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.bmb-position-middle-right {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
}

.bmb-position-middle-left {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
}

/* WhatsApp Button */
.bmb-whatsapp-button {
    position: relative;
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.3);
    transition: all 0.3s ease;
    animation: bmb-pulse 3s infinite;
}

.bmb-whatsapp-button:hover {
    background: #128C7E;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.bmb-whatsapp-button:active {
    transform: scale(0.95);
}

/* Button icon */
.bmb-button-icon svg {
    fill: white;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

/* Pulse animation */
@keyframes bmb-pulse {
    0% {
        box-shadow: 0 4px 16px rgba(37, 211, 102, 0.3), 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    70% {
        box-shadow: 0 4px 16px rgba(37, 211, 102, 0.3), 0 0 0 10px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 4px 16px rgba(37, 211, 102, 0.3), 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* Tooltip */
.bmb-tooltip {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 250px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.bmb-whatsapp-button:hover .bmb-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Tooltip for left positions */
.bmb-position-bottom-left .bmb-tooltip,
.bmb-position-middle-left .bmb-tooltip {
    right: auto;
    left: 0;
}

.bmb-tooltip-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
}

.bmb-tooltip-header img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.bmb-tooltip-header strong {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 2px;
}

.bmb-online {
    font-size: 12px;
    color: #4CAF50;
    font-weight: 500;
}

.bmb-tooltip-body {
    padding: 12px 16px;
    font-size: 13px;
    color: #666;
}

/* Tooltip arrow */
.bmb-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 20px;
    border: 8px solid transparent;
    border-top-color: white;
}

.bmb-position-bottom-left .bmb-tooltip::after,
.bmb-position-middle-left .bmb-tooltip::after {
    right: auto;
    left: 20px;
}

/* WhatsApp Modal */
.bmb-whatsapp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 1000000;
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.bmb-whatsapp-modal.active {
    display: flex;
}

/* Modal Content */
.bmb-modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 800px;
    height: 90vh;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: bmb-modal-appear 0.3s ease-out;
    position: relative;
}

@keyframes bmb-modal-appear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Modal Header */
.bmb-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 16px 16px 0 0;
}

.bmb-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bmb-close-modal {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.bmb-close-modal:hover {
    background: #f0f0f0;
    color: #333;
}

/* Modal Body */
.bmb-modal-body {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Loading Screen */
.bmb-loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
}

.bmb-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #25D366;
    border-radius: 50%;
    animation: bmb-spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes bmb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* WhatsApp Container */
.bmb-whatsapp-container {
    flex: 1;
    position: relative;
}

#bmb-whatsapp-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0 0 16px 16px;
}

/* Fallback Options */
.bmb-fallback-options {
    padding: 20px;
    text-align: center;
}

.bmb-fallback-options h4 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 16px;
}

.bmb-option-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px;
    margin: 8px 0;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.bmb-option-btn:hover {
    border-color: #25D366;
    background: #f8fffe;
    transform: translateY(-1px);
}

.bmb-option-icon {
    font-size: 24px;
    margin-right: 12px;
    width: 40px;
    text-align: center;
}

.bmb-option-text strong {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 2px;
}

.bmb-option-text span {
    font-size: 12px;
    color: #666;
}

/* QR Code section */
.bmb-qr-option {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.bmb-qr-code {
    width: 200px;
    height: 200px;
    margin: 16px auto;
    background: #f0f0f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #666;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .bmb-modal-content {
        width: 100%;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }

    .bmb-whatsapp-modal {
        padding: 0;
    }

    .bmb-whatsapp-button {
        width: 55px;
        height: 55px;
    }

    .bmb-tooltip {
        width: 220px;
    }

    .bmb-position-bottom-right,
    .bmb-position-bottom-left {
        bottom: 15px;
    }

    .bmb-position-bottom-right {
        right: 15px;
    }

    .bmb-position-bottom-left {
        left: 15px;
    }
}

@media (max-width: 480px) {
    .bmb-whatsapp-button {
        width: 50px;
        height: 50px;
    }

    .bmb-tooltip {
        width: 200px;
        font-size: 12px;
    }

    .bmb-modal-header {
        padding: 12px 16px;
    }

    .bmb-fallback-options {
        padding: 16px;
    }

    .bmb-option-btn {
        padding: 12px;
    }
}

/* Accessibility */
.bmb-whatsapp-button:focus,
.bmb-option-btn:focus,
.bmb-close-modal:focus {
    outline: 2px solid #25D366;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .bmb-whatsapp-button {
        border: 2px solid #000;
    }

    .bmb-tooltip {
        border: 1px solid #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .bmb-whatsapp-button {
        animation: none;
    }

    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}