/* Advanced WhatsApp Floating Button - Frontend CSS */
/* assets/frontend.css */

:root {
    --awf-primary: #25D366;
    --awf-primary-hover: #128C7E;
    --awf-primary-dark: #075E54;
    --awf-success: #28a745;
    --awf-error: #dc3545;
    --awf-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --awf-border-radius: 12px;
}

/* Container & Positioning */
.awf-floating-container {
    position: fixed;
    z-index: 99999;
    font-family: var(--awf-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

.awf-floating-container * {
    box-sizing: border-box;
}

.awf-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.awf-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.awf-position-top-right {
    top: 20px;
    right: 20px;
}

.awf-position-top-left {
    top: 20px;
    left: 20px;
}

/* Floating Button */
.awf-floating-button {
    position: relative;
    width: var(--awf-button-size, 60px);
    height: var(--awf-button-size, 60px);
    background: var(--awf-bg-color, #25D366);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--awf-shadow);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.awf-floating-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.awf-button-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

.awf-whatsapp-icon {
    width: 60%;
    height: 60%;
    color: var(--awf-text-color, #ffffff);
}

.awf-custom-icon {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

/* Pulse Animation */
.awf-animated .awf-pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--awf-bg-color, #25D366);
    animation: awf-pulse 2s infinite;
    pointer-events: none;
}

.awf-animated .awf-pulse-ring-delay {
    animation-delay: 1s;
}

@keyframes awf-pulse {
    0% {
        width: 100%;
        height: 100%;
        opacity: 1;
    }
    100% {
        width: 150%;
        height: 150%;
        opacity: 0;
    }
}

/* Contact Form */
.awf-contact-form {
    position: fixed !important;
    background: #ffffff;
    border-radius: var(--awf-border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 100000;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* Form Positioning Desktop */
.awf-position-bottom-right .awf-contact-form {
    bottom: 100px;
    right: 20px;
}

.awf-position-bottom-left .awf-contact-form {
    bottom: 100px;
    left: 20px;
}

.awf-position-top-right .awf-contact-form {
    top: 100px;
    right: 20px;
}

.awf-position-top-left .awf-contact-form {
    top: 100px;
    left: 20px;
}

/* Form Sizes */
.awf-form-small {
    width: 320px;
}

.awf-form-medium {
    width: 380px;
}

.awf-form-large {
    width: 450px;
}

/* Form Header */
.awf-form-header {
    background: linear-gradient(135deg, var(--awf-bg-color, #25D366) 0%, var(--awf-primary-dark, #075E54) 100%);
    color: var(--awf-text-color, #ffffff);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    min-height: 60px;
}

.awf-form-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
    flex: 1;
    padding-right: 10px;
}

/* Close Button - FIXED */
.awf-close-button {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    color: var(--awf-text-color, #ffffff);
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
    position: relative;
}

.awf-close-button:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: rotate(90deg);
}

.awf-close-button svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: currentColor;
}

/* Form Body */
.awf-form-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.awf-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.awf-form-group {
    position: relative;
}

.awf-form-input,
.awf-form-textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: var(--awf-font-size, 16px);
    font-family: inherit;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #ffffff;
    transition: all 0.3s ease;
    outline: none;
}

.awf-form-input:focus,
.awf-form-textarea:focus {
    border-color: var(--awf-primary);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.awf-form-input.awf-error,
.awf-form-textarea.awf-error {
    border-color: var(--awf-error);
}

.awf-form-textarea {
    resize: vertical;
    min-height: 100px;
    max-height: 200px;
}

.awf-form-label {
    position: absolute;
    top: -8px;
    left: 12px;
    background: #ffffff;
    padding: 0 6px;
    font-size: 12px;
    color: #666;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.awf-form-input:focus + .awf-form-label,
.awf-form-input:not(:placeholder-shown) + .awf-form-label,
.awf-form-textarea:focus + .awf-form-label,
.awf-form-textarea:not(:placeholder-shown) + .awf-form-label {
    opacity: 1;
}

.awf-required-mark {
    color: var(--awf-error);
    margin-left: 2px;
}

.awf-error-message {
    color: var(--awf-error);
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* Submit Button */
.awf-submit-button {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--awf-bg-color, #25D366) 0%, var(--awf-primary-dark, #075E54) 100%);
    color: var(--awf-text-color, #ffffff);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.awf-submit-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.awf-submit-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.awf-submit-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.awf-spinner {
    animation: awf-spin 1s linear infinite;
}

@keyframes awf-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.awf-whatsapp-icon-small {
    width: 20px;
    height: 20px;
}

/* Form Footer */
.awf-form-footer {
    padding: 12px 24px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.awf-privacy-notice {
    text-align: center;
    color: #666;
    font-size: 12px;
    line-height: 1.4;
}

/* Message Container */
.awf-message-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100001;
}

.awf-message-content {
    background: #ffffff;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 500px;
}

.awf-message-success {
    border-left: 4px solid var(--awf-success);
}

.awf-message-error {
    border-left: 4px solid var(--awf-error);
}

.awf-message-icon {
    flex-shrink: 0;
}

.awf-message-success .awf-success-icon {
    display: block;
    color: var(--awf-success);
}

.awf-message-success .awf-error-icon {
    display: none;
}

.awf-message-error .awf-error-icon {
    display: block;
    color: var(--awf-error);
}

.awf-message-error .awf-success-icon {
    display: none;
}

.awf-message-text {
    flex: 1;
    color: #333;
    font-size: 14px;
}

.awf-message-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    transition: all 0.3s ease;
}

.awf-message-close:hover {
    color: #333;
}

/* Overlay - FIXED: Hidden by default */
.awf-overlay {
    display: none !important; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 99998;
}

/* Only show overlay when form is visible on mobile */
@media (max-width: 768px) {
    .awf-overlay.awf-active {
        display: block !important;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .awf-position-bottom-right,
    .awf-position-bottom-left {
        bottom: 15px;
    }
    
    .awf-position-bottom-right {
        right: 15px;
    }
    
    .awf-position-bottom-left {
        left: 15px;
    }
    
    /* Form becomes modal on mobile */
    .awf-contact-form {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        width: calc(100% - 40px) !important;
        max-width: 400px !important;
        max-height: 80vh;
    }
    
    .awf-form-small,
    .awf-form-medium,
    .awf-form-large {
        width: calc(100% - 40px) !important;
    }
    
    body.awf-no-scroll {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .awf-contact-form {
        width: calc(100% - 20px) !important;
        max-height: 90vh;
    }
    
    .awf-form-header {
        padding: 16px;
    }
    
    .awf-form-body {
        padding: 16px;
    }
    
    .awf-form-title {
        font-size: 16px;
    }
    
    /* Ensure close button is visible on small screens */
    .awf-close-button {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
    }
    
    .awf-close-button svg {
        width: 14px;
        height: 14px;
    }
}

/* Shake Animation for Errors */
.awf-shake {
    animation: awf-shake 0.5s;
}

@keyframes awf-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Success Animation */
.awf-success {
    animation: awf-success-pulse 0.6s;
}

@keyframes awf-success-pulse {
    0% { transform: scale(1); }
    50% { 
        transform: scale(1.05);
        background: var(--awf-success);
    }
    100% { transform: scale(1); }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .awf-contact-form {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .awf-form-input,
    .awf-form-textarea {
        background: #2a2a2a;
        border-color: #3a3a3a;
        color: #e0e0e0;
    }
    
    .awf-form-label {
        background: #1a1a1a;
        color: #999;
    }
    
    .awf-form-footer {
        background: #2a2a2a;
        border-top-color: #3a3a3a;
    }
    
    .awf-message-content {
        background: #2a2a2a;
        color: #e0e0e0;
    }
}

/* Print Styles */
@media print {
    .awf-floating-container {
        display: none !important;
    }
}

/* ===================================
   Shortcode & Widget Button Styles
   =================================== */

/* Trigger Button Base Styles */
.awf-trigger-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: #25D366;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Trigger Button Hover State */
.awf-trigger-button:hover {
    background-color: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: white;
    text-decoration: none;
}

/* Trigger Button Active State */
.awf-trigger-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Trigger Button Focus State */
.awf-trigger-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.3);
}

/* WhatsApp Icon in Trigger Button */
.awf-trigger-button .awf-trigger-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Text in Trigger Button */
.awf-trigger-button span {
    line-height: 1;
}

/* Ripple Effect for Trigger Button */
.awf-trigger-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.awf-trigger-button:active::before {
    width: 300px;
    height: 300px;
}

/* Widget Container Styles */
.widget .awf-trigger-button {
    width: 100%;
    justify-content: center;
    margin: 10px 0;
}

/* Responsive Styles for Trigger Buttons */
@media (max-width: 768px) {
    .awf-trigger-button {
        font-size: 14px;
        padding: 8px 16px;
    }
    
    .awf-trigger-button .awf-trigger-icon {
        width: 18px;
        height: 18px;
    }
}

/* Custom Button Variants (can be used with class attribute) */
.awf-trigger-button.awf-button-large {
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 30px;
}

.awf-trigger-button.awf-button-large .awf-trigger-icon {
    width: 24px;
    height: 24px;
}

.awf-trigger-button.awf-button-small {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 20px;
}

.awf-trigger-button.awf-button-small .awf-trigger-icon {
    width: 16px;
    height: 16px;
}

/* Outline Variant */
.awf-trigger-button.awf-button-outline {
    background-color: transparent;
    border: 2px solid #25D366;
    color: #25D366;
}

.awf-trigger-button.awf-button-outline:hover {
    background-color: #25D366;
    color: white;
}

/* Rounded Square Variant */
.awf-trigger-button.awf-button-square {
    border-radius: 8px;
}

/* Icon Only Variant */
.awf-trigger-button.awf-button-icon-only {
    padding: 10px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    justify-content: center;
}

.awf-trigger-button.awf-button-icon-only span {
    display: none;
}

/* Floating Animation for Trigger Button */
@keyframes awf-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.awf-trigger-button.awf-button-float {
    animation: awf-float 3s ease-in-out infinite;
}

.awf-trigger-button.awf-button-float:hover {
    animation-play-state: paused;
}

/* Integration with popular page builders */
/* Elementor */
.elementor-widget .awf-trigger-button {
    display: inline-flex;
}

/* Gutenberg Block */
.wp-block .awf-trigger-button {
    margin: 10px 0;
}

/* WPBakery */
.wpb_wrapper .awf-trigger-button {
    margin: 10px 0;
}

/* Divi */
.et_pb_module .awf-trigger-button {
    display: inline-flex;
}