/**
 * CRM Panel — Global page loader (AI / Tech)
 */
html.is-panel-loading .panel-wrapper {
    visibility: hidden;
}

.panel-loader {
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    background:
        radial-gradient(ellipse 80% 55% at 20% 15%, rgba(99, 102, 241, 0.22) 0%, transparent 55%),
        radial-gradient(ellipse 70% 50% at 85% 80%, rgba(34, 211, 238, 0.14) 0%, transparent 50%),
        linear-gradient(165deg, #030712 0%, #0a0f1e 45%, #0f172a 100%);
    color: #f1f5f9;
    font-family: 'IranSans', Tahoma, Arial, sans-serif;
    direction: rtl;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.55s;
}

.panel-loader.is-hidden,
#panel-page-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.panel-loader__bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.panel-loader__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(56, 189, 248, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.06) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 85% 75% at 50% 42%, black 10%, transparent 72%);
    animation: pl-grid-drift 16s linear infinite;
}

.panel-loader__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(72px);
    animation: pl-orb-float 12s ease-in-out infinite;
}

.panel-loader__orb--1 {
    width: 280px;
    height: 280px;
    top: -12%;
    right: -6%;
    background: rgba(99, 102, 241, 0.32);
}

.panel-loader__orb--2 {
    width: 240px;
    height: 240px;
    bottom: -8%;
    left: -10%;
    background: rgba(34, 211, 238, 0.22);
    animation-delay: -4s;
}

.panel-loader__orb--3 {
    width: 160px;
    height: 160px;
    top: 55%;
    left: 42%;
    background: rgba(167, 139, 250, 0.16);
    animation-delay: -8s;
}

.panel-loader__scanline {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(34, 211, 238, 0.025) 2px,
        rgba(34, 211, 238, 0.025) 4px
    );
}

.panel-loader__stage {
    position: relative;
    width: 168px;
    height: 168px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-loader__ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
}

.panel-loader__ring--1 {
    inset: 0;
    border-top-color: rgba(34, 211, 238, 0.85);
    border-right-color: rgba(34, 211, 238, 0.15);
    animation: pl-spin 1.6s cubic-bezier(0.5, 0.1, 0.3, 1) infinite;
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.45));
}

.panel-loader__ring--2 {
    inset: 14px;
    border-bottom-color: rgba(129, 140, 248, 0.8);
    border-left-color: rgba(129, 140, 248, 0.12);
    animation: pl-spin-rev 2.2s cubic-bezier(0.5, 0.1, 0.3, 1) infinite;
    filter: drop-shadow(0 0 6px rgba(129, 140, 248, 0.35));
}

.panel-loader__ring--3 {
    inset: 28px;
    border-top-color: rgba(6, 182, 212, 0.55);
    border-right-color: rgba(139, 92, 246, 0.55);
    border-bottom-color: transparent;
    border-left-color: transparent;
    animation: pl-spin 3s linear infinite;
    opacity: 0.7;
}

.panel-loader__hex {
    position: absolute;
    inset: 36px;
    clip-path: polygon(50% 0%, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.12), rgba(129, 140, 248, 0.08));
    border: 1px solid rgba(34, 211, 238, 0.2);
    animation: pl-hex-pulse 2.4s ease-in-out infinite;
}

.panel-loader__logo-wrap {
    position: relative;
    z-index: 2;
    width: 96px;
    height: 96px;
    border-radius: 22px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 12px 40px rgba(0, 0, 0, 0.35),
        0 0 48px rgba(34, 211, 238, 0.18);
    overflow: hidden;
}

.panel-loader__logo-wrap::after {
    display: none;
}

.panel-loader__logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.panel-loader__scan {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 120px;
    height: 3px;
    margin-left: -60px;
    background: linear-gradient(90deg, transparent, #22d3ee, #818cf8, transparent);
    box-shadow: 0 0 16px rgba(34, 211, 238, 0.8);
    animation: pl-scan-sweep 2.2s ease-in-out infinite;
    opacity: 0.85;
    z-index: 3;
    pointer-events: none;
}

.panel-loader__dots {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-loader__dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22d3ee, #818cf8);
}

.panel-loader__text {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: linear-gradient(90deg, #e2e8f0 0%, #22d3ee 45%, #a78bfa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.panel-loader__badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 13px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.22);
}

.panel-loader__badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22d3ee;
    box-shadow: 0 0 10px #22d3ee;
    animation: pl-dot-blink 1.6s ease-in-out infinite;
}

.panel-loader__bar {
    width: min(220px, 72vw);
    height: 3px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.15);
    overflow: hidden;
    position: relative;
}

.panel-loader__bar span {
    position: absolute;
    inset: 0;
    width: 100%;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: none;
    animation: none;
}

@keyframes pl-grid-drift {
    0% { transform: translateY(0); }
    100% { transform: translateY(44px); }
}

@keyframes pl-orb-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-14px, 12px) scale(1.05); }
}

@keyframes pl-spin {
    to { transform: rotate(360deg); }
}

@keyframes pl-spin-rev {
    to { transform: rotate(-360deg); }
}

@keyframes pl-hex-pulse {
    0%, 100% { opacity: 0.55; transform: scale(0.96); }
    50% { opacity: 1; transform: scale(1); }
}

@keyframes pl-logo-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-6px) scale(1.02); }
}

@keyframes pl-logo-shine {
    0%, 100% { transform: translateX(-120%); }
    50% { transform: translateX(120%); }
}

@keyframes pl-scan-sweep {
    0%, 100% { transform: translateY(-52px); opacity: 0; }
    15% { opacity: 0.9; }
    50% { transform: translateY(52px); opacity: 0.9; }
    85% { opacity: 0; }
}

@keyframes pl-dot-wave {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

@keyframes pl-dot-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

@keyframes pl-bar-slide {
    0% { left: -45%; }
    100% { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .panel-loader *,
    .panel-loader *::before,
    .panel-loader *::after {
        animation: none !important;
    }
}
