/**
 * Floating Contact Form Widget
 * Slide-out panel triggered by bubble or /contact links.
 * Uses theme blue gradient to match brand.
 */

/* ── Bubble (fixed bottom-right) ── */
.vaan-contact-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10010;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #1193D4 0%, #2662D9 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(34, 115, 195, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.vaan-contact-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(34, 115, 195, 0.55);
}

.vaan-contact-bubble:active {
    transform: translateY(0);
}

.vaan-contact-bubble__icon-chat,
.vaan-contact-bubble__icon-close {
    transition: opacity 0.2s ease, transform 0.2s ease;
    position: absolute;
}

.vaan-contact-bubble__icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.6);
}

.vaan-contact-bubble.is-active .vaan-contact-bubble__icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0.6);
}

.vaan-contact-bubble.is-active .vaan-contact-bubble__icon-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* ── Backdrop ── */
.vaan-contact-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.vaan-contact-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ── Slide-out Panel ── */
.vaan-contact-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    z-index: 10010;
    width: 380px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow:
        0 0.8px 2.7px rgba(0, 0, 0, 0.012),
        0 2px 6.9px rgba(0, 0, 0, 0.018),
        0 4.1px 14.2px rgba(0, 0, 0, 0.022),
        0 8.4px 29.2px rgba(0, 0, 0, 0.028),
        0 23px 80px rgba(0, 0, 0, 0.06);
    padding: 28px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.96);
    transform-origin: bottom right;
    transition:
        opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0.3s ease;
}

.vaan-contact-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ── Panel header ── */
.vaan-contact-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.vaan-contact-panel__title {
    font-family: "Poppins", sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a2332;
    margin: 0;
}

.vaan-contact-panel__close {
    background: #2abfc4 !important;
    background-image: none !important;
    border: none !important;
    cursor: pointer;
    color: #fff;
    padding: 6px !important;
    border-radius: 50% !important;
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
    box-shadow: none !important;
}

.vaan-contact-panel__close svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: block;
}

.vaan-contact-panel__close:hover {
    color: #fff;
    background: #25a9ad !important;
}

.vaan-contact-panel__subtitle {
    font-size: 0.85rem;
    color: #8896a6;
    margin: 0 0 20px;
    font-family: "Open Sans", sans-serif;
}

/* ── Form ── */
.vaan-contact-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: vaanContactFadeIn 0.3s ease forwards 0.15s;
    opacity: 0;
}

@keyframes vaanContactFadeIn {
    to { opacity: 1; }
}

.vaan-contact-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 6px;
    font-family: "Open Sans", sans-serif;
}

.vaan-contact-field input,
.vaan-contact-field textarea {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: "Open Sans", sans-serif;
    color: #2d3748;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
}

.vaan-contact-field input:focus,
.vaan-contact-field textarea:focus {
    border-color: #1193D4;
    box-shadow: 0 0 0 3px rgba(17, 147, 212, 0.12);
    background: #fff;
}

.vaan-contact-field input::placeholder,
.vaan-contact-field textarea::placeholder {
    color: #b0bec5;
}

.vaan-contact-field textarea {
    resize: vertical;
    min-height: 90px;
}

/* ── Submit button ── */
.vaan-contact-submit {
    position: relative;
    width: 100%;
    padding: 0.875rem 1.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: "Open Sans", sans-serif;
    color: #fff;
    background: #2abfc4;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.vaan-contact-submit:hover:not(:disabled) {
    background: #25a9ad;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(42, 191, 196, 0.4);
}

.vaan-contact-submit:active:not(:disabled) {
    transform: translateY(0);
}

.vaan-contact-submit:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.vaan-contact-submit.is-loading .vaan-contact-submit__label {
    visibility: hidden;
}

.vaan-contact-submit__spinner {
    display: none;
}

.vaan-contact-submit.is-loading .vaan-contact-submit__spinner {
    display: block;
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vaanContactSpin 0.7s linear infinite;
}

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

/* ── Success state ── */
.vaan-contact-success {
    text-align: center;
    padding: 32px 0 16px;
    animation: vaanContactFadeIn 0.3s ease forwards;
}

.vaan-contact-success__icon {
    color: #10b981;
    margin-bottom: 16px;
}

.vaan-contact-success h4 {
    font-family: "Poppins", sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a2332;
    margin: 0 0 8px;
}

.vaan-contact-success p {
    font-size: 0.9rem;
    color: #8896a6;
    margin: 0;
    font-family: "Open Sans", sans-serif;
}

/* ── Toast notification ── */
.vaan-contact-toast {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 10020;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: "Open Sans", sans-serif;
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(12px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    pointer-events: none;
}

.vaan-contact-toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.vaan-contact-toast--error {
    background: #ef4444;
}

.vaan-contact-toast--success {
    background: #10b981;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .vaan-contact-panel {
        right: 12px;
        left: 12px;
        bottom: 88px;
        width: auto;
        max-height: calc(100vh - 110px);
        padding: 24px 20px;
        border-radius: 14px;
    }

    .vaan-contact-bubble {
        right: 16px;
        bottom: 16px;
    }
}
