/* WhatsApp & Contact Form Widget Styles */

/* WhatsApp Widget Styles */
.whatsapp-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.whatsapp-button {
    position: relative;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    animation: pulse-whatsapp 2s infinite, bounce-smooth 2s ease-in-out infinite;
}

.whatsapp-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

/* small notification badge on whatsapp button */
.whatsapp-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ef4444; /* red */
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
    animation: pulse-badge 1.5s infinite, shake 2s ease-in-out infinite;
}

@keyframes pulse-whatsapp {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4), 0 0 0 10px rgba(37, 211, 102, 0.1), 0 0 0 20px rgba(37, 211, 102, 0.05);
    }
}

@keyframes bounce-smooth {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2), 0 2px 6px rgba(239, 68, 68, 0.5);
    }
}

@keyframes shake {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    10%, 30% {
        transform: scale(1.1) rotate(-5deg);
    }
    20%, 40% {
        transform: scale(1.1) rotate(5deg);
    }
    50% {
        transform: scale(1) rotate(0deg);
    }
}

/* Contact Form Widget Styles */
.contact-form-widget {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 9999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* only button should be clickable */
}

.contact-form-button {
    /* Simple vertical side tab (no animation) */
    width: 40px;
    height: 170px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-radius: 10px 0 0 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    transition: none;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 1px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 14px 10px;
    pointer-events: auto;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Keep the icon perfectly centered */
.contact-form-button .contact-icon {
    display: block;
    flex: 0 0 auto;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .contact-form-widget {
        top: 50% !important;
        bottom: auto !important;
        right: 0 !important;
        left: auto !important;
        transform: translateY(-50%) !important;
    }

    .contact-form-button {
        width: 46px !important;
        height: 51px !important;
        border-radius: 30px 0 0 30px !important;
        font-size: 0 !important;
        padding: 0 !important;
        gap: 0 !important;
        writing-mode: horizontal-tb !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-direction: column !important;
        background: linear-gradient(135deg, #4285f4 0%, #1967d2 100%) !important;
        box-shadow: -4px 4px 12px rgba(66, 133, 244, 0.4) !important;
        animation: pulse-contact 2s infinite !important;
    }

    .contact-icon {
        width: 23px !important;
        height: 33px !important;
        margin: 0 !important;
    }

    .contact-form-button-text {
        display: none !important;
    }
}

.contact-form-button:hover {
    transform: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

@keyframes pulse-blue {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
    }
    50% {
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4), 0 0 0 10px rgba(0, 123, 255, 0.1), 0 0 0 20px rgba(0, 123, 255, 0.05);
    }
}

@keyframes pulse-contact {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
    }
    50% {
        box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4), 0 0 0 8px rgba(66, 133, 244, 0.2), 0 0 0 16px rgba(66, 133, 244, 0.1);
    }
}

.contact-icon {
    width: 26px;
    height: 26px;
    color: white;
}

.contact-form-button-text {
    white-space: nowrap;
    line-height: 1;
}

.whatsapp-icon {
    width: 32px;
    height: 32px;
    color: white;
}

/* Contact Form Popup Modal - Side Panel Style */
.contact-form-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.contact-form-modal.active {
    display: block;
}

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

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.contact-form-container {
    background: #ffffff;
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%) translateX(120%);
    height: auto;
    max-height: 90vh;
    width: 100%;
    max-width: 600px;
    overflow: visible;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.contact-form-modal.active .contact-form-container {
    transform: translateY(-50%) translateX(0) !important;
}

.contact-form-header {
    background: #fbbf24;
    color: #1f2937;
    padding: 12px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    border-radius: 12px 12px 0 0;
}

.contact-form-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #000000;
}

.contact-form-close {
    background: rgba(0, 0, 0, 0.08);
    border: none;
    color: #1f2937;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-size: 18px;
}

.contact-form-close:hover {
    background: rgba(0, 0, 0, 0.15);
    transform: rotate(90deg) scale(1.1);
}

.contact-form-body {
    padding: 24px 28px;
    /* Disable inner scrolling: allow the modal/container to handle page scrolling */
    overflow: visible;
    background: #ffffff;
    flex: 1;
    max-height: none;
}

.contact-form-group {
    margin-bottom: 0;
}

.contact-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-bottom: -3px;
}

.contact-form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #1f2937;
    font-size: 15px;
    letter-spacing: 0;
}

.contact-form-input,
.contact-form-textarea {
    width: 100%;
    padding: 5px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background: #ffffff;
    color: #1f2937;
}

.contact-form-input::placeholder,
.contact-form-textarea::placeholder {
    color: #9ca3af;
    opacity: 1;
}

.contact-form-input:focus,
.contact-form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: #ffffff;
    transform: none;
}

.contact-form-input:hover,
.contact-form-textarea:hover {
    border-color: #cbd5e0;
}

.contact-form-textarea {
    resize: vertical;
    min-height: 80px;
    max-height: 150px;
    line-height: 1.5;
}

.contact-form-submit {
    width: 100%;
    padding: 8px 16px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    letter-spacing: 0.3px;
    margin-top: 8px;
}

.contact-form-submit:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.contact-form-submit:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.25);
}

.contact-form-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Custom scrollbar for form body */
.contact-form-body::-webkit-scrollbar {
    width: 8px;
}

.contact-form-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.contact-form-body::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.contact-form-body::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Error message styling */
.form-error {
    color: #e53e3e;
    font-size: 13px;
    margin-top: 5px;
    display: none;
}

.whatsapp-chat {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 350px;
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.whatsapp-chat.active {
    display: flex;
}

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

.whatsapp-header {
    background: linear-gradient(135deg, #128C7E 0%, #075E54 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.whatsapp-header-icon {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    padding: 8px;
    color: #25D366;
}

.whatsapp-header-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

.whatsapp-header-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.whatsapp-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.whatsapp-close:hover {
    opacity: 0.8;
}

.whatsapp-close svg {
    width: 24px;
    height: 24px;
}

.whatsapp-body {
    padding: 20px;
    background: #e5ddd5;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.whatsapp-message {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.whatsapp-message-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.whatsapp-message-content {
    background: white;
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    max-width: 85%;
}

.whatsapp-message-text {
    font-size: 14px;
    line-height: 1.5;
    color: #303030;
}

.whatsapp-message-time {
    font-size: 11px;
    color: #667781;
    margin-top: 4px;
    text-align: right;
}

.whatsapp-footer {
    display: flex;
    padding: 12px;
    background: white;
    border-top: 1px solid #e9ecef;
    gap: 8px;
}

.whatsapp-input {
    flex: 1;
    border: 1px solid #d1d7db;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.whatsapp-input:focus {
    border-color: #25D366;
}

.whatsapp-send {
    background: #25D366;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.whatsapp-send:hover {
    background: #20BA5A;
    transform: scale(1.05);
}

.whatsapp-send svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 768px) {
    .whatsapp-widget {
        bottom: 15px;
        left: 15px;
    }

    .contact-form-widget {
        bottom: 15px;
        right: 15px;
    }

    .whatsapp-button,
    .contact-form-button {
        width: 56px;
        height: 56px;
    }

    .whatsapp-icon,
    .contact-icon {
        width: 24px;
        height: 24px;
    }

    .whatsapp-chat {
        width: calc(100vw - 30px);
        left: -7.5px;
    }

    .contact-form-modal {
        padding: 0;
    }

    .contact-form-container {
        max-width: 90%;
        width: 90%;
        max-height: 85vh;
        border-radius: 12px;
        right: 5%;
        top: 50% !important;
        transform: translateY(-50%) translateX(120%) !important;
    }

    .contact-form-modal.active .contact-form-container {
        transform: translateY(-50%) translateX(0) !important;
    }

    .contact-form-header {
        padding: 14px 16px;
        position: sticky;
        top: 0;
        z-index: 1;
        border-radius: 12px 12px 0 0;
    }

    .contact-form-header h2 {
        font-size: 20px;
    }

    .contact-form-close {
        width: 32px;
        height: 32px;
    }

    .contact-form-close:hover {
        background: rgba(0, 0, 0, 0.12);
        transform: none;
    }

    .contact-form-body {
        padding: 16px;
        /* Disable inner scrolling on small screens */
        overflow: visible;
        max-height: none;
    }

    .contact-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .contact-form-group {
        margin-bottom: 14px;
    }

    .contact-form-label {
        font-size: 12.5px;
        margin-bottom: 5px;
    }

    .contact-form-input,
    .contact-form-textarea {
        padding: 10px 12px;
        font-size: 14px;
        border-radius: 7px;
    }

    .contact-form-textarea {
        min-height: 80px;
        max-height: 120px;
    }

    .contact-form-submit {
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 7px;
    }

    .contact-form-button-text {
        display: none;
    }
}

/* Medium Tablets (600px - 768px) - Keep 2 columns */
@media (min-width: 600px) and (max-width: 768px) {
    .contact-form-row {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }
    
    .contact-form-container {
        max-width: 90% !important;
        right: 5% !important;
    }
}

/* Extra Small Mobile Screens - Keep 2 columns but more compact */
@media (max-width: 375px) {
    .contact-form-container {
        max-width: 90% !important;
        width: 90% !important;
        right: 5% !important;
    }

    .contact-form-row {
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
    }

    .contact-form-input,
    .contact-form-textarea {
        padding: 8px 9px !important;
        font-size: 12px !important;
    }

    .contact-form-label {
        font-size: 11px !important;
    }

    .contact-form-header h2 {
        font-size: 16px !important;
    }

    .contact-form-textarea {
        min-height: 65px !important;
        max-height: 90px !important;
    }
}

@media (max-width: 480px) {
    .contact-form-modal {
        padding: 0;
    }

    .contact-form-container {
        max-width: 85%;
        width: 85%;
        max-height: 80vh;
        border-radius: 10px;
        right: 7.5%;
        top: 50% !important;
        transform: translateY(-50%) translateX(120%) !important;
    }

    .contact-form-modal.active .contact-form-container {
        transform: translateY(-50%) translateX(0) !important;
    }

    .contact-form-header {
        padding: 14px 16px;
        border-radius: 10px 10px 0 0;
    }

    .contact-form-header h2 {
        font-size: 18px;
    }

    .contact-form-body {
        padding: 16px;
        /* Disable inner scrolling on extra-small / portrait layouts */
        overflow: visible;
        max-height: none;
    }

    .contact-form-group {
        margin-bottom: 12px;
    }

    .contact-form-row {
        /* margin-bottom: 12px; */
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .contact-form-label {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .contact-form-input,
    .contact-form-textarea {
        padding: 9px 10px;
        font-size: 13px;
    }

    .contact-form-textarea {
        min-height: 70px;
        max-height: 100px;
    }

    .contact-form-submit {
        padding: 9px 14px;
        font-size: 13px;
        margin-top: 4px;
        border-radius: 6px;
    }

    .whatsapp-button,
    .contact-form-button {
        width: 50px;
        height: 50px;
    }

    .whatsapp-icon,
    .contact-icon {
        width: 24px;
        height: 24px;
    }
}

/* Landscape mode mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .contact-form-container {
        max-width: 70% !important;
        max-height: 90vh !important;
        right: 15% !important;
    }
}

/* Tablet optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    .contact-form-container {
        max-width: 450px;
        right: 15px;
    }
}

/* Desktop larger screens */
@media (min-width: 1025px) {
    .contact-form-container {
        max-width: 500px;
        right: 20px;
    }
}

.contact-form-row .contact-form-group {
    margin-bottom: 20px;
}
