/* ====================================
   Modern Chatbox Plugin - Style.css
   Version: 3.0
   ==================================== */

/* CSS Variables */
:root {
    --primary-color: #25D366;
    --primary-dark: #128C7E;
    --secondary-color: #34B7F1;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Main Chatbox Container */
#chatbox {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Floating Trigger Button */
#chatbox-trigger {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    color: white;
}

#chatbox-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(37, 211, 102, 0.4);
}

#chatbox-trigger:active {
    transform: scale(0.95);
}

/* Notification Badge */
.chatbox-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid white;
    animation: pulse-badge 2s infinite;
}

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

/* Pulse Animation for Trigger */
@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

#chatbox.chatbox-minimized #chatbox-trigger {
    animation: pulse-ring 2s infinite;
}

/* Chat Window */
#chatbox-window {
    display: none;
    width: 380px;
    max-height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: absolute;
    bottom: 0;
    right: 0;
    flex-direction: column;
}

#chatbox.chatbox-expanded #chatbox-window {
    display: flex;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#chatbox.chatbox-expanded #chatbox-trigger {
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
#chatbox-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

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

.status-online {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-online::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#minimize-btn {
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#minimize-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Content */
#chatbox-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-light);
    max-height: 480px;
}

/* Screens */
.chat-screen {
    display: none;
    animation: fadeIn 0.3s;
}

.chat-screen.active {
    display: block;
}

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

/* Chat Messages */
.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    animation: slideInMessage 0.3s;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    max-width: 85%;
}

.message-content p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-dark);
}

.message-content p:last-child {
    margin-bottom: 0;
}

.offer-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.btn-whatsapp,
.btn-form {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.btn-whatsapp {
    background: var(--primary-color);
    color: white;
}

.btn-whatsapp:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
}

.btn-form {
    background: white;
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-form:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-whatsapp:active,
.btn-form:active {
    transform: scale(0.98);
}

/* Back Button */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-dark);
    cursor: pointer;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.back-btn:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
}

/* Form Container */
#form-container {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-top: 16px;
}

/* Contact Form 7 Styles */
.wpcf7-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wpcf7-form p {
    margin: 0;
}

.wpcf7-form-control-wrap {
    display: block;
    width: 100%;
}

.wpcf7-text,
.wpcf7-textarea,
.wpcf7-tel,
.wpcf7-email {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.wpcf7-text:focus,
.wpcf7-textarea:focus,
.wpcf7-tel:focus,
.wpcf7-email:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.wpcf7-submit {
    width: 100%;
    padding: 14px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
}

.wpcf7-submit:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
}

.wpcf7-submit:active {
    transform: scale(0.98);
}

/* Form Response Messages */
.wpcf7-response-output {
    margin: 12px 0 0 0;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    border: none;
}

.wpcf7-mail-sent-ok {
    background: #d1fae5;
    color: #065f46;
}

.wpcf7-validation-errors,
.wpcf7-acceptance-missing {
    background: #fee2e2;
    color: #991b1b;
}

/* Validation Errors */
span.wpcf7-not-valid-tip {
    font-size: 12px;
    color: #ef4444;
    margin-top: 4px;
    display: block;
}

/* Loading State */
.wpcf7-form.submitting .wpcf7-submit {
    opacity: 0.6;
    cursor: not-allowed;
}

.wpcf7-form.submitting .wpcf7-submit::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Scrollbar Styling */
#chatbox-content::-webkit-scrollbar {
    width: 6px;
}

#chatbox-content::-webkit-scrollbar-track {
    background: transparent;
}

#chatbox-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

#chatbox-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #chatbox {
        right: 10px;
        bottom: 10px;
    }

    #chatbox-trigger {
        width: 56px;
        height: 56px;
    }

    #chatbox-window {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 100px);
        right: -10px;
    }

    #chatbox-content {
        padding: 16px;
    }

    .message-content {
        max-width: 90%;
    }

    .action-buttons {
        gap: 10px;
    }

    .btn-whatsapp,
    .btn-form {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* Tablet Responsive */
@media (min-width: 481px) and (max-width: 768px) {
    #chatbox-window {
        width: 360px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    #chatbox-window {
        max-height: calc(100vh - 60px);
    }
    
    #chatbox-content {
        max-height: calc(100vh - 150px);
    }
}

/* Touch Device Optimizations */
.touch-device .btn-whatsapp:hover,
.touch-device .btn-form:hover,
.touch-device #minimize-btn:hover,
.touch-device .back-btn:hover {
    transform: none;
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #chatbox-trigger,
    .btn-whatsapp,
    .btn-form {
        box-shadow: var(--shadow-md);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed */
}

/* Print Styles */
@media print {
    #chatbox {
        display: none !important;
    }
}

/* Accessibility - Focus States */
#chatbox-trigger:focus,
.btn-whatsapp:focus,
.btn-form:focus,
#minimize-btn:focus,
.back-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}