/* ============================================================
   ICResolve - shared loaders (icloader.js builds the markup; icLoaderSectionHtml() in icSplash.php
   renders the server-side variant). One mark, three sizes:
     section  .icld-section   56px looping mark + label (tables, modals, panels)
     overlay  .icld-overlay   72px mark on a card over the dimmed page (payment, checkout, cancel)
     inline   .icld-inline    cloud stroke only, currentColor, text size (buttons)
   The loop is the splash's draw + drop (approved mockup web-splash-loaders.html, 1.6 s).
   Nothing becomes visible before 400 ms, so quick loads never flicker.
   ============================================================ */

.icld-mark { display: inline-block; line-height: 0; color: var(--ic-text, #F5F5F7); } /* "ic" letters = currentColor */
.icld-mark svg { display: block; overflow: visible; }

/* looping mark */
.icld-loop .icld-cloud { stroke-dasharray: 100 100; animation: icld-loopdraw 1.6s cubic-bezier(.45, 0, .35, 1) infinite; }
.icld-loop .icld-dot { animation: icld-loopdot 1.6s linear infinite; }
@keyframes icld-loopdraw { 0% { stroke-dashoffset: 100; } 45% { stroke-dashoffset: 0; } 72% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -100; } }
@keyframes icld-loopdot {
    0%, 38% { opacity: 0; transform: translateY(-34px); }
    39% { opacity: 1; transform: translateY(-34px); }
    50% { transform: translateY(3px); }
    56% { transform: translateY(-3px); }
    62%, 80% { opacity: 1; transform: none; }
    92%, 100% { opacity: 0; transform: none; }
}

/* appear after 400 ms (CSS only, so server-rendered loaders get it too) */
.icld-delay { animation: icld-in 160ms ease-out 400ms both; }
@keyframes icld-in { from { opacity: 0; visibility: hidden; } to { opacity: 1; visibility: visible; } }

/* (a) section loader */
.icld-section { display: grid; justify-items: center; align-content: center; gap: 10px; padding: 36px 16px; color: var(--ic-muted); text-align: center; }
.icld-section .icld-text { font-size: 13px; line-height: 1.4; }
.icld-section.icld-compact { padding: 16px; }

/* (b) blocking overlay: catches clicks at once, dims after 400 ms */
.icld-overlay { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; cursor: progress; padding: 16px; }
.icld-overlay-dim { position: absolute; inset: 0; background: var(--ic-overlay, rgba(0, 0, 0, .6)); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.icld-card { position: relative; background: var(--ic-card); color: var(--ic-text); border: 1px solid var(--ic-line); border-radius: 12px; padding: 22px 28px; display: grid; justify-items: center; gap: 10px; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); text-align: center; max-width: min(360px, 100%); }
.icld-card b { font-size: 15px; font-weight: 600; }
.icld-card .icld-sub { color: var(--ic-muted); font-size: 13px; }

/* page / fragment loads (icLoader.busy): clicks wait, a section loader shows in the content area after 400 ms */
.icld-busy-shield { position: fixed; inset: 0; z-index: 9990; cursor: progress; }
.icld-busy-area { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; }
.icld-busy-area .icld-card { padding: 18px 26px; gap: 8px; }
.icld-busy-area .icld-section { padding: 0; }

/* (c) inline: cloud outline tracing itself, sized to the text */
.icld-inline { display: inline-block; width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex: 0 0 auto; line-height: 0; }
.icld-inline svg { display: block; width: 100%; height: 100%; overflow: visible; }
.icld-inline .icld-cloud { stroke-dasharray: 100 100; animation: icld-loopdraw 1.2s cubic-bezier(.45, 0, .35, 1) infinite; }

/* busy buttons keep their width and label (icLoader.button) */
.icld-btnbusy { cursor: progress !important; pointer-events: none; white-space: nowrap; overflow: hidden; justify-content: center; }
.icld-btnbusy.icld-btnshow { display: inline-flex; align-items: center; gap: 8px; }
.icld-btnbusy .icld-btnlabel { display: inline-flex; align-items: center; gap: inherit; min-width: 0; }
.icld-btnbusy.icld-btnshow .icld-btnlabel { opacity: .65; }
.icld-btnbusy.icld-btnnarrow .icld-btnlabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* DataTables "processing" (icdatatable.js puts a section loader in it): covers the table rows */
.icdatatablewrap div.dt-layout-table > div.dt-layout-cell { position: relative; }
.icdatatablewrap div.dt-processing,
.icdatatablewrap .dataTables_processing {
    position: absolute; inset: 0; top: 0; left: 0; width: auto; height: auto; min-height: 120px; margin: 0 !important; padding: 0;
    background: color-mix(in srgb, var(--ic-card) 86%, transparent); border: 0 !important; border-radius: 8px; box-shadow: none !important; z-index: 5;
    animation: icld-in 160ms ease-out 400ms both;
}
.icdatatablewrap div.dt-processing > div:not(.icld-section) { display: none; }
.icdatatablewrap div.dt-processing > .icld-section { position: absolute; inset: 0; }

@media (prefers-reduced-motion: reduce) {
    .icld-loop .icld-cloud, .icld-inline .icld-cloud { animation: none; stroke-dashoffset: 0; }
    .icld-loop .icld-dot { animation: icld-pulse 1.4s ease-in-out infinite; opacity: 1; transform: none; }
    @keyframes icld-pulse { 50% { opacity: .35; } }
}
