/* Premium, lightweight global loading UI for Lodge Management.
   Presentation only: all scheduling, request tracking and safe resets remain
   in the existing Scripts/global-loader.js (unchanged). */
.ldg-global-loader[hidden] { display: none !important; }

.ldg-global-loader {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(9, 19, 40, .58);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    isolation: isolate;
}

.ldg-global-loader__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: min(220px, 100%);
    padding: 16px 19px 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .85);
    border-radius: 19px;
    color: #17253e;
    background:
        radial-gradient(ellipse at 2% 0%, rgba(196, 229, 255, .56), transparent 51%),
        radial-gradient(ellipse at 105% 100%, rgba(184, 247, 234, .40), transparent 55%),
        #ffffff;
    box-shadow:
        0 30px 90px rgba(2, 12, 32, .36),
        0 4px 18px rgba(2, 12, 32, .10),
        inset 0 1px 0 rgba(255, 255, 255, .96);
    text-align: center;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    animation: ldg-global-loader-arrive .28s cubic-bezier(.2, .8, .2, 1) both;
}

.ldg-global-loader__panel::before {
    content: "";
    position: absolute;
    inset: 0 18% auto;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(42, 133, 225, .65), rgba(12, 164, 147, .65), transparent);
    pointer-events: none;
}

.ldg-global-loader__eyebrow {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border: 1px solid #e0ebfc;
    border-radius: 999px;
    color: #50688b;
    background: rgba(239, 246, 255, .92);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 1.35px;
    line-height: 1.25;
    white-space: nowrap;
}

.ldg-global-loader__online-dot {
    width: 5px;
    height: 5px;
    flex: 0 0 5px;
    border-radius: 50%;
    background: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, .13);
}

.ldg-global-loader__visual {
    position: relative;
    width: 94px;
    height: 94px;
    flex: 0 0 94px;
    margin: 9px 0 6px;
}

.ldg-global-loader__glow {
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(108, 180, 255, .22) 0%, rgba(87, 204, 203, .10) 42%, transparent 75%);
    animation: ldg-global-loader-breathe 2.9s ease-in-out infinite;
}

.ldg-global-loader__orbit {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.ldg-global-loader__orbit--outer {
    inset: 3px;
    border: 2px solid rgba(82, 145, 234, .13);
    border-top-color: #2563eb;
    border-right-color: #16b8ac;
    border-bottom-color: rgba(37, 99, 235, .04);
    box-shadow: 0 0 0 5px rgba(37, 99, 235, .025);
    animation: ldg-global-loader-turn 1.35s linear infinite;
}

.ldg-global-loader__orbit--inner {
    inset: 12px;
    border: 2px dashed rgba(59, 130, 246, .27);
    border-top-color: rgba(13, 148, 136, .95);
    border-left-color: rgba(37, 99, 235, .65);
    animation: ldg-global-loader-turn-reverse 7s linear infinite;
}

.ldg-global-loader__pulse {
    position: absolute;
    inset: 20px;
    border-radius: 50%;
    border: 1px solid rgba(59, 130, 246, .22);
    background: rgba(255, 255, 255, .45);
}

.ldg-global-loader__center {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .95);
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, var(--ldg-primary, #2563eb), #2563eb 54%, #0e938f 130%);
    box-shadow: 0 8px 17px rgba(37, 99, 235, .28), inset 0 1px 1px rgba(255, 255, 255, .3);
    transform: translate(-50%, -50%);
}

.ldg-global-loader__symbol { display: block; width: 25px; height: 25px; }

.ldg-global-loader__message { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 4px; }
.ldg-global-loader__label {
    display: block;
    color: #142b4c;
    font-size: 17px;
    font-weight: 750;
    letter-spacing: -.6px;
    line-height: 1.18;
}
.ldg-global-loader__subtext {
    display: block;
    color: #74849a;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .04px;
    line-height: 1.5;
}

.ldg-global-loader__progress {
    position: relative;
    width: 100%;
    height: 3.5px;
    overflow: hidden;
    margin-top: 15px;
    border-radius: 999px;
    background: #e7eef8;
    box-shadow: inset 0 1px 2px rgba(2, 12, 32, .06);
}
.ldg-global-loader__progress-beam {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 46%;
    border-radius: inherit;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 46%, #12b5a5 100%);
    box-shadow: 0 0 10px rgba(59, 130, 246, .38);
    animation: ldg-global-loader-sweep 1.65s ease-in-out infinite;
}

/* Dark theme is an aesthetic variant only; script and loader state are shared. */
html[data-theme="dark"] .ldg-global-loader__panel {
    border-color: rgba(119, 148, 183, .24);
    color: #f3f7ff;
    background:
        radial-gradient(ellipse at 0% 0%, rgba(43, 91, 157, .29), transparent 55%),
        radial-gradient(ellipse at 110% 110%, rgba(12, 128, 121, .21), transparent 55%),
        #111d30;
    box-shadow: 0 30px 90px rgba(0, 4, 13, .58), inset 0 1px 0 rgba(255, 255, 255, .04);
}
html[data-theme="dark"] .ldg-global-loader__eyebrow { color: #b5cae7; background: rgba(41, 68, 105, .47); border-color: rgba(109, 157, 208, .25); }
html[data-theme="dark"] .ldg-global-loader__label { color: #f5f9ff; }
html[data-theme="dark"] .ldg-global-loader__subtext { color: #a3b7d0; }
html[data-theme="dark"] .ldg-global-loader__pulse { background: rgba(27, 44, 71, .5); border-color: rgba(111, 170, 239, .15); }
html[data-theme="dark"] .ldg-global-loader__progress { background: rgba(126, 164, 207, .17); }

@keyframes ldg-global-loader-turn { to { transform: rotate(360deg); } }
@keyframes ldg-global-loader-turn-reverse { to { transform: rotate(-360deg); } }
@keyframes ldg-global-loader-breathe {
    0%, 100% { opacity: .55; transform: scale(.92); }
    50% { opacity: 1; transform: scale(1.08); }
}
@keyframes ldg-global-loader-sweep {
    0% { transform: translateX(-110%); }
    50% { transform: translateX(120%); }
    100% { transform: translateX(225%); }
}
@keyframes ldg-global-loader-arrive {
    from { opacity: .6; transform: translateY(7px) scale(.974); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 420px) {
    .ldg-global-loader__panel { width: min(212px, 100%); padding: 15px 17px 16px; border-radius: 18px; }
    .ldg-global-loader__visual { margin-top: 8px; margin-bottom: 5px; }
    .ldg-global-loader__label { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
    .ldg-global-loader__panel,
    .ldg-global-loader__glow,
    .ldg-global-loader__orbit,
    .ldg-global-loader__progress-beam { animation: none !important; }
    .ldg-global-loader__progress-beam { width: 50%; transform: translateX(50%); }
}
