/**
 * WhatsApp Business Pro - Public Styles
 */

/* Variables - can be overridden via inline styles */
:root {
    --wbp-button-color: #25D366;
    --wbp-icon-color: #ffffff;
    --wbp-button-size: 60px;
    --wbp-border-radius: 50%;
    --wbp-z-index: 9999;
    --wbp-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --wbp-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Button Wrapper */
.wbp-button-wrapper {
    position: fixed;
    z-index: var(--wbp-z-index);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Main Button */
.wbp-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--wbp-button-size);
    height: var(--wbp-button-size);
    background-color: var(--wbp-button-color);
    color: var(--wbp-icon-color);
    border: none;
    border-radius: var(--wbp-border-radius);
    cursor: pointer;
    box-shadow: var(--wbp-shadow);
    transition: all 0.3s ease;
    padding: 0;
    outline: none;
}

.wbp-button:hover {
    transform: scale(1.1);
    box-shadow: var(--wbp-shadow-hover);
}

.wbp-button:active {
    transform: scale(1.05);
}

.wbp-button-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.wbp-button-icon svg {
    width: calc(var(--wbp-button-size) * 0.55);
    height: calc(var(--wbp-button-size) * 0.55);
}

/* Button with text */
.wbp-button-with-text {
    width: auto;
    padding: 0 20px;
    gap: 8px;
}

.wbp-button-with-text .wbp-button-icon svg {
    width: 24px;
    height: 24px;
}

.wbp-button-text {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

/* Notification Badge */
.wbp-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    font-size: 12px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* Animations */
.wbp-animation-pulse .wbp-button {
    animation: wbp-pulse 2s infinite;
}

.wbp-animation-bounce .wbp-button {
    animation: wbp-bounce 2s infinite;
}

.wbp-animation-shake .wbp-button {
    animation: wbp-shake 3s infinite;
}

@keyframes wbp-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes wbp-bounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-10px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-5px); }
}

@keyframes wbp-shake {
    0%, 90%, 100% { transform: rotate(0deg); }
    92% { transform: rotate(5deg); }
    94% { transform: rotate(-5deg); }
    96% { transform: rotate(5deg); }
    98% { transform: rotate(-5deg); }
}

/* Tooltip */
.wbp-tooltip {
    position: absolute;
    background: white;
    color: #333;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: var(--wbp-shadow);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: wbp-fadeIn 0.3s ease;
}

.wbp-position-bottom-right .wbp-tooltip,
.wbp-position-top-right .wbp-tooltip {
    right: calc(var(--wbp-button-size) + 15px);
}

.wbp-position-bottom-left .wbp-tooltip,
.wbp-position-top-left .wbp-tooltip {
    left: calc(var(--wbp-button-size) + 15px);
}

.wbp-position-bottom-right .wbp-tooltip::after,
.wbp-position-bottom-left .wbp-tooltip::after {
    content: "";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
}

.wbp-position-bottom-right .wbp-tooltip::after,
.wbp-position-top-right .wbp-tooltip::after {
    right: -14px;
    border-left-color: white;
}

.wbp-position-bottom-left .wbp-tooltip::after,
.wbp-position-top-left .wbp-tooltip::after {
    left: -14px;
    border-right-color: white;
}

.wbp-tooltip-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}

.wbp-tooltip-close:hover {
    color: #333;
}

/* CTA Bubble */
.wbp-cta-bubble {
    position: absolute;
    background: var(--wbp-button-color);
    color: var(--wbp-icon-color);
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--wbp-shadow);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: wbp-slideIn 0.3s ease;
}

.wbp-position-bottom-right .wbp-cta-bubble,
.wbp-position-top-right .wbp-cta-bubble {
    right: calc(var(--wbp-button-size) + 15px);
}

.wbp-position-bottom-left .wbp-cta-bubble,
.wbp-position-top-left .wbp-cta-bubble {
    left: calc(var(--wbp-button-size) + 15px);
}

.wbp-cta-close {
    background: rgba(255,255,255,0.3);
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    color: inherit;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

@keyframes wbp-slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes wbp-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modals */
.wbp-modal {
    position: fixed;
    z-index: calc(var(--wbp-z-index) + 1);
    animation: wbp-modalIn 0.3s ease;
}

.wbp-position-bottom-right .wbp-modal {
    bottom: calc(var(--wbp-button-size) + 30px);
    right: 20px;
}

.wbp-position-bottom-left .wbp-modal {
    bottom: calc(var(--wbp-button-size) + 30px);
    left: 20px;
}

.wbp-position-top-right .wbp-modal {
    top: calc(var(--wbp-button-size) + 30px);
    right: 20px;
}

.wbp-position-top-left .wbp-modal {
    top: calc(var(--wbp-button-size) + 30px);
    left: 20px;
}

@keyframes wbp-modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.wbp-modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 320px;
    max-width: calc(100vw - 40px);
    overflow: hidden;
}

.wbp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.wbp-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.wbp-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}

.wbp-modal-close:hover {
    color: #333;
}

.wbp-modal-body {
    padding: 20px;
}

/* Branded Modal Header */
.wbp-modal-header-branded {
    background: var(--wbp-button-color);
    color: white;
    border-bottom: none;
    padding: 20px;
    display: flex;
    gap: 15px;
}

.wbp-modal-header-branded .wbp-modal-close {
    color: rgba(255,255,255,0.8);
    position: absolute;
    right: 15px;
    top: 15px;
}

.wbp-modal-header-branded .wbp-modal-close:hover {
    color: white;
}

.wbp-modal-header-icon {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wbp-modal-header-icon svg {
    width: 30px;
    height: 30px;
}

.wbp-modal-header-text h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
}

.wbp-modal-header-text p {
    margin: 0;
    opacity: 0.9;
    font-size: 13px;
}

/* Agent Selector */
.wbp-agent-subtitle {
    color: #666;
    margin: 0 0 15px 0;
    font-size: 14px;
}

.wbp-agents-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wbp-agent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: #f8f9fa;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: all 0.2s ease;
}

.wbp-agent-item:hover {
    background: #e9ecef;
}

.wbp-agent-item:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wbp-agent-avatar {
    position: relative;
    width: 45px;
    height: 45px;
    flex-shrink: 0;
}

.wbp-agent-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.wbp-agent-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: var(--wbp-button-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
}

.wbp-agent-status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}

.wbp-status-online {
    background: #28a745;
}

.wbp-status-offline {
    background: #dc3545;
}

.wbp-agent-info {
    flex: 1;
    min-width: 0;
}

.wbp-agent-name {
    display: block;
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.wbp-agent-title {
    display: block;
    font-size: 13px;
    color: #666;
}

.wbp-agent-arrow {
    color: #999;
}

/* Pre-chat Form */
.wbp-prechat-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.wbp-form-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #333;
}

.wbp-form-field input,
.wbp-form-field textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.wbp-form-field input:focus,
.wbp-form-field textarea:focus {
    outline: none;
    border-color: var(--wbp-button-color);
}

.wbp-form-field textarea {
    resize: vertical;
    min-height: 80px;
}

.wbp-submit-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: var(--wbp-button-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wbp-submit-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.wbp-submit-button svg {
    flex-shrink: 0;
}

/* Offline Modal */
.wbp-offline-modal .wbp-modal-body p {
    margin: 0 0 20px 0;
    color: #666;
    line-height: 1.5;
}

.wbp-button-secondary {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wbp-button-secondary:hover {
    background: #e9ecef;
}

/* Offline State */
.wbp-offline .wbp-button {
    opacity: 0.7;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .wbp-modal-content {
        width: calc(100vw - 40px);
    }

    .wbp-position-bottom-right .wbp-modal,
    .wbp-position-bottom-left .wbp-modal {
        left: 20px;
        right: 20px;
    }

    .wbp-tooltip {
        display: none !important;
    }
}

/* Hide on print */
@media print {
    .wbp-button-wrapper {
        display: none !important;
    }
}
