/* =========================
   Falcons Chat Widget – CSS
   Brand palette: Falcons navy (#0B1F3A) + Falcons gold (#C9A227)
   NOTE: swap these hex values for the exact brand kit values if
   Mohammed supplies an official Falcons style guide.
   ========================= */

:root {
  --fsg-blue: #c4a579;
  --fsg-blue-dark: #333;
  --fsg-blue-light: #EDF1F6;
  --fsg-amber: #c4a579;
}

#backToTop.show {
    opacity: 1;
    visibility: hidden;
    display: none !important;
}

/* Chat icon */
#fsg-chat-icon{
    position: fixed;
    right: 20px;
    bottom: 40px;
    width: 60px;
    height: 60px;
    background: var(--fsg-blue);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0 8px 24px rgba(11,60,102,.35);
    z-index: 100000;
    transition: transform .15s ease, box-shadow .15s ease;
}
#fsg-chat-icon:hover{ transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 28px var(--fsg-blue); }

/* Back-to-top button (left side, mirrors the chat icon on the right) */
#fsg-back-to-top{
    position: fixed;
    left: 20px;
    bottom: 40px;
    width: 48px;
    height: 48px;
    background: #fff;
    color: var(--fsg-blue);
    border: 1px solid #d7e0e8;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    box-shadow: 0 6px 18px rgba(0,0,0,.15);
    z-index: 99998;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}
#fsg-back-to-top.fsg-visible{ display: flex; }
#fsg-back-to-top:hover{
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 10px 24px rgba(0,0,0,.22);
    background: var(--fsg-blue);
    color: #fff;
}

/* Soft pulsing glow rings behind the icon to draw the eye */
#fsg-chat-icon::before,
#fsg-chat-icon::after{
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--fsg-blue);
    opacity: .55;
    z-index: -1;
    animation: fsg-icon-pulse 2.4s ease-out infinite;
    pointer-events: none;
}
#fsg-chat-icon::after{ animation-delay: 1.2s; }

@keyframes fsg-icon-pulse{
    0%{ transform: scale(1); opacity: .55; }
    100%{ transform: scale(1.9); opacity: 0; }
}


/* Chat box */
#fsg-chat-box{
    position: fixed;
    right: 20px;
    bottom: 110px;
    width: 370px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: 500px;
    display: none;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    overflow: hidden;
    z-index: 99999;
}
#fsg-chat-box.active{ display: flex; }

/* Header */
.fsg-chatbox-header{
    background: var(--fsg-blue);
    color: #fff;
    padding: 12px 16px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 14px 14px 0 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    position: relative;
    z-index: 30;
}
.fsg-chatbox-header span:nth-child(2){ flex: 1; }
.fsg-header-logo{ width: 28px; height: 28px; object-fit: contain; border-radius: 4px; background:#fff; }
#fsg-header-whatsapp{ color: #fff; font-size: 17px; opacity: .9; text-decoration: none !important; }
#fsg-header-whatsapp:hover{ opacity: 1; color: #25D366; }
#fsg-close{ cursor: pointer; font-size: 16px; }

/* Body */
.fsg-body{
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 10px;
}

/* Chat area */
#fsg-chat-area{ flex: 1; overflow-y: auto; padding: 8px 4px; margin-bottom: 6px; }

.fsg-bot, .fsg-user{
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    max-width: 90%;
    line-height: 1.5;
    font-size: 14px;
    animation: fsg-msg-in .22s ease;
}
.fsg-bot{ background: #F2F5F8; color: #1c2b3a; }
.fsg-user{ background: var(--fsg-blue); color: #fff; margin-left: auto; text-align: right; }

@keyframes fsg-msg-in{
    from{ opacity: 0; transform: translateY(6px); }
    to{ opacity: 1; transform: translateY(0); }
}

/* Typing indicator — animated bouncing "..." + localized text */
.fsg-typing-wrap{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
}
.fsg-typing-text{
    font-size: 12.5px;
    color: #7c8a99;
    font-style: italic;
}
.fsg-typing{
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.fsg-typing span{
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #97a6b6;
    display: inline-block;
    animation: fsg-bounce 1.2s infinite ease-in-out;
}
.fsg-typing span:nth-child(1){ animation-delay: 0s; }
.fsg-typing span:nth-child(2){ animation-delay: .15s; }
.fsg-typing span:nth-child(3){ animation-delay: .3s; }

@keyframes fsg-bounce{
    0%, 60%, 100%{ transform: translateY(0); opacity: .5; }
    30%{ transform: translateY(-5px); opacity: 1; }
}

/* Suggestions / quick replies */
.fsg-quick{ list-style:none; padding:0; margin: 6px 0; }
.fsg-suggest{
    cursor: pointer;
    color: var(--fsg-blue);
    font-weight: 600;
    padding: 4px 0;
}
.fsg-suggest:hover{ text-decoration: underline; color: var(--fsg-amber); }

/* Learn-more link button on FAQ answers */
.fsg-link-btn{
    display: inline-block;
    margin-top: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--fsg-amber);
    color: #1c2b3a !important;
    font-weight: 600;
    text-decoration: none !important;
}

/* Input */
.fsg-input-wrap{ display: flex; gap: 8px; margin-top: 6px; flex-shrink: 0; align-items: center; }
#fsg-user-input{ flex: 1; height: 80px; border-radius: 8px; border: 1px solid #ddd; padding: 0 10px; font-size: 14px; }
#fsg-attach-btn{
    height: 40px;
    width: 40px;
    flex-shrink: 0;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    color: var(--fsg-blue);
    cursor: pointer;
    font-size: 15px;
}
#fsg-attach-btn:hover{ background: var(--fsg-blue-light, #EAF1F7); }
#fsg-send-btn{
    height: 40px;
    width: 44px;
    flex-shrink: 0;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--fsg-blue);
    background: var(--fsg-blue);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
}
#fsg-send-btn:disabled, #fsg-user-input:disabled{ opacity: .5; cursor: not-allowed; }

/* Pending file preview — shown after picking a file, before it's sent */
.fsg-pending-file{
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--fsg-blue-light);
    border-radius: 8px;
    padding: 7px 10px;
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--fsg-blue);
}
.fsg-pending-file i.fa-paperclip{ font-size: 14px; }
.fsg-pending-file span{ flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsg-pending-file .fsg-pending-file-remove{
    cursor: pointer;
    color: #888;
    font-size: 15px;
    line-height: 1;
    padding: 2px 4px;
}
.fsg-pending-file .fsg-pending-file-remove:hover{ color: #c0392b; }

#fsg-user-input.fsg-input-required{ border-color: #c0392b; animation: fsg-shake .3s; }
@keyframes fsg-shake{
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Attachment bubble (user-sent file) */
.fsg-attachment{
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.15);
    border-radius: 8px;
    padding: 8px 10px;
    text-decoration: none !important;
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
}
.fsg-attachment i{ font-size: 16px; }

/* Quick-action chips (file upload / complaint shortcuts) */
.fsg-quick-actions{ display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.fsg-action-chip{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #d7e0e8;
    color: var(--fsg-blue);
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
.fsg-action-chip:hover{ background: var(--fsg-blue); color: #fff; border-color: var(--fsg-blue); }

/* Links inside chat */
#fsg-chat-box a{  font-weight: 600; text-decoration: none; }
#fsg-chat-box a:hover{ text-decoration: underline; }

/* Contact form fallback */
.fsg-contact-form{ display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.fsg-contact-form input, .fsg-contact-form textarea{
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
}
.fsg-contact-form textarea{ min-height: 70px; resize: vertical; }
.fsg-contact-submit{
    background: var(--fsg-amber);
    color: #1c2b3a;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-weight: 700;
    cursor: pointer;
}
.fsg-success{ color: #0a7a3c; font-weight: 600; }
.fsg-sla-note{ font-size: 12px; color: #666; }

/* File attach row inside contact form */
.fsg-file-label{
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px dashed #ccd5de;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 12.5px;
    color: var(--fsg-blue);
    cursor: pointer;
    transition: background .15s;
}
.fsg-file-label:hover{ background: var(--fsg-blue-light); }
.fsg-file-label-text{ flex:1; line-height:1.3; }
.fsg-file-input-hidden{ position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.fsg-file-chosen{
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--fsg-blue-light);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--fsg-blue);
    overflow: hidden;
}

/* =========================
   RTL SUPPORT (Arabic)
   Applied automatically once the widget detects an Arabic
   message — no manual language switch needed.
   ========================= */
.fsg-rtl{ direction: rtl; text-align: right; }
.fsg-rtl .fsg-user{ margin-left: 0; margin-right: auto; text-align: left; }
.fsg-rtl .fsg-chatbox-header{ flex-direction: row-reverse; }
.fsg-rtl #fsg-chat-icon{ right: auto; left: 20px; }
.fsg-rtl #fsg-chat-box{ right: auto; left: 20px; }

/* Mobile */
@media (max-width: 480px){
    #fsg-chat-box{ left: 10px; right: 10px; width: auto; }
    .fsg-rtl #fsg-chat-box{ left: 10px; right: 10px; }
    #fsg-back-to-top{ left: 10px; bottom: 20px; width: 42px; height: 42px; font-size: 16px; }
}
/* AI reply links rendered as pill-style buttons instead of raw URLs */
.fsg-chat-link-btn{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 6px 4px 2px 0;
    padding: 7px 14px;
    background: var(--fsg-blue);
    color: #fff !important;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s ease;
}
.fsg-chat-link-btn:hover{ background: var(--fsg-blue-dark); color: #fff !important; }
.fsg-chat-link-btn i{ font-size: 11px; }