/* AJAX form feedback: button loading spinner + toast notifications. */

.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.1em;
    height: 1.1em;
    margin: -0.55em 0 0 -0.55em;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ajaxspin .6s linear infinite;
}

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

.ajax-toast-wrap {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
}

.ajax-toast {
    background: #fff;
    border-left: 4px solid var(--a-primary, #F26B37);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
    font-size: 14px;
    line-height: 1.45;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: ajaxslide .25s ease;
}

.ajax-toast.success { border-left-color: #22c55e; }
.ajax-toast.warning { border-left-color: #f59e0b; }
.ajax-toast.error   { border-left-color: #ef4444; }
.ajax-toast.info    { border-left-color: #3b82f6; }

.ajax-toast .ic { font-size: 18px; line-height: 1.2; margin-top: 1px; }
.ajax-toast.success .ic { color: #22c55e; }
.ajax-toast.warning .ic { color: #f59e0b; }
.ajax-toast.error   .ic { color: #ef4444; }
.ajax-toast.info    .ic { color: #3b82f6; }

@keyframes ajaxslide {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: none; }
}

/* Inline AJAX field errors */
.is-invalid,
.form-control.is-invalid,
.admin-input.is-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 0.15rem rgba(239, 68, 68, .15);
}
.ajax-field-error {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
    line-height: 1.3;
}

/* ===== Header AJAX search ===== */
.header-search { position: relative; }
.header-search-toggle { padding: 0 10px; }
#headerSearch .header-search-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    max-width: none;
    color: #fff;
    background:
        radial-gradient(1100px 540px at 50% -12%, rgba(27, 63, 160, .30), transparent 60%),
        linear-gradient(160deg, #0b1020 0%, #141a2e 100%);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-radius: 0;
    box-shadow: none;
    padding: 110px 24px 48px;
    display: flex;
    flex-direction: column;
    transform: translateY(-14px);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, transform .25s ease, visibility .25s;
    z-index: 1200;
}
#headerSearch.header-search.open .header-search-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#headerSearch .header-search-head {
    width: 100%;
    max-width: 760px;
    margin: 0 auto 18px;
    display: flex; align-items: center; justify-content: space-between;
}
#headerSearch .header-search-title {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 700; color: #fff; letter-spacing: .3px;
}
#headerSearch .header-search-title i { color: #F26B37; font-size: 18px; }
#headerSearch .header-search-close {
    position: fixed;
    top: 28px;
    right: 36px;
    width: 48px; height: 48px; border-radius: 50%; border: 0;
    background: rgba(255, 255, 255, .10); color: #fff; cursor: pointer;
    font-size: 20px; display: grid; place-items: center; z-index: 1300;
    transition: background .2s ease, color .2s ease;
}
#headerSearch .header-search-close:hover { background: #F26B37; color: #fff; }
#headerSearch .header-search-panel form {
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
    display: flex; align-items: center; gap: 10px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    padding: 8px 22px;
    color: rgba(255, 255, 255, .6);
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
#headerSearch .header-search-panel form:focus-within {
    border-color: #F26B37; background: rgba(255, 255, 255, .10);
    box-shadow: 0 0 0 4px rgba(242, 107, 55, .15);
}
#headerSearch .header-search-panel input {
    border: 0;
    outline: 0;
    flex: 1;
    padding: 14px 0;
    font-size: 18px;
    color: #fff;
    background: transparent;
}
#headerSearch .header-search-panel input::placeholder { color: rgba(255, 255, 255, .45); }
#headerSearch .header-search-results {
    width: 100%; max-width: 880px; margin: 18px auto 0; max-height: 56vh; overflow-y: auto;
    display: grid; grid-template-columns: 1fr; gap: 10px;
}
@media (min-width: 768px) {
    #headerSearch .header-search-results { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
#headerSearch .header-search-results a {
    display: flex; gap: 12px; align-items: center;
    padding: 12px 14px; border-radius: 12px; text-decoration: none; color: #e7ecf8;
    background: rgba(255, 255, 255, .04);
    transition: background .15s ease;
}
#headerSearch .header-search-results a:hover { background: rgba(242, 107, 55, .14); }
#headerSearch .header-search-thumb {
    width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: 0 0 44px;
    background: rgba(255, 255, 255, .08);
}
#headerSearch .header-search-thumb.placeholder {
    display: flex; align-items: center; justify-content: center; color: #F26B37; font-size: 18px;
}
#headerSearch .header-search-text { min-width: 0; }
#headerSearch .header-search-text strong { display: block; font-size: 14px; line-height: 1.3; color: #fff; }
#headerSearch .header-search-text span { display: block; font-size: 12px; color: #9aa6c4; }
#headerSearch .header-search-empty { padding: 20px 8px; text-align: center; color: #9aa6c4; font-size: 13px; }
#headerSearch .header-search-loading { padding: 18px 8px; text-align: center; color: #9aa6c4; font-size: 13px; }
#headerSearch .header-search-all {
    grid-column: 1 / -1;
    display: block; text-align: center; padding: 12px; margin: 2px auto 0; max-width: 760px;
    font-size: 13px; color: #F26B37; font-weight: 600; text-decoration: none;
    border-radius: 12px; transition: background .15s ease;
}
#headerSearch .header-search-all:hover { background: rgba(242, 107, 55, .14); }

@media (max-width: 575px) {
    #headerSearch .header-search-panel { padding-top: 90px; }
    #headerSearch .header-search-close { top: 18px; right: 18px; width: 42px; height: 42px; }
}
