/*
 * loading.css — Skeleton screens, spinners, loading states
 * widget4 modernization
 */

/* ============================================================
   Skeleton shimmer base
   ============================================================ */

@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f4 25%,
        #e4e4ec 50%,
        #f0f0f4 75%
    );
    background-size: 800px 100%;
    animation: shimmer 1.6s infinite linear;
    border-radius: var(--radius-md);
    pointer-events: none;
}

/* Skeleton variants */
.skeleton-line   { height: 16px; margin-bottom: 8px; }
.skeleton-line.sm  { height: 12px; width: 60%; }
.skeleton-line.lg  { height: 20px; }
.skeleton-card   { height: 72px; border-radius: var(--radius-md); }
.skeleton-btn    { height: 56px; border-radius: var(--radius-md); }
.skeleton-avatar { width: 72px; height: 72px; border-radius: var(--radius-md); flex-shrink: 0; }

/* Multi-line skeleton block */
.skeleton-block { display: flex; flex-wrap: wrap; gap: 8px; min-height: 80px; }
.skeleton-block .skeleton-card { width: calc(20% - 8px); }

/* Inside the date strip the parent rule sets width:20% on every >div child,
   which squashes the skeleton-block. Override it to fill the full row. */
.param.date .label > .skeleton-block,
.param.calendar .label > .skeleton-block {
    width: 100%;
    min-height: 160px;
}

/* ============================================================
   Inline loading state on sections
   ============================================================ */

.loading-state {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
    min-height: 80px;
}

/* Spinner inside a section (small) */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 56px;
    color: var(--color-text-muted);
    font-size: 13px;
}

.loading-spinner::before {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--bg-lgray);
    border-top-color: var(--btn-bg);
    border-radius: 50%;
    animation: spin_form 0.8s linear infinite;
    flex-shrink: 0;
}

/* ============================================================
   Button loading state
   ============================================================ */

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

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin_form 0.7s linear infinite;
}

/* ============================================================
   Disabled state
   ============================================================ */

.btn:disabled,
.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}
