/* ===== Floating Chat Widget - Frontend ===== */

#fcw-root *,
#fcw-root *::before,
#fcw-root *::after {
    box-sizing: border-box;
}

/* Selective reset — only on containers, not on elements that need padding */
#fcw-root {
    line-height: normal;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

/* Ensure Font Awesome icons render properly (theme overrides protection) */
#fcw-root i[class*="fa-"] {
    font-style: normal !important;
    font-weight: inherit;
    line-height: 1 !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    speak: never;
}

/* Main Button */
.fcw-main-btn {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
}

.fcw-main-btn:hover {
    transform: scale(1.08);
}

.fcw-main-btn .fcw-main-icon {
    font-size: inherit;
    line-height: 1;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fcw-main-btn.fcw-open .fcw-main-icon {
    transform: rotate(90deg);
}

/* Pulse */
@keyframes fcw-pulse {
    0% { box-shadow: 0 0 0 0 var(--fcw-pulse-color, rgba(108,92,231,0.5)); }
    70% { box-shadow: 0 0 0 14px rgba(108,92,231,0); }
    100% { box-shadow: 0 0 0 0 rgba(108,92,231,0); }
}
.fcw-main-btn.fcw-pulse { animation: fcw-pulse 2s infinite; }
.fcw-main-btn.fcw-open.fcw-pulse { animation: none; }

/* Badge */
.fcw-badge {
    position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px;
    padding: 0 5px; border-radius: 10px; background: #FF3B30; color: #fff;
    font-size: 11px; font-weight: 700; display: flex; align-items: center;
    justify-content: center; line-height: 1; pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Tooltip (main button) */
.fcw-tooltip {
    position: absolute;
    white-space: nowrap;
    background: rgba(30, 30, 30, 0.95) !important;
    color: #fff !important;
    padding: 8px 14px !important;
    border-radius: 8px;
    font-size: 13px !important;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1;
    line-height: 1.3 !important;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin: 0;
}
.fcw-tooltip::after {
    content: '';
    position: absolute;
    border: 6px solid transparent;
}
.fcw-tooltip-left {
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
}
.fcw-tooltip-left::after {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: rgba(30, 30, 30, 0.95);
}
.fcw-tooltip-right {
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
}
.fcw-tooltip-right::after {
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: rgba(30, 30, 30, 0.95);
}
.fcw-main-btn:hover .fcw-tooltip { opacity: 1; }
.fcw-main-btn.fcw-open .fcw-tooltip { opacity: 0 !important; }

/* Overlay */
.fcw-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.2); backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; z-index: 99998;
}
.fcw-overlay.fcw-visible { opacity: 1; visibility: visible; }

/* Items Container */
.fcw-items {
    position: fixed; display: flex; gap: var(--fcw-spacing, 12px);
    pointer-events: none; opacity: 0; transition: opacity 0.25s;
}
.fcw-items.fcw-visible { pointer-events: auto; opacity: 1; }
.fcw-items-up { flex-direction: column-reverse; }
.fcw-items-down { flex-direction: column; }
.fcw-items-left { flex-direction: row-reverse; }
.fcw-items-right { flex-direction: row; }

/* Individual item */
.fcw-item {
    position: relative; display: flex; align-items: center; justify-content: center;
    border-radius: var(--fcw-radius, 50%); cursor: pointer; border: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
    opacity: 0; transform: scale(0.3); outline: none;
    -webkit-tap-highlight-color: transparent; line-height: 1;
}
.fcw-items.fcw-visible .fcw-item { opacity: 1; transform: scale(1); }
.fcw-item:hover { transform: scale(1.12) !important; }

/* Staggered animation */
.fcw-items.fcw-visible .fcw-item:nth-child(1) { transition-delay: 0.03s; }
.fcw-items.fcw-visible .fcw-item:nth-child(2) { transition-delay: 0.06s; }
.fcw-items.fcw-visible .fcw-item:nth-child(3) { transition-delay: 0.09s; }
.fcw-items.fcw-visible .fcw-item:nth-child(4) { transition-delay: 0.12s; }
.fcw-items.fcw-visible .fcw-item:nth-child(5) { transition-delay: 0.15s; }
.fcw-items.fcw-visible .fcw-item:nth-child(6) { transition-delay: 0.18s; }
.fcw-items.fcw-visible .fcw-item:nth-child(7) { transition-delay: 0.21s; }
.fcw-items.fcw-visible .fcw-item:nth-child(8) { transition-delay: 0.24s; }

.fcw-item i { font-size: 20px; line-height: 1; }

/* Item labels (tooltips) */
.fcw-item-label {
    position: absolute;
    white-space: nowrap;
    background: rgba(30, 30, 30, 0.95) !important;
    color: #fff !important;
    padding: 6px 12px !important;
    border-radius: 6px;
    font-size: 12px !important;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    line-height: 1.3 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin: 0;
}
.fcw-item:hover .fcw-item-label { opacity: 1; }
.fcw-pos-right .fcw-item-label { right: calc(100% + 10px); }
.fcw-pos-left .fcw-item-label { left: calc(100% + 10px); }


/* ====================== */
/*   EMAIL FORM (modern)  */
/* ====================== */

.fcw-email-form-wrap {
    position: fixed;
    width: 380px;
    max-width: calc(100vw - 24px);
    background: #fff !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 48px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08) !important;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif !important;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
}
.fcw-email-form-wrap.fcw-visible {
    opacity: 1; visibility: visible; transform: translateY(0) scale(1);
}

/* Header */
.fcw-form-header {
    padding: 20px 24px 16px !important;
    margin: 0 !important;
    color: #fff !important;
    position: relative;
}
.fcw-form-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 24px; right: 24px;
    height: 1px;
    background: rgba(255,255,255,0.2);
}
.fcw-form-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.fcw-form-header h3 {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em;
    color: #fff !important;
    line-height: 1.3 !important;
    border: none !important;
    background: none !important;
}
.fcw-form-header p {
    margin: 6px 0 0 !important;
    padding: 0 !important;
    font-size: 13px !important;
    opacity: 0.8;
    font-weight: 400;
    color: #fff !important;
    line-height: 1.4 !important;
}
.fcw-form-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    transition: background 0.2s;
    flex-shrink: 0;
}
.fcw-form-close:hover { background: rgba(255,255,255,0.3); }

/* Body */
.fcw-form-body {
    padding: 20px 24px 24px !important;
    margin: 0 !important;
}

/* Form row */
.fcw-form-row {
    margin-bottom: 16px !important;
    padding: 0 !important;
}
.fcw-form-row:last-of-type {
    margin-bottom: 20px !important;
}

/* Two columns */
.fcw-form-row-double {
    display: flex !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
    padding: 0 !important;
}
.fcw-form-row-double .fcw-form-row {
    flex: 1;
    margin-bottom: 0 !important;
}

.fcw-form-row label {
    display: block !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #374151 !important;
    margin: 0 0 6px 0 !important;
    padding: 0 !important;
    letter-spacing: 0.01em;
    line-height: 1.3 !important;
}
.fcw-form-row label .fcw-required {
    color: #EF4444 !important;
    margin-left: 2px;
}

.fcw-form-row input,
.fcw-form-row textarea {
    width: 100% !important;
    padding: 11px 14px !important;
    border: 1.5px solid #E5E7EB !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none !important;
    background: #F9FAFB !important;
    color: #1F2937 !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-width: 100% !important;
    box-shadow: none !important;
}
.fcw-form-row input::placeholder,
.fcw-form-row textarea::placeholder {
    color: #9CA3AF;
}
.fcw-form-row input:focus,
.fcw-form-row textarea:focus {
    border-color: var(--fcw-accent, #6C5CE7) !important;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1) !important;
    background: #fff !important;
}
.fcw-form-row textarea {
    resize: vertical;
    min-height: 90px !important;
}

/* Submit */
.fcw-form-submit {
    width: 100% !important;
    padding: 13px 16px !important;
    border: none !important;
    border-radius: 10px !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    font-family: inherit !important;
    letter-spacing: 0.01em;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
    text-transform: none !important;
}
.fcw-form-submit:hover {
    opacity: 0.92;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}
.fcw-form-submit:active {
    transform: scale(0.98);
}
.fcw-form-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}
.fcw-form-submit i {
    font-size: 15px;
}

/* Spinner */
@keyframes fcw-spin {
    to { transform: rotate(360deg); }
}
.fcw-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fcw-spin 0.6s linear infinite;
}

/* Message */
.fcw-form-msg {
    text-align: center !important;
    padding: 12px 16px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    border-radius: 10px !important;
    margin: 14px 0 0 0 !important;
    display: none;
    line-height: 1.4 !important;
    transition: opacity 0.3s ease !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}
.fcw-form-msg.fcw-success {
    background: linear-gradient(135deg, #ECFDF5, #D1FAE5) !important;
    color: #065F46 !important;
    border: 1px solid #A7F3D0 !important;
}
.fcw-form-msg.fcw-error {
    background: linear-gradient(135deg, #FEF2F2, #FECACA) !important;
    color: #991B1B !important;
    border: 1px solid #FCA5A5 !important;
}

.fcw-form-msg.fcw-success::before {
    content: '✓  ' !important;
    font-weight: 700 !important;
}
.fcw-form-msg.fcw-error::before {
    content: '✗  ' !important;
    font-weight: 700 !important;
}

/* Footer */
.fcw-form-footer {
    padding: 0;
    text-align: center;
}

/* Responsive */
@media (max-width: 480px) {
    .fcw-email-form-wrap {
        width: calc(100vw - 20px);
        left: 10px !important;
        right: 10px !important;
        border-radius: 14px;
    }
    .fcw-form-row-double {
        flex-direction: column;
        gap: 0;
    }
    .fcw-form-row-double .fcw-form-row {
        margin-bottom: 16px;
    }
}
