/* Global loading overlay */
.sei-loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(2px);
    transition: opacity 0.2s ease;
}

.sei-loader-overlay.hide {
    display: none;
}

.oscuro .sei-loader-overlay {
    background: rgba(30, 30, 47, 0.82);
}

.sei-loader-content {
    text-align: center;
    padding: 24px 32px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.oscuro .sei-loader-content {
    background: #27293d;
}

.sei-loader-message {
    margin: 16px 0 0;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Inline loader (modals, sections) */
.sei-inline-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    min-height: 80px;
}

.sei-inline-loader.hide {
    display: none;
}

/* Button loading state */
.btn.sei-btn-loading,
button.sei-btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.85;
}

.btn.sei-btn-loading .sei-btn-label {
    visibility: hidden;
}

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

.btn-flat.sei-btn-loading::after,
.btn.white.sei-btn-loading::after {
    border-color: rgba(0, 0, 0, 0.15);
    border-top-color: #1976d2;
}

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

/* Skeleton placeholders */
.sei-skeleton {
    background: linear-gradient(90deg, #eceff1 25%, #f5f5f5 50%, #eceff1 75%);
    background-size: 200% 100%;
    animation: sei-shimmer 1.4s ease-in-out infinite;
    border-radius: 4px;
}

.oscuro .sei-skeleton {
    background: linear-gradient(90deg, #37474f 25%, #455a64 50%, #37474f 75%);
    background-size: 200% 100%;
}

@keyframes sei-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.sei-skeleton-chart {
    width: 100%;
    height: 280px;
    border-radius: 6px;
}

.sei-skeleton-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.sei-skeleton-cell {
    flex: 1;
    height: 14px;
}

.sei-skeleton-cell.w30 { flex: 0 0 30%; }
.sei-skeleton-cell.w20 { flex: 0 0 20%; }

.sei-skeleton-table {
    padding: 8px 0;
}

/* Peritaje tab save indicator */
#peritaje-saving-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 9998;
    background: #e0e0e0;
    overflow: hidden;
    display: none;
}

#peritaje-saving-bar.active {
    display: block;
}

#peritaje-saving-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: #1976d2;
    animation: sei-progress 1s ease-in-out infinite;
}

@keyframes sei-progress {
    0% { left: -40%; }
    100% { left: 100%; }
}
