/* assets/css/pigapay-fab.css - The floating buttons at the bottom right of every page (includes/fab.php):
   back to top, menu (dark / light mode, language, refresh, call or WhatsApp us), AI assistant, and the menu button.
   Prefixed .pfab so the older .fab-* styles that pages still carry do not change it. */

.pfab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Every floating button is exactly the same size on every page (the border counts inside it, whatever the page's
   own reset says), so the menu buttons and the AI assistant line up */
.pfab, .pfab *, .pfab *::before, .pfab *::after {
    box-sizing: border-box;
}

.pfab-btn {
    position: relative;
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid #dce8f2;
    background: #ffffff;
    color: #1a7ab5;
    box-shadow: 0 4px 14px rgba(8, 36, 51, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    transition: transform 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.pfab-btn:hover,
.pfab-btn:focus-visible {
    background: #1a7ab5;
    color: #ffffff;
    border-color: #1a7ab5;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(26, 122, 181, 0.3);
    outline: none;
}

.pfab-main {
    /* the same size as the other buttons (46px) */
    border: 1px solid #1a7ab5;
    background: #1a7ab5;
    color: #ffffff;
    font-size: 1.1rem;
    box-shadow: 0 6px 20px rgba(26, 122, 181, 0.35);
}

.pfab-main:hover,
.pfab-main:focus-visible {
    background: #156596;
    border-color: #156596;
}

.pfab-main .fa-xmark,
.pfab.open .pfab-main .fa-plus {
    display: none;
}

.pfab.open .pfab-main .fa-xmark {
    display: inline-block;
}

.pfab-ai {
    border: 1px solid #082433;
    background: #082433;
    color: #ffffff;
}

.pfab-ai:hover,
.pfab-ai:focus-visible {
    background: #13415b;
    border-color: #13415b;
}

/* Menu: shown when the menu button is open */
.pfab-menu {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.pfab.open .pfab-menu {
    display: flex;
}

.pfab.open .pfab-menu > * {
    animation: pfabIn 0.18s ease both;
}

.pfab.open .pfab-menu > *:nth-last-child(2) { animation-delay: 0.04s; }
.pfab.open .pfab-menu > *:nth-last-child(3) { animation-delay: 0.08s; }
.pfab.open .pfab-menu > *:nth-last-child(4) { animation-delay: 0.12s; }

@keyframes pfabIn {
    from { opacity: 0; transform: translateY(10px) scale(0.85); }
    to { opacity: 1; transform: none; }
}

/* Back to top: only after scrolling down */
.pfab-top {
    display: none;
}

.pfab-top.visible {
    display: flex;
}

.pfab-refresh.spin i {
    animation: pfabSpin 0.6s linear infinite;
}

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

/* Name of a button, on hover (computers only) */
.pfab-tip {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #082433;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    padding: 0.45rem 0.7rem;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.pfab-btn:hover .pfab-tip,
.pfab-btn:focus-visible .pfab-tip {
    opacity: 1;
}

/* Call / WhatsApp / email card */
.pfab-contact {
    position: relative;
}

.pfab-popup {
    display: none;
    position: absolute;
    right: calc(100% + 12px);
    bottom: 0;
    width: 270px;
    background: #ffffff;
    border: 1px solid #e4eef8;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(8, 36, 51, 0.15);
    padding: 0.9rem;
}

.pfab-popup.open {
    display: block;
    animation: pfabIn 0.18s ease both;
}

.pfab-popup h4 {
    margin: 0 0 0.6rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #082433;
}

.pfab-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0;
    border-top: 1px solid #eef4f9;
}

.pfab-row .pfab-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e6f2fc;
    color: #1a7ab5;
    flex-shrink: 0;
}

.pfab-row .pfab-icon.whatsapp {
    background: #e7f8ee;
    color: #1f9d55;
}

.pfab-row-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.pfab-row-text span {
    font-size: 0.7rem;
    color: #6a8aa0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pfab-row-text a {
    font-size: 0.86rem;
    font-weight: 600;
    color: #082433;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pfab-row-text a:hover {
    color: #1a7ab5;
}

.pfab-copy {
    background: none;
    border: none;
    color: #6a8aa0;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
}

.pfab-copy:hover {
    color: #1a7ab5;
    background: #eef4f9;
}

/* AI assistant chat */
.pfab .chat-modal {
    position: fixed;
    right: 24px;
    bottom: 92px;
    width: 370px;
    height: min(520px, calc(100vh - 120px));
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(8, 36, 51, 0.18);
    border: 1px solid #e4eef8;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
    text-align: left;
}

.pfab .chat-modal.open {
    display: flex;
    animation: pfabIn 0.2s ease both;
}

.pfab .chat-header {
    background: #f8fafc;
    padding: 0.8rem 1.1rem;
    border-bottom: 1px solid #e4eef8;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.pfab .chat-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #082433;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pfab .chat-header h3 i {
    color: #1a7ab5;
}

.pfab .chat-header .new-chat,
.pfab .chat-header .close-chat {
    background: none;
    border: none;
    color: #6a8aa0;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 1rem;
}

.pfab .chat-header .new-chat {
    margin-left: auto;
    font-size: 0.9rem;
}

.pfab .chat-header .new-chat:hover,
.pfab .chat-header .close-chat:hover {
    color: #1a7ab5;
}

.pfab .chat-messages {
    flex: 1;
    padding: 1rem 1.1rem;
    overflow-y: auto;
    background: #fafcff;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.pfab .chat-message {
    max-width: 85%;
    padding: 0.7rem 1rem;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.pfab .chat-message.bot {
    background: #eef4f9;
    color: #082433;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.pfab .chat-message.user {
    background: #1a7ab5;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.pfab .chat-message.bot a {
    color: #1a7ab5;
    word-break: break-all;
}

.pfab .chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.pfab .chat-suggestions button {
    background: #ffffff;
    border: 1px solid #c8dced;
    color: #1a7ab5;
    border-radius: 60px;
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.pfab .chat-suggestions button:hover {
    background: #e6f2fc;
}

.pfab .chat-feedback {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(106, 138, 160, 0.2);
    font-size: 0.75rem;
    color: #6a8aa0;
}

.pfab .chat-feedback button {
    background: none;
    border: none;
    color: #6a8aa0;
    cursor: pointer;
    padding: 2px 5px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.pfab .chat-feedback button:hover {
    color: #1a7ab5;
    background: rgba(26, 122, 181, 0.1);
}

.pfab .chat-message .typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.pfab .chat-message .typing span {
    width: 8px;
    height: 8px;
    background: #6a8aa0;
    border-radius: 50%;
    animation: pfabTyping 1.2s infinite;
}

.pfab .chat-message .typing span:nth-child(2) { animation-delay: 0.2s; }
.pfab .chat-message .typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pfabTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.pfab .chat-input {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e4eef8;
    display: flex;
    gap: 0.5rem;
    background: #ffffff;
    flex-shrink: 0;
}

.pfab .chat-input input {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 1rem;
    border: 1px solid #dce8f2;
    border-radius: 60px;
    font-size: 0.9rem;
    outline: none;
    font-family: inherit;
    background: #ffffff;
    color: #082433;
}

.pfab .chat-input input:focus {
    border-color: #1a7ab5;
}

.pfab .chat-input button {
    background: #1a7ab5;
    color: #ffffff;
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: 60px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
}

.pfab .chat-input button:hover {
    background: #156596;
}

/* Dark mode */
body.dark-mode .pfab-btn {
    background: #0f1f30;
    border-color: #1a3348;
    color: #7cc0ef;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

body.dark-mode .pfab-btn:hover,
body.dark-mode .pfab-btn:focus-visible {
    background: #1a7ab5;
    border-color: #1a7ab5;
    color: #ffffff;
}

body.dark-mode .pfab-main {
    background: #1a7ab5;
    color: #ffffff;
}

body.dark-mode .pfab-ai {
    background: #e6f2fc;
    border-color: #e6f2fc;
    color: #082433;
}

body.dark-mode .pfab-tip {
    background: #e6f2fc;
    color: #082433;
}

body.dark-mode .pfab-popup,
body.dark-mode .pfab .chat-modal,
body.dark-mode .pfab .chat-input {
    background: #0f1f30;
    border-color: #1a3348;
}

body.dark-mode .pfab-popup h4,
body.dark-mode .pfab-row-text a,
body.dark-mode .pfab .chat-header h3 {
    color: #e2e8f0;
}

body.dark-mode .pfab-row {
    border-color: #1a3348;
}

body.dark-mode .pfab-row .pfab-icon {
    background: rgba(26, 122, 181, 0.2);
    color: #7cc0ef;
}

body.dark-mode .pfab-row .pfab-icon.whatsapp {
    background: rgba(31, 157, 85, 0.2);
    color: #6ee7b7;
}

body.dark-mode .pfab-copy:hover {
    background: #1a3348;
}

body.dark-mode .pfab .chat-header {
    background: #0b1a28;
    border-color: #1a3348;
}

body.dark-mode .pfab .chat-messages {
    background: #0b1622;
}

body.dark-mode .pfab .chat-message.bot {
    background: #1a3348;
    color: #e2e8f0;
}

body.dark-mode .pfab .chat-message.bot a {
    color: #7cc0ef;
}

body.dark-mode .pfab .chat-suggestions button {
    background: #0f1f30;
    border-color: #1a3348;
    color: #7cc0ef;
}

body.dark-mode .pfab .chat-input input {
    background: #0b1622;
    border-color: #1a3348;
    color: #e2e8f0;
}

body.dark-mode .pfab .chat-feedback,
body.dark-mode .pfab .chat-feedback button,
body.dark-mode .pfab .chat-header .new-chat,
body.dark-mode .pfab .chat-header .close-chat {
    color: #8aa4ba;
}

/* Phones */
@media (max-width: 600px) {
    .pfab {
        right: 14px;
        bottom: 14px;
        gap: 8px;
    }
    .pfab-menu {
        gap: 8px;
    }
    .pfab-btn {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
        font-size: 0.95rem;
    }
    .pfab-main {
        font-size: 1.05rem;
    }
    .pfab-tip {
        display: none;
    }
    /* A flag alone says little on a phone, where there is no hover: this one keeps its words. */
    .pfab-report .pfab-tip {
        display: block;
        opacity: 1;
    }
    .pfab-popup {
        position: fixed;
        right: 66px;
        bottom: 14px;
        width: min(270px, calc(100vw - 82px));
    }
    .pfab .chat-modal {
        right: 8px;
        left: 8px;
        bottom: 74px;
        width: auto;
        height: min(560px, calc(100vh - 96px));
    }
}

@media print {
    .pfab {
        display: none !important;
    }
}
