/* =========================================================
   APADANA PERSIAN FAQ ASSISTANT
========================================================= */

@font-face {
    font-family: "myfont";
    src:
        url("../fonts/myfont.ttf") format("truetype"),
        url("../fonts/myfont.woff") format("woff"),
        url("../fonts/myfont.eot") format("embedded-opentype");
    font-style: normal;
    font-weight: normal;
}

@font-face {
    font-family: "shabnam";
    src: url("../fonts/Shabnam-FD.ttf") format("truetype");
    font-style: normal;
    font-weight: 100 900;
}

@font-face {
    font-family: "IranSans";
    src:
        url("../fonts/IRANSansWeb(FaNum)_UltraLight.woff2") format("woff2"),
        url("../fonts/IRANSansWeb(FaNum)_UltraLight.woff") format("woff"),
        url("../fonts/IRANSansWeb(FaNum)_UltraLight.ttf") format("truetype");
}


/* =========================================================
   GLOBAL CHATBOT
========================================================= */

.apadana-ai-chatbot {
    position: fixed;

    left: 18px;
    bottom: 18px;

    z-index: 99999;

    direction: rtl;

    font-family: "shabnam", sans-serif;
    font-weight: 700;

    line-height: 1.5;
}


/* =========================================================
   CHATBOT LAUNCHER
========================================================= */

.apadana-ai-launcher {
    position: relative;

    width: 54px;
    height: 54px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #ffffff;

    color: #a21c43;

    cursor: pointer;

    z-index: 2147483003;

    pointer-events: auto;

    overflow: visible;

    isolation: isolate;

    box-shadow:
        0 10px 28px rgba(0, 0, 0, .20),
        0 4px 14px rgba(162, 28, 67, .12);

    animation:
        apadanaAiFloat 3.6s ease-in-out infinite,
        apadanaAiGlow 3.6s ease-in-out infinite;

    transition:
        transform .28s cubic-bezier(.22, 1, .36, 1),
        box-shadow .28s ease,
        background-color .25s ease;
}


/* =========================================================
   OUTER PULSE RING
========================================================= */

.apadana-ai-launcher::before {
    content: "";

    position: absolute;

    inset: -5px;

    border-radius: 50%;

    border: 2px solid rgba(162, 28, 67, .30);

    opacity: 0;

    transform: scale(.72);

    pointer-events: none;

    z-index: -1;

    animation:
        apadanaAiPulseRing 3.2s ease-out infinite;
}


/* =========================================================
   SOFT OUTER AURA
========================================================= */

.apadana-ai-launcher::after {
    content: "";

    position: absolute;

    inset: -9px;

    border-radius: 50%;

    background: rgba(162, 28, 67, .11);

    filter: blur(11px);

    opacity: .55;

    pointer-events: none;

    z-index: -2;

    animation:
        apadanaAiAura 3.6s ease-in-out infinite;
}


/* =========================================================
   PNG ICON
========================================================= */

.apadana-ai-launcher__icon {
    width: 46px;
    height: 46px;

    object-fit: contain;

    display: block;

    position: relative;

    z-index: 3;

    opacity: 1;

    transform-origin: center;

    animation:
        apadanaAiIcon 3.6s ease-in-out infinite;

    transition:
        transform .3s cubic-bezier(.22, 1, .36, 1),
        filter .3s ease,
        opacity .25s ease;
}


/* =========================================================
   LAUNCHER HOVER
========================================================= */

.apadana-ai-launcher:hover {
    animation-play-state: paused;

    transform:
        translateY(-5px)
        scale(1.08);

    background: #ffffff;

    box-shadow:
        0 18px 42px rgba(0, 0, 0, .20),
        0 10px 30px rgba(162, 28, 67, .27),
        0 0 0 7px rgba(162, 28, 67, .055);
}

.apadana-ai-launcher:hover::before,
.apadana-ai-launcher:hover::after,
.apadana-ai-launcher:hover .apadana-ai-launcher__icon {
    animation-play-state: paused;
}

.apadana-ai-launcher:hover .apadana-ai-launcher__icon {
    transform:
        scale(1.12)
        rotate(-3deg);

    filter:
        drop-shadow(
            0 5px 9px
            rgba(162, 28, 67, .22)
        );
}


/* =========================================================
   LAUNCHER ACTIVE
========================================================= */

.apadana-ai-launcher:active {
    animation-play-state: paused;

    transform:
        translateY(-1px)
        scale(.94);

    box-shadow:
        0 7px 18px rgba(0, 0, 0, .16),
        0 4px 13px rgba(162, 28, 67, .18);
}

.apadana-ai-launcher:active .apadana-ai-launcher__icon {
    transform: scale(.94);
}


/* =========================================================
   LAUNCHER FLOAT
========================================================= */

@keyframes apadanaAiFloat {

    0%,
    100% {
        transform:
            translateY(0)
            scale(1);
    }

    50% {
        transform:
            translateY(-4px)
            scale(1.025);
    }
}


/* =========================================================
   LAUNCHER GLOW
========================================================= */

@keyframes apadanaAiGlow {

    0%,
    100% {
        box-shadow:
            0 10px 28px rgba(0, 0, 0, .20),
            0 4px 14px rgba(162, 28, 67, .12);
    }

    50% {
        box-shadow:
            0 14px 36px rgba(0, 0, 0, .18),
            0 9px 28px rgba(162, 28, 67, .24),
            0 0 0 6px rgba(162, 28, 67, .045);
    }
}


/* =========================================================
   PULSE RING
========================================================= */

@keyframes apadanaAiPulseRing {

    0% {
        opacity: 0;

        transform: scale(.72);
    }

    10% {
        opacity: .72;
    }

    42% {
        opacity: 0;

        transform: scale(1.38);
    }

    100% {
        opacity: 0;

        transform: scale(1.38);
    }
}


/* =========================================================
   SOFT AURA
========================================================= */

@keyframes apadanaAiAura {

    0%,
    100% {
        opacity: .38;

        transform: scale(.88);
    }

    50% {
        opacity: .72;

        transform: scale(1.08);
    }
}


/* =========================================================
   ICON MICRO ANIMATION
========================================================= */

@keyframes apadanaAiIcon {

    0%,
    100% {
        transform:
            scale(1)
            rotate(0deg);
    }

    40% {
        transform:
            scale(1.035)
            rotate(-1deg);
    }

    50% {
        transform:
            scale(1.075)
            rotate(1.5deg);
    }

    60% {
        transform:
            scale(1)
            rotate(0deg);
    }
}


/* =========================================================
   CHAT PANEL
========================================================= */

.apadana-ai-panel {
    position: fixed;

    left: 18px;
    bottom: 86px;

    width: min(360px, calc(100vw - 28px));
    height: min(540px, calc(100vh - 40px));

    display: flex;
    flex-direction: column;

    overflow: hidden;

    border:
        1px solid
        rgba(15, 23, 42, .09);

    border-radius: 20px;

    z-index: 2147483002;

    pointer-events: auto;

    cursor: default;

    background: #ffffff;

    box-shadow:
        0 24px 70px rgba(2, 8, 23, .22),
        0 8px 26px rgba(162, 28, 67, .07);

    transform-origin:
        left bottom;

    animation:
        apadanaAiPanelIn .34s
        cubic-bezier(.22, 1, .36, 1);
}


/* =========================================================
   PANEL ENTRANCE
========================================================= */

@keyframes apadanaAiPanelIn {

    from {
        opacity: 0;

        transform:
            translateY(14px)
            scale(.94);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}


/* =========================================================
   CHAT HEADER
========================================================= */

.apadana-ai-header {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    padding: 13px 14px;

    background:
        linear-gradient(
            135deg,
            #0b1220 0%,
            #351421 58%,
            #a21c43 135%
        );

    color: #ffffff;

    overflow: hidden;

    flex: 0 0 auto;
}


/* =========================================================
   HEADER SHINE
========================================================= */

.apadana-ai-header::after {
    content: "";

    position: absolute;

    top: -120%;
    left: -45%;

    width: 32%;
    height: 340%;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, .10),
            transparent
        );

    transform: rotate(20deg);

    pointer-events: none;

    animation:
        apadanaAiHeaderShine 6s
        ease-in-out infinite;
}

@keyframes apadanaAiHeaderShine {

    0%,
    55% {
        left: -45%;
        opacity: 0;
    }

    62% {
        opacity: 1;
    }

    78%,
    100% {
        left: 135%;
        opacity: 0;
    }
}


/* =========================================================
   HEADER CONTENT
========================================================= */

.apadana-ai-header > div:not(.apadana-ai-header__avatar) {
    display: flex;
    flex-direction: column;

    gap: 2px;

    min-width: 0;

    flex: 1;

    position: relative;

    z-index: 2;
}

.apadana-ai-header strong {
    font-size: 15px;

    font-weight: 900;

    line-height: 1.7;

    text-align: right;
}

.apadana-ai-header span {
    font-size: 11px;

    font-weight: 700;

    line-height: 1.6;

    text-align: right;

    opacity: .85;
}


/* =========================================================
   HEADER AVATAR
========================================================= */

.apadana-ai-header__avatar {
    width: 42px;
    height: 42px;

    flex: 0 0 auto;

    border-radius: 14px;

    background:
        linear-gradient(
            145deg,
            #ffffff,
            #fdf1f5
        );

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    position: relative;

    z-index: 2;

    box-shadow:
        0 5px 16px rgba(0, 0, 0, .15),
        0 0 0 1px rgba(162, 28, 67, .08);
}

.apadana-ai-header__avatar img {
    width: 38px;
    height: 38px;

    object-fit: contain;
}


/* =========================================================
   CLOSE BUTTON
========================================================= */

.apadana-ai-close {
    position: relative;
    z-index: 3;

    width: 38px;
    height: 38px;

    flex: 0 0 auto;

    border:
        1px solid
        rgba(255, 255, 255, .08);

    border-radius: 11px;

    background:
        rgba(255, 255, 255, .055);

    color:
        rgba(255, 255, 255, .86);

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    font-size: 0;

    transition:
        background-color .22s ease,
        border-color .22s ease,
        color .22s ease,
        transform .22s ease;
}

.apadana-ai-close::before {
    content: "\00d7";

    font-family: Arial, sans-serif;

    font-size: 25px;
    font-weight: 400;

    line-height: 1;
}

.apadana-ai-close:hover {
    background:
        rgba(162, 28, 67, .32);

    border-color:
        rgba(162, 28, 67, .42);

    color: #ffffff;

    transform:
        rotate(90deg)
        scale(1.05);
}

.apadana-ai-close:active {
    transform:
        rotate(90deg)
        scale(.92);
}


/* =========================================================
   MESSAGES
========================================================= */

.apadana-ai-messages {
    flex: 1;

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    display: flex;
    flex-direction: column;

    gap: 8px;

    padding: 13px;

    background:
        linear-gradient(
            180deg,
            #fafafa 0%,
            #f8f8f8 100%
        );

    scroll-behavior: smooth;

    scrollbar-width: thin;
    scrollbar-color:
        rgba(162, 28, 67, .22)
        transparent;
}

.apadana-ai-messages::-webkit-scrollbar {
    width: 5px;
}

.apadana-ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

.apadana-ai-messages::-webkit-scrollbar-thumb {
    background:
        rgba(162, 28, 67, .20);

    border-radius: 999px;
}


/* =========================================================
   MESSAGE
========================================================= */

.apadana-ai-message {
    max-width: 88%;

    padding: 9px 11px;

    border-radius: 12px;

    font-size: 13px;

    font-weight: 700;

    color: #000000;

    line-height: 2;

    white-space: pre-wrap;

    text-align: right;

    animation:
        apadanaAiMessageIn .28s
        cubic-bezier(.22, 1, .36, 1);

    transition:
        transform .2s ease,
        box-shadow .2s ease;
}

.apadana-ai-message:hover {
    transform:
        translateY(-1px);
}

@keyframes apadanaAiMessageIn {

    from {
        opacity: 0;

        transform:
            translateY(7px)
            scale(.97);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}


/* =========================================================
   BOT MESSAGE
========================================================= */

.apadana-ai-message.bot {
    align-self: flex-start;

    background: #ffffff;

    border:
        1px solid
        #e7e7e7;

    color: #000000;

    border-bottom-right-radius: 3px;

    box-shadow:
        0 3px 10px rgba(0, 0, 0, .035);
}


/* =========================================================
   USER MESSAGE
========================================================= */

.apadana-ai-message.user {
    align-self: flex-end;

    background:
        linear-gradient(
            135deg,
            #a21c43,
            #b5224f
        );

    color: #ffffff;

    border-bottom-left-radius: 3px;

    box-shadow:
        0 5px 15px rgba(162, 28, 67, .15);
}


/* =========================================================
   SUGGESTIONS
========================================================= */

.apadana-ai-suggestions {
    display: flex;

    flex-wrap: nowrap;

    gap: 6px;

    padding: 8px 10px;

    background: #ffffff;

    overflow-x: auto;
    overflow-y: hidden;

    scrollbar-width: thin;

    -webkit-overflow-scrolling: touch;
}

.apadana-ai-suggestions::-webkit-scrollbar {
    height: 4px;
}

.apadana-ai-suggestions::-webkit-scrollbar-thumb {
    background:
        rgba(162, 28, 67, .18);

    border-radius: 999px;
}


/* =========================================================
   SUGGESTION BUTTONS
========================================================= */

.apadana-ai-suggestions button {
    flex: 0 0 auto;

    border:
        1px solid
        rgba(162, 28, 67, .18);

    border-radius: 999px;

    padding: 6px 11px;

    background:
        rgba(162, 28, 67, .05);

    color: #a21c43;

    cursor: pointer;

    font-family: "shabnam", sans-serif;

    font-size: 12px;

    font-weight: 800;

    white-space: nowrap;

    box-shadow:
        0 2px 7px rgba(162, 28, 67, .03);

    transition:
        transform .22s ease,
        background-color .22s ease,
        border-color .22s ease,
        color .22s ease,
        box-shadow .22s ease;
}

.apadana-ai-suggestions button:hover {
    background:
        #a21c43;

    border-color:
        #a21c43;

    color: #ffffff;

    transform:
        translateY(-2px);

    box-shadow:
        0 7px 17px rgba(162, 28, 67, .20);
}

.apadana-ai-suggestions button:active {
    transform:
        translateY(0)
        scale(.95);
}


/* =========================================================
   INPUT FORM
========================================================= */

.apadana-ai-form {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        40px;

    gap: 7px;

    padding:
        9px
        10px
        10px;

    background: #ffffff;

    border-top:
        1px solid
        #eeeeee;
}


/* =========================================================
   INPUT
========================================================= */

.apadana-ai-form input {
    width: 100%;
    min-width: 0;

    padding:
        8px
        10px;

    border:
        1px solid
        #dddddd;

    border-radius: 9px;

    outline: none;

    background: #ffffff;

    color: #000000;

    font-family: "shabnam", sans-serif;

    font-size: 12px;

    font-weight: 700;

    transition:
        border-color .22s ease,
        box-shadow .22s ease,
        transform .22s ease,
        background-color .22s ease;
}

.apadana-ai-form input:hover {
    border-color:
        rgba(162, 28, 67, .30);
}

.apadana-ai-form input:focus {
    border-color:
        #a21c43;

    box-shadow:
        0 0 0 3px
        rgba(162, 28, 67, .08);

    transform:
        translateY(-1px);
}

.apadana-ai-form input::placeholder {
    color:
        rgba(0, 0, 0, .48);

    font-family: "shabnam", sans-serif;

    font-size: 12px;

    font-weight: 700;
}


/* =========================================================
   SEND BUTTON
========================================================= */

.apadana-ai-form button {
    border: 0;

    border-radius: 9px;

    background:
        linear-gradient(
            135deg,
            #a21c43,
            #b5224f
        );

    color: #ffffff;

    cursor: pointer;

    padding: 8px 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow:
        0 4px 12px rgba(162, 28, 67, .13);

    transition:
        transform .2s ease,
        box-shadow .2s ease,
        filter .2s ease;
}

.apadana-ai-form button:hover {
    transform:
        translateY(-2px)
        scale(1.04);

    box-shadow:
        0 8px 20px rgba(162, 28, 67, .23);

    filter:
        brightness(1.06);
}

.apadana-ai-form button:active {
    transform:
        translateY(0)
        scale(.94);

    box-shadow:
        0 3px 9px rgba(162, 28, 67, .16);
}


/* =========================================================
   HIDDEN STATES
========================================================= */

.apadana-ai-panel.is-hidden {
    display: none !important;
}


/* =========================================================
   FOCUS ACCESSIBILITY
========================================================= */

.apadana-ai-launcher:focus-visible,
.apadana-ai-close:focus-visible,
.apadana-ai-suggestions button:focus-visible,
.apadana-ai-form button:focus-visible {
    outline:
        3px solid
        rgba(162, 28, 67, .28);

    outline-offset: 3px;
}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .apadana-ai-launcher,
    .apadana-ai-launcher::before,
    .apadana-ai-launcher::after,
    .apadana-ai-launcher__icon,
    .apadana-ai-panel,
    .apadana-ai-header::after,
    .apadana-ai-message {
        animation: none !important;
    }

    .apadana-ai-launcher,
    .apadana-ai-launcher__icon,
    .apadana-ai-close,
    .apadana-ai-suggestions button,
    .apadana-ai-form input,
    .apadana-ai-form button {
        transition: none !important;
    }
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 600px) {

    .apadana-ai-chatbot {
        left: 12px;
        bottom: 12px;
    }

    .apadana-ai-launcher {
        width: 50px;
        height: 50px;
    }

    .apadana-ai-launcher__icon {
        width: 42px;
        height: 42px;
    }

    .apadana-ai-panel {
        left: 12px;
        bottom: 74px;

        width:
            calc(100vw - 24px);

        height:
            min(
                540px,
                calc(100vh - 94px)
            );

        border-radius: 18px;
    }
}


/* =========================================================
   VERY SMALL SCREENS
========================================================= */

@media (max-width: 380px) {

    .apadana-ai-panel {
        left: 8px;
        bottom: 70px;

        width:
            calc(100vw - 16px);

        height:
            calc(100vh - 86px);

        border-radius: 16px;
    }

    .apadana-ai-header {
        padding:
            11px 12px;
    }

    .apadana-ai-header strong {
        font-size: 13px;
    }

    .apadana-ai-header span {
        font-size: 10px;
    }

    .apadana-ai-messages {
        padding: 10px;
    }

    .apadana-ai-message {
        max-width: 92%;

        font-size: 12px;
    }
}

.apadana-ai-panel,
.apadana-ai-panel * {
    cursor: default;
}

.apadana-ai-panel button,
.apadana-ai-panel a {
    cursor: pointer;
}

.apadana-ai-form input,
.apadana-ai-form textarea {
    cursor: text;
}

.apadana-ai-messages {
    cursor: default;
}

.apadana-ai-message {
    cursor: default;
}

.apadana-ai-suggestions {
    cursor: default;
}

.apadana-ai-suggestions button {
    cursor: pointer;
}

.apadana-ai-close {
    cursor: pointer;
}

.apadana-ai-form button {
    cursor: pointer;
}