/* ============================================================================
   Animations
   ============================================================================ */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-pop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

/* ============================================================================
   Loading State
   ============================================================================ */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 20px;
  color: var(--text);
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

.spinner.large {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

/* Global loading overlay */
.global-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.loading-content,
.global-loading {
  background: var(--color-bg-primary);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.loading-content p,
.global-loading p {
  margin: 0;
  color: var(--color-text-primary);
  font-family: var(--font-body);
}

/* ============================================================================
   Toggle Checkboxes
   ============================================================================ */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  --toggle-w: 56px;
  --toggle-h: 30px;
  --toggle-pad: 3px;
  position: relative;
  width: var(--toggle-w);
  height: var(--toggle-h);
  border-radius: 999px;
  border: 1px solid #cfd6df;
  background: #d9dde3;
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: var(--toggle-pad);
  left: var(--toggle-pad);
  width: calc(var(--toggle-h) - (2 * var(--toggle-pad)));
  height: calc(var(--toggle-h) - (2 * var(--toggle-pad)));
  border-radius: 50%;
  background: #f1f3f6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

input[type="checkbox"]:checked {
  background: #3b97d9;
  border-color: #3b97d9;
}

input[type="checkbox"]:checked::before {
  transform: translateX(calc(var(--toggle-w) - var(--toggle-h)));
  background: #e8ecef;
}

input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 151, 217, 0.35);
}

input[type="checkbox"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */
@media (max-width: 980px) {
  .dash-header-inner {
    flex-wrap: nowrap;
    gap: 10px;
  }

  .dash-header-left {
    width: auto;
    flex: 0 0 auto;
  }

  .dash-header-right {
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .dash-header-brand {
    width: clamp(84px, 9vw, 120px);
  }

  .dash-user-label {
    max-width: 120px;
  }

  .dash-user {
    gap: 8px;
  }

  .dash-logout {
    padding: 8px 12px;
    font-size: 11px;
  }

  .hub-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    width: 100%;
    gap: 16px;
  }

  .card-hero {
    height: 120px;
  }

  .card-icon .tile-logo {
    width: 60px;
    height: 60px;
  }
}

@media (max-width: 720px) {
  .dash-header-inner {
    flex-wrap: wrap;
  }

  .dash-header-left {
    width: 100%;
  }

  .dash-header-right {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
  }
}

/* ============================================================================
   Accessibility
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  .hub-card {
    animation: none;
  }
  .hub-card,
  .hub-card::before,
  .tile-video {
    transition: none;
  }
}
/* Interaction blocker (invisible but effective) */
.interaction-blocker {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20000; /* Higher than explicit z-indices */
  cursor: default;
}
