/* Support tickets — loaded only by support/*.php on top of assets/style.css. */

.ticket-hero { text-align: center; }

.ticket-hero h1 {
    margin: 0;
    color: var(--brand-dark);
    font-size: clamp(1.9rem, 5.5vw, 3.1rem);
    line-height: 1.3;
    letter-spacing: -.03em;
}

.ticket-hero h1 span { display: block; color: #eeb500; }

.ticket-hero > p:last-child {
    max-width: 46ch;
    margin: 18px auto 30px;
    color: #3e4850;
    font-size: clamp(.98rem, 2.6vw, 1.2rem);
    line-height: 1.8;
}

.ticket-notice { margin: 0 0 20px; }

.ticket-form { display: grid; gap: 18px; }

.ticket-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.ticket-field { display: grid; align-content: start; gap: 7px; min-width: 0; }
.ticket-wide { grid-column: 1 / -1; }

.ticket-field label {
    color: var(--brand-dark);
    font-size: clamp(.98rem, 2.3vw, 1.08rem);
    font-weight: 800;
}

.ticket-field input,
.ticket-field select,
.ticket-field textarea {
    width: 100%;
    min-height: 58px;
    padding: 12px 16px;
    border: 1px solid #cbd6de;
    border-radius: 12px;
    outline: 0;
    color: var(--brand-dark);
    background: #fbfcfd;
    font: inherit;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.ticket-field textarea { min-height: 150px; resize: vertical; line-height: 1.8; }
.ticket-field .ltr-value { direction: ltr; text-align: right; }
.ticket-field .ltr-value::placeholder { direction: rtl; }
.ticket-field input::placeholder,
.ticket-field textarea::placeholder { color: #8d9aa6; opacity: 1; }

.ticket-field input:focus,
.ticket-field select:focus,
.ticket-field textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(26, 146, 206, .14);
}

.ticket-field [aria-invalid="true"] { border-color: var(--danger); background: var(--danger-soft); }
.ticket-error { color: var(--danger); font-size: .8rem; font-weight: 700; }

.ticket-trap {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.ticket-privacy {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-size: .86rem;
}

.ticket-success { display: grid; justify-items: center; gap: 10px; text-align: center; }
.ticket-success h1 { margin: 4px 0 0; color: var(--brand-dark); font-size: clamp(1.6rem, 5vw, 2.3rem); }
.ticket-success p { max-width: 44ch; margin: 0; color: #3e4850; }
.ticket-success .result-check { width: 56px; height: 56px; font-size: 1.5rem; }
.ticket-success .ticket-reference-label { color: var(--muted); font-size: .85rem; }

.ticket-reference {
    padding: 8px 24px;
    border: 2px dashed var(--gold-bright);
    border-radius: 12px;
    color: var(--brand-dark);
    background: #fff9e5;
    font-size: clamp(1.6rem, 6vw, 2.3rem);
    letter-spacing: .06em;
}

.ticket-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 10px; }
.ticket-links .primary-button { margin-top: 0; padding-inline: 22px; }
.ticket-links .text-button { display: inline-flex; align-items: center; min-height: 54px; padding-inline: 20px; text-decoration: none; }

.ticket-login-button { width: 100%; margin-top: 18px; }

.ticket-admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.ticket-admin-grid .count-card { min-width: 0; }
.ticket-admin-card .notice { margin-top: 0; }
.ticket-last-error { margin: 14px 0 0; color: var(--danger); font-size: .88rem; overflow-wrap: anywhere; }
.ticket-admin-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.ticket-admin-actions .primary-button { padding-inline: 20px; }
.ticket-admin-hint { margin: 12px 0 0; color: var(--muted); font-size: .82rem; }

@media (max-width: 560px) {
    .ticket-grid,
    .ticket-admin-grid { grid-template-columns: 1fr; }
    .ticket-field input,
    .ticket-field select { min-height: 54px; }
    .ticket-privacy { font-size: .8rem; }
    .ticket-links,
    .ticket-admin-actions { flex-direction: column; align-items: stretch; }
    .ticket-links .text-button { justify-content: center; }
}

/* Floating help assistant (support/src/help-widget.php) on the public portal. */

.help-widget-spacer { height: 140px; }

.help-launcher {
    position: fixed;
    left: max(14px, env(safe-area-inset-left));
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0;
    border: 0;
    background: none;
    direction: ltr;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    /* Only the robot and the visible bubble take taps, never the empty box around them. */
    pointer-events: none;
}

.help-bot,
.help-bubble { pointer-events: auto; }

.help-launcher:focus-visible { outline: 3px solid rgba(13, 120, 173, .45); outline-offset: 4px; border-radius: 22px; }

.help-bot {
    display: block;
    width: 120px;
    height: auto;
    overflow: visible;
    filter: drop-shadow(0 10px 14px rgba(6, 62, 92, .18));
}

.help-bot .bot-figure { animation: help-float 3.4s ease-in-out infinite; }
.help-bot .bot-shadow { transform-origin: 70px 153px; animation: help-shadow 3.4s ease-in-out infinite; }
.bot-wave { transform-origin: 99px 107px; animation: help-wave 4.6s ease-in-out infinite; }
.bot-eyes { transform-origin: 70px 61px; animation: help-blink 5s infinite; }
.bot-tassel { transform-origin: 104px 27px; animation: help-tassel 3.4s ease-in-out infinite; }
.help-launcher:hover .bot-wave { animation-duration: 1.4s; }

.help-bubble {
    position: relative;
    margin-bottom: 60px;
    padding: 11px 18px;
    border-radius: 14px;
    color: var(--brand-dark);
    background: var(--gold-bright);
    box-shadow: 0 10px 24px rgba(6, 62, 92, .18);
    direction: rtl;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.5;
    white-space: nowrap;
    animation: help-pop .45s .8s cubic-bezier(.2, 1.4, .4, 1) both;
}

.help-bubble::before {
    content: "";
    position: absolute;
    bottom: 12px;
    left: -7px;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 8px solid var(--gold-bright);
}

.help-widget:has(.help-panel:popover-open) .help-bubble { visibility: hidden; animation: none; }

.help-panel {
    position: fixed;
    inset: auto auto 156px max(16px, env(safe-area-inset-left));
    width: min(390px, calc(100vw - 32px));
    max-height: min(680px, calc(100dvh - 150px));
    margin: 0;
    padding: 0;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid #e3eaef;
    border-radius: 20px;
    color: var(--ink);
    background: #ffffff;
    box-shadow: 0 28px 70px rgba(8, 48, 70, .28);
    font-family: "Cairo", Tahoma, Arial, sans-serif;
    line-height: 1.7;
    transition: opacity .2s ease, transform .2s ease;
}

@starting-style {
    .help-panel:popover-open { opacity: 0; transform: translateY(14px) scale(.98); }
}

.help-panel::backdrop { background: rgba(6, 30, 45, .16); }

.help-panel-header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
}

.help-avatar {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(250, 192, 23, .7);
}

.help-avatar svg { width: 40px; height: 40px; }
.help-panel-title strong,
.help-panel-title small { display: block; }
.help-panel-title strong { font-size: 1.02rem; }
.help-panel-title small { color: rgba(255, 255, 255, .8); font-size: .78rem; }

.help-close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #ffffff;
    background: rgba(255, 255, 255, .14);
}

.help-close:hover { background: rgba(255, 255, 255, .26); }
.help-close:focus-visible { outline: 3px solid rgba(250, 192, 23, .8); outline-offset: 2px; }

.help-panel-body { display: grid; gap: 14px; padding: 16px; }

.help-greeting {
    margin: 0;
    padding: 12px 14px;
    border-radius: 16px;
    border-start-start-radius: 4px;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-size: .9rem;
}

.help-form { gap: 12px; }
.help-form .ticket-grid { grid-template-columns: 1fr; gap: 12px; }
.help-form .ticket-field label { font-size: .9rem; }
.help-form .ticket-field input,
.help-form .ticket-field select { min-height: 48px; }
.help-form .ticket-field textarea { min-height: 96px; height: 110px; }
.help-form .ticket-privacy { font-size: .8rem; }
.help-submit { min-height: 56px; margin-top: 0; font-size: 1rem; }
.help-submit .material-symbols-rounded { font-size: 1.6rem; }

.help-call {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--brand-dark);
    font-size: .9rem;
    font-weight: 700;
    text-decoration: none;
}

@keyframes help-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes help-shadow { 0%, 100% { transform: scaleX(1); opacity: .9; } 50% { transform: scaleX(.82); opacity: .55; } }
@keyframes help-wave {
    0%, 55%, 100% { transform: rotate(0); }
    62% { transform: rotate(16deg); }
    70% { transform: rotate(-8deg); }
    78% { transform: rotate(14deg); }
    86% { transform: rotate(-4deg); }
}
@keyframes help-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.15); } }
@keyframes help-tassel { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(7deg); } }
@keyframes help-pop { from { opacity: 0; transform: translateX(-8px) scale(.6); } to { opacity: 1; transform: none; } }
@keyframes help-bubble-out { to { opacity: 0; transform: scale(.85); visibility: hidden; } }

@media (max-width: 560px) {
    .help-widget-spacer { height: 88px; }
    /* On phones the bubble sits above the robot, so it never covers the main lookup button. */
    .help-launcher {
        left: max(4px, env(safe-area-inset-left));
        bottom: max(4px, env(safe-area-inset-bottom));
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 6px;
    }
    .help-bot { width: 64px; }
    .help-bubble {
        margin: 0 0 0 4px;
        padding: 6px 11px;
        font-size: .78rem;
        /* On phones the bubble greets once, then leaves only the robot so it covers less of the page. */
        animation: help-pop .45s .8s cubic-bezier(.2, 1.4, .4, 1) both, help-bubble-out .35s 7s ease forwards;
    }
    .help-bubble::before {
        bottom: -7px;
        left: 20px;
        border-top: 8px solid var(--gold-bright);
        border-right: 7px solid transparent;
        border-bottom: 0;
        border-left: 7px solid transparent;
    }
    .help-panel {
        inset: auto 8px max(8px, env(safe-area-inset-bottom)) 8px;
        width: auto;
        max-height: calc(100dvh - 16px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .help-bot *,
    .help-avatar * { animation: none !important; }
    .help-bubble { animation: none; }
}

@media (prefers-reduced-motion: reduce) and (max-width: 560px) {
    /* No movement, but the bubble still steps aside on phones. */
    .help-bubble { animation: help-bubble-out 0s 7s forwards; }
}

/* Short phones (iPhone SE and smaller): keep the robot clear of the main lookup button. */
@media (max-width: 560px) and (max-height: 700px) {
    .help-widget-spacer { height: 76px; }
    .help-bot { width: 54px; }
}
