/* ==========================================================================
   "Ask NASR" AI chat assistant - on every page (script: assets/js/nasr-chat.js)
   Everything is scoped to .nc- classes so no page styles are affected.
   ========================================================================== */

.nc-root {
    --nc-gold: #C9A438;
    --nc-gold-hi: #E7CF86;
    --nc-gold-deep: #A7832A;
    --nc-navy: #111A2E;
    --nc-navy-2: #1B2A4A;
    --nc-ink: #111A2E;
    --nc-text: #334155;
    --nc-muted: #64748B;
    --nc-bg: #F7F5EF;
    --nc-card: #FFFFFF;
    --nc-line: rgba(17, 26, 46, 0.1);
    --nc-grad: linear-gradient(135deg, #E7CF86 0%, #C9A438 55%, #A7832A 100%);
    --nc-ease: cubic-bezier(0.22, 1, 0.36, 1);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    line-height: 1.5;
}

html.dark-mode .nc-root {
    --nc-ink: #F1F5F9;
    --nc-text: #CBD5E1;
    --nc-muted: #94A3B8;
    --nc-bg: #0C1526;
    --nc-card: #15223B;
    --nc-line: rgba(255, 255, 255, 0.1);
}

.nc-root *,
.nc-root *::before,
.nc-root *::after {
    box-sizing: border-box;
}

/* ---------- launcher ---------- */
.nc-launcher {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 2147483000;
    display: block;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    font: inherit;
}

/* floats to the left of the button, so the hidden label never takes up (clickable) space */
.nc-launcher-label {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    margin-top: -18px;
    padding: 9px 14px;
    border-radius: 999px;
    background: var(--nc-navy);
    color: #FFFFFF;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 12px 26px -12px rgba(17, 26, 46, 0.7);
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.35s ease, transform 0.45s var(--nc-ease);
    pointer-events: none;
}

.nc-launcher.is-hinting .nc-launcher-label,
.nc-launcher-btn:hover + .nc-launcher-label,
.nc-launcher:hover .nc-launcher-label,
.nc-launcher:focus-visible .nc-launcher-label {
    opacity: 1;
    transform: none;
}

.nc-launcher-btn {
    position: relative;
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--nc-grad);
    color: var(--nc-navy);
    box-shadow: 0 16px 34px -14px rgba(167, 131, 42, 0.95), 0 0 0 4px rgba(255, 255, 255, 0.65);
    transition: transform 0.4s var(--nc-ease), box-shadow 0.4s ease;
}

html.dark-mode .nc-launcher-btn {
    box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.9), 0 0 0 4px rgba(201, 164, 56, 0.25);
}

.nc-launcher:hover .nc-launcher-btn {
    transform: translateY(-3px) scale(1.05);
}

.nc-launcher:focus-visible {
    outline: none;
}

.nc-launcher:focus-visible .nc-launcher-btn {
    outline: 3px solid var(--nc-navy);
    outline-offset: 3px;
}

.nc-launcher-btn svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor !important;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nc-launcher-btn svg * {
    stroke: currentColor !important;
}

/* soft pulse ring until the chat has been opened once */
.nc-launcher-btn::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--nc-gold);
    opacity: 0;
    pointer-events: none;
}

.nc-launcher.is-new .nc-launcher-btn::after {
    animation: ncPulse 2.4s ease-out 1.5s infinite;
}

@keyframes ncPulse {
    0% { transform: scale(0.85); opacity: 0.8; }
    100% { transform: scale(1.35); opacity: 0; }
}

.nc-root.is-open .nc-launcher {
    opacity: 0;
    transform: scale(0.6);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.3s var(--nc-ease);
}

/* ---------- panel ---------- */
.nc-panel {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 2147483001;
    display: flex;
    flex-direction: column;
    width: min(400px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 140px));
    height: min(620px, calc(100dvh - 140px));
    border-radius: 22px;
    overflow: hidden;
    background: var(--nc-bg);
    border: 1px solid var(--nc-line);
    box-shadow: 0 30px 70px -24px rgba(17, 26, 46, 0.55), 0 0 0 1px rgba(201, 164, 56, 0.12);
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    transform-origin: bottom right;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.4s var(--nc-ease), visibility 0s linear 0.4s;
}

.nc-root.is-open .nc-panel {
    opacity: 1;
    transform: none;
    visibility: visible;
    transition: opacity 0.3s ease, transform 0.4s var(--nc-ease), visibility 0s;
}

.nc-head {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px 14px 14px 16px;
    background: linear-gradient(135deg, var(--nc-navy) 0%, var(--nc-navy-2) 100%);
    color: #FFFFFF;
}

.nc-avatar {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--nc-grad);
    color: var(--nc-navy);
    font-weight: 800;
    font-size: 1rem;
}

.nc-who {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.nc-who b {
    color: #FFFFFF !important;
    font-size: 0.98rem;
}

.nc-who small {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.72) !important;
    font-size: 0.74rem;
}

.nc-who small i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34D399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}

.nc-icon-btn {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
    cursor: pointer;
    transition: background 0.25s ease;
}

.nc-icon-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.nc-icon-btn:focus-visible {
    outline: 2px solid var(--nc-gold-hi);
    outline-offset: 2px;
}

.nc-icon-btn svg,
.nc-send svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor !important;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nc-icon-btn svg *,
.nc-send svg * {
    stroke: currentColor !important;
}

/* ---------- messages ---------- */
.nc-log {
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px 14px 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(201, 164, 56, 0.5) transparent;
}

.nc-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 12px;
    animation: ncIn 0.35s var(--nc-ease) both;
}

@keyframes ncIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.nc-msg.is-me {
    justify-content: flex-end;
}

.nc-msg-avatar {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--nc-grad);
    color: var(--nc-navy);
    font-size: 0.7rem;
    font-weight: 800;
}

.nc-bubble {
    max-width: 86%;
    padding: 10px 13px;
    border-radius: 16px 16px 16px 5px;
    background: var(--nc-card);
    color: var(--nc-text) !important;
    font-size: 0.9rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 2px rgba(17, 26, 46, 0.06), 0 8px 18px -14px rgba(17, 26, 46, 0.45);
}

.nc-msg.is-me .nc-bubble {
    border-radius: 16px 16px 5px 16px;
    background: var(--nc-grad);
    color: var(--nc-navy) !important;
    font-weight: 500;
}

.nc-bubble p {
    margin: 0 0 0.5em;
    color: inherit !important;
}

.nc-bubble p:last-child,
.nc-bubble ul:last-child,
.nc-bubble ol:last-child {
    margin-bottom: 0;
}

.nc-bubble ul,
.nc-bubble ol {
    margin: 0 0 0.5em;
    padding-left: 1.2em;
}

.nc-bubble li {
    margin-bottom: 0.2em;
    color: inherit !important;
}

.nc-bubble strong {
    color: var(--nc-ink) !important;
}

.nc-msg.is-me .nc-bubble strong {
    color: inherit !important;
}

.nc-bubble a {
    color: var(--nc-gold-deep) !important;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

html.dark-mode .nc-bubble a {
    color: var(--nc-gold-hi) !important;
}

/* typing / searching indicator */
.nc-typing .nc-bubble {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 12px 14px;
}

.nc-typing i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--nc-gold);
    animation: ncDot 1.1s ease-in-out infinite;
}

.nc-typing i:nth-child(2) { animation-delay: 0.15s; }
.nc-typing i:nth-child(3) { animation-delay: 0.3s; }

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

.nc-status {
    margin: -4px 0 10px 34px;
    color: var(--nc-muted);
    font-size: 0.76rem;
    font-style: italic;
}

.nc-cursor::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 1em;
    margin-left: 2px;
    vertical-align: -2px;
    border-radius: 2px;
    background: var(--nc-gold);
    animation: ncBlink 0.9s steps(2) infinite;
}

@keyframes ncBlink {
    50% { opacity: 0; }
}

/* suggested questions */
.nc-suggest {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px 34px;
}

.nc-chip {
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(201, 164, 56, 0.55);
    background: var(--nc-card);
    color: var(--nc-gold-deep) !important;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, transform 0.3s var(--nc-ease);
}

html.dark-mode .nc-chip {
    color: var(--nc-gold-hi) !important;
}

.nc-chip:hover {
    background: var(--nc-grad);
    color: var(--nc-navy) !important;
    transform: translateY(-2px);
}

.nc-chip:focus-visible {
    outline: 2px solid var(--nc-gold);
    outline-offset: 2px;
}

/* ---------- composer ---------- */
.nc-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px 6px;
    border-top: 1px solid var(--nc-line);
    background: var(--nc-card);
}

.nc-input {
    flex: 1 1 auto;
    min-height: 42px;
    max-height: 120px;
    padding: 10px 14px;
    border: 1px solid var(--nc-line);
    border-radius: 14px;
    background: var(--nc-bg);
    color: var(--nc-ink) !important;
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    resize: none;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.nc-input::placeholder {
    color: var(--nc-muted);
}

.nc-input:focus {
    border-color: var(--nc-gold);
    box-shadow: 0 0 0 3px rgba(201, 164, 56, 0.18);
}

.nc-send {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--nc-grad);
    color: var(--nc-navy);
    cursor: pointer;
    box-shadow: 0 10px 20px -10px rgba(167, 131, 42, 0.9);
    transition: transform 0.3s var(--nc-ease), opacity 0.2s ease;
}

.nc-send:hover {
    transform: translateY(-2px);
}

.nc-send:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
}

.nc-send:focus-visible {
    outline: 2px solid var(--nc-navy);
    outline-offset: 2px;
}

/* ---------- WhatsApp: notice, optional details, delivery status ---------- */
.nc-team {
    display: grid;
    gap: 6px;
    padding: 2px 14px 8px;
    background: var(--nc-card);
    color: var(--nc-muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.nc-team[hidden] {
    display: none !important;
}

.nc-consent {
    margin: 0;
    color: var(--nc-text);
}

.nc-consent a,
.nc-delivery a {
    color: inherit !important;
    text-decoration: underline;
}
.nc-team [hidden] {
    display: none !important;
}

.nc-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.nc-field {
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--nc-line);
    border-radius: 10px;
    background: var(--nc-bg);
    color: var(--nc-ink) !important;
    font: inherit;
    font-size: 0.78rem;
    outline: none;
}

.nc-field:focus {
    border-color: var(--nc-gold);
    box-shadow: 0 0 0 3px rgba(201, 164, 56, 0.18);
}

.nc-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.nc-delivery {
    margin: -6px 0 12px auto;
    max-width: 88%;
    color: var(--nc-muted);
    font-size: 0.72rem;
    line-height: 1.4;
    text-align: right;
}

.nc-delivery.is-sending::before {
    content: '';
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 6px;
    vertical-align: -1px;
    border: 2px solid var(--nc-gold);
    border-right-color: transparent;
    border-radius: 50%;
    animation: ncSpin 0.8s linear infinite;
}

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

.nc-delivery.is-ok {
    color: #15803D;
}

.nc-delivery.is-wait {
    color: #B45309;
}

html.dark-mode .nc-delivery.is-wait {
    color: #FBBF24;
}

/* replies from the NASR team on WhatsApp */
.nc-msg.is-team .nc-bubble {
    border: 1px solid rgba(37, 162, 68, 0.35);
    box-shadow: inset 3px 0 0 #25A244;
}

.nc-from {
    display: block;
    margin-bottom: 3px;
    color: #15803D;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

html.dark-mode .nc-from {
    color: #4ADE80;
}

.nc-team-text {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

html.dark-mode .nc-delivery.is-ok {
    color: #4ADE80;
}

.nc-delivery.is-fail {
    color: #B91C1C;
}

html.dark-mode .nc-delivery.is-fail {
    color: #FCA5A5;
}

.nc-linkbtn {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.nc-note {
    margin: 0;
    padding: 0 14px 10px;
    background: var(--nc-card);
    color: var(--nc-muted) !important;
    font-size: 0.68rem;
    line-height: 1.4;
    text-align: center;
}

.nc-note a {
    color: inherit !important;
    text-decoration: underline;
}

.nc-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- phones: full-screen sheet ---------- */
@media (max-width: 560px) {
    .nc-launcher {
        right: 16px;
        bottom: 16px;
    }

    .nc-launcher-btn {
        width: 54px;
        height: 54px;
    }

    .nc-panel {
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        border: 0;
    }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .nc-root *,
    .nc-root *::before,
    .nc-root *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* print: never print the chat */
@media print {
    .nc-root {
        display: none !important;
    }
}

/* ---------- Dark mode colour restore ----------
   style.css forces every span in dark mode to grey with !important (weight 0,5,2),
   which made the chat icon grey on the gold button. ":not(#nc-x)" only adds weight. */
html.dark-mode .nc-launcher-btn:not(#nc-x) { color: var(--nc-navy) !important; }
