/* Skeleton Loading Styles */

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Skeleton Components */
.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
  margin-bottom: 0;
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: 1rem;
}

.skeleton-subtitle {
  height: 1.25rem;
  width: 40%;
  margin-bottom: 0.75rem;
}

.skeleton-card {
  height: 120px;
  border-radius: 0.5rem;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-badge {
  height: 1.5rem;
  width: 80px;
  border-radius: 0.25rem;
}

.skeleton-button {
  height: 2.5rem;
  width: 120px;
  border-radius: 0.375rem;
}

.skeleton-chart {
  height: 300px;
  border-radius: 0.5rem;
}

.skeleton-kpi {
  height: 100px;
  border-radius: 0.5rem;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Page Loader - Fullscreen loader que aparece por padrão */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.page-loader-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 2rem;
  animation: pulse 2s ease-in-out infinite;
}

.page-loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #F5544D;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(0.95);
  }
}

/* Dark mode support para page loader */
[data-bs-theme="dark"] .page-loader {
  background-color: #1a1a1a;
}

[data-bs-theme="dark"] .page-loader-spinner {
  border-color: #2c3e50;
  border-top-color: #F5544D;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #F5544D;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Loading dentro de elementos */
.content-loading {
  position: relative;
  min-height: 200px;
}

.content-loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.content-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #F5544D;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 11;
}

/* Skeleton para KPIs */
.skeleton-kpi-card {
  height: 100px;
  border-radius: 0.5rem;
  padding: 1rem;
}

.skeleton-kpi-card .skeleton-text {
  height: 0.75rem;
  width: 60%;
  margin-bottom: 0.5rem;
}

.skeleton-kpi-card .skeleton-title {
  height: 2rem;
  width: 40%;
}

/* Skeleton para gráficos */
.skeleton-chart-container {
  height: 300px;
  border-radius: 0.5rem;
  padding: 1.5rem;
}

/* Skeleton para tabelas */
.skeleton-table-row {
  height: 50px;
  margin-bottom: 0.5rem;
}

/* Dark mode support */
[data-bs-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #2c3e50 25%, #34495e 50%, #2c3e50 75%);
  background-size: 200% 100%;
}

[data-bs-theme="dark"] .loading-overlay {
  background-color: rgba(44, 62, 80, 0.9);
}

[data-bs-theme="dark"] .content-loading::before {
  background-color: rgba(44, 62, 80, 0.8);
}
