/* Al Khuraif Live Support Widget */

.ak-support-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;
    font-family: inherit;
}

.ak-support-widget-ar {
    right: 24px;
    left: auto;
    direction: rtl;
}

/* =========================
   Launcher
========================= */

.ak-support-launcher {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 9px 18px 9px 11px;
    border: 0;
    border-radius: 999px;
    background: #062f52;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 14px 40px rgba(6, 47, 82, 0.26);
    transition: transform .2s ease, box-shadow .2s ease;
}

.ak-support-widget-ar .ak-support-launcher {
    padding: 9px 11px 9px 18px;
}

.ak-support-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 44px rgba(6, 47, 82, 0.32);
}

.ak-support-launcher-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    font-size: 19px;
}

.ak-support-launcher-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.ak-support-widget-ar .ak-support-launcher-copy {
    align-items: flex-end;
}

.ak-support-launcher-copy strong {
    font-size: 14px;
    font-weight: 800;
}

.ak-support-launcher-copy small {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, .82);
}

.ak-support-dot {
    width: 8px;
    height: 8px;
    display: inline-block;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #35d07f;
    box-shadow: 0 0 0 4px rgba(53, 208, 127, .13);
}

/* =========================
   Panel
========================= */

.ak-support-panel {
    position: absolute;
    right: 0;
    bottom: 72px;

    width: min(390px, calc(100vw - 32px));

    /*
     * Keep the complete widget inside the screen.
     * The body itself scrolls when necessary.
     */
    height: auto;
    max-height: calc(100dvh - 110px);

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: #ffffff;
    border: 1px solid rgba(6, 47, 82, .08);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .22);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(14px) scale(.985);
    transform-origin: bottom right;

    transition:
        opacity .2s ease,
        transform .2s ease,
        visibility .2s ease;
}

.ak-support-widget-ar .ak-support-panel {
    right: 0;
    left: auto;
    transform-origin: bottom right;
}

.ak-support-panel.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* =========================
   Header
========================= */

.ak-support-panel-header {
    flex: 0 0 auto;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;

    padding: 22px 22px 18px;

    background: #062f52;
    color: #ffffff;
}

.ak-support-panel-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 19px;
    font-weight: 800;
    line-height: 1.3;
}

.ak-support-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    margin-top: 8px;

    font-size: 12px;
    font-weight: 700;

    color: rgba(255, 255, 255, .84);
}

.ak-support-status.is-online {
    color: #d5ffe8;
}

.ak-support-status.is-message {
    color: rgba(255, 255, 255, .85);
}

.ak-support-close {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;

    display: grid;
    place-items: center;

    border: 0;
    border-radius: 50%;

    background: rgba(255, 255, 255, .10);
    color: #ffffff;

    cursor: pointer;
}

/* =========================
   Scrollable Body
========================= */

.ak-support-panel-body {
    flex: 1 1 auto;
    min-height: 0;

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

    padding: 22px;

    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;

    scrollbar-width: thin;
}

/*
 * Give the bottom of the form enough space so the
 * last field and submit button never sit against
 * the edge of the panel.
 */
.ak-support-panel-body::after {
    content: "";
    display: block;
    height: 4px;
}

/* WebKit scrollbar */
.ak-support-panel-body::-webkit-scrollbar {
    width: 7px;
}

.ak-support-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.ak-support-panel-body::-webkit-scrollbar-thumb {
    background: rgba(6, 47, 82, .28);
    border-radius: 999px;
}

.ak-support-panel-body::-webkit-scrollbar-thumb:hover {
    background: rgba(6, 47, 82, .42);
}

/* =========================
   Intro
========================= */

.ak-support-intro {
    margin: 0 0 18px;

    color: #062f52;
    font-size: 16px;
    font-weight: 800;
}

.ak-support-contact-note {
    display: block !important;

    margin: -8px 0 18px !important;

    color: #607383 !important;
    background: transparent !important;

    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.65 !important;

    opacity: 1 !important;
    visibility: visible !important;
}

/* =========================
   Form
========================= */

.ak-support-form {
    display: grid;
    gap: 14px;

    width: 100%;
    min-width: 0;

    padding-bottom: 4px;
}

.ak-support-field {
    display: grid;
    gap: 6px;

    width: 100%;
    min-width: 0;
}

.ak-support-field label {
    margin: 0;

    color: #173b58;

    font-size: 13px;
    font-weight: 700;
}

.ak-support-field label span {
    color: #1e90ff;
}

.ak-support-field input,
.ak-support-field select,
.ak-support-field textarea {
    display: block;

    width: 100%;
    max-width: 100%;
    min-width: 0;

    min-height: 44px;

    padding: 10px 12px;

    border: 1px solid #dce4ea;
    border-radius: 9px;

    outline: none;

    background: #ffffff;
    color: #18384f;

    font: inherit;
    font-size: 14px;

    box-sizing: border-box;

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

.ak-support-field textarea {
    min-height: 92px;
    max-height: 220px;
    resize: vertical;
}

.ak-support-field input:focus,
.ak-support-field select:focus,
.ak-support-field textarea:focus {
    border-color: #1e90ff;
    box-shadow: 0 0 0 3px rgba(30, 144, 255, .10);
}

.ak-support-field input.is-invalid,
.ak-support-field select.is-invalid,
.ak-support-field textarea.is-invalid {
    border-color: #df5c5c;
}

/* =========================
   Validation
========================= */

.ak-support-error {
    min-height: 16px;

    color: #c23d3d;

    font-size: 11px;
    line-height: 1.35;
}

.ak-support-server-error {
    padding: 10px 12px;

    border: 1px solid #f0cccc;
    border-radius: 8px;

    background: #fff5f5;
    color: #a83434;

    font-size: 12px;
    line-height: 1.5;

    overflow-wrap: anywhere;
}

/* =========================
   Buttons
========================= */

.ak-support-submit,
.ak-support-new-message {
    width: 100%;
    min-height: 46px;

    border: 0;
    border-radius: 9px;

    background: #062f52;
    color: #ffffff;

    font-size: 14px;
    font-weight: 800;

    cursor: pointer;

    transition:
        opacity .2s ease,
        transform .2s ease;
}

.ak-support-submit:hover,
.ak-support-new-message:hover {
    transform: translateY(-1px);
}

.ak-support-submit:disabled {
    opacity: .65;
    cursor: wait;
}

/* =========================
   Success
========================= */

.ak-support-success {
    text-align: center;
    padding: 18px 4px 6px;
}

.ak-support-success-icon {
    width: 56px;
    height: 56px;

    display: grid;
    place-items: center;

    margin: 0 auto 14px;

    border-radius: 50%;

    background: #e9f8f0;
    color: #16945a;

    font-size: 28px;
}

.ak-support-success h4 {
    margin: 0 0 8px;

    color: #062f52;

    font-size: 18px;
    font-weight: 800;
}

.ak-support-success p {
    margin: 0 0 18px;

    color: #607383;

    font-size: 13px;
    line-height: 1.65;
}

/* =========================
   Honeypot
========================= */

.ak-support-hp {
    position: absolute !important;

    left: -99999px !important;
    top: auto !important;

    width: 1px !important;
    height: 1px !important;

    overflow: hidden !important;

    opacity: 0 !important;

    pointer-events: none !important;
}

/* =========================
   Tablet / Smaller Laptops
========================= */

@media (max-width: 991.98px) {

    .ak-support-widget {
        right: 18px;
        bottom: 18px;
    }

    .ak-support-panel {
        bottom: 70px;

        max-height: calc(100dvh - 100px);
    }
}

/* =========================
   Mobile
========================= */

@media (max-width: 575.98px) {

    .ak-support-widget {
        right: 12px;
        bottom: 12px;
    }

    .ak-support-widget-ar {
        right: 12px;
        left: auto;
    }

    /*
     * Keep the small floating launcher.
     */
    .ak-support-launcher {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;

        padding: 8px;
        gap: 0;

        justify-content: center;
        border-radius: 50%;
    }

    /*
     * Arabic has a more specific desktop padding rule:
     * .ak-support-widget-ar .ak-support-launcher
     * Force the Arabic mobile launcher to match English exactly.
     */
    .ak-support-widget-ar .ak-support-launcher {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;

        padding: 8px;
        gap: 0;

        justify-content: center;
        border-radius: 50%;
    }

    .ak-support-launcher-copy {
        display: none;
    }

    .ak-support-launcher-icon,
    .ak-support-widget-ar .ak-support-launcher-icon {
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
        margin: 0;
    }

    /*
     * Mobile panel uses almost the complete screen,
     * but keeps a small safe margin around it.
     */
    .ak-support-panel {
        position: fixed;

        top: 10px;
        left: 10px !important;
        right: 10px !important;
        bottom: 78px;

        width: auto;
        height: auto;

        max-height: none;

        border-radius: 16px;

        transform-origin: bottom center;
    }

    .ak-support-panel-header {
        padding: 17px 18px 15px;
    }

    .ak-support-panel-header h3 {
        font-size: 18px;
    }

    .ak-support-panel-body {
        padding: 18px;

        /*
         * This is important:
         * body becomes the scrollable section,
         * while the header stays visible.
         */
        min-height: 0;
    }

    .ak-support-intro {
        margin-bottom: 14px;
        font-size: 15px;
    }

    .ak-support-contact-note {
        margin: -5px 0 16px !important;
        font-size: 12px !important;
    }

    .ak-support-form {
        gap: 12px;
        padding-bottom: 12px;
    }

    .ak-support-field input,
    .ak-support-field select,
    .ak-support-field textarea {
        /*
         * 16px prevents automatic zoom on iPhone/Safari.
         */
        font-size: 16px;
        min-height: 46px;
    }

    .ak-support-field textarea {
        min-height: 88px;
    }

    .ak-support-submit,
    .ak-support-new-message {
        min-height: 48px;
        font-size: 15px;
    }
}

/* =========================
   Very Small Phones
========================= */

@media (max-width: 390px) {

    .ak-support-panel {
        top: 8px;
        left: 8px !important;
        right: 8px !important;
        bottom: 76px;

        border-radius: 14px;
    }

    .ak-support-panel-header {
        padding: 15px 16px 14px;
    }

    .ak-support-panel-body {
        padding: 16px;
    }

    .ak-support-form {
        gap: 11px;
    }
}

/* =========================
   Very Short Screens
   Example: phone landscape
========================= */

@media (max-height: 600px) {

    .ak-support-panel {
        top: 8px;
        bottom: 70px;

        max-height: none;
    }

    .ak-support-panel-header {
        padding-top: 14px;
        padding-bottom: 12px;
    }

    .ak-support-panel-body {
        padding-top: 14px;
        padding-bottom: 16px;
    }

    .ak-support-intro {
        margin-bottom: 10px;
    }

    .ak-support-contact-note {
        margin-bottom: 12px !important;
    }

    .ak-support-form {
        gap: 10px;
    }
}

/* =========================
   Safe Area Support
   iPhone / modern mobile
========================= */

@supports (padding: env(safe-area-inset-bottom)) {

    @media (max-width: 575.98px) {

        .ak-support-widget {
            bottom: calc(12px + env(safe-area-inset-bottom));
        }

        .ak-support-panel {
            top: calc(8px + env(safe-area-inset-top));
            bottom: calc(76px + env(safe-area-inset-bottom));
        }
    }
}

/* =========================
   Reduced Motion
========================= */

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

    .ak-support-panel,
    .ak-support-launcher,
    .ak-support-submit,
    .ak-support-new-message {
        transition: none;
    }
}

/* =========================
   Color Overrides
========================= */

.ak-support-panel-body .ak-support-intro {
    color: #062f52 !important;
}

.ak-support-panel-body .ak-support-contact-note {
    color: #607383 !important;
}

.ak-support-panel-body label {
    color: #173b58 !important;
}