/* ==========================================================================
   Reusable Components - Peak Learning AQ Profile®
   ========================================================================== */

/* Loading States */
.skeleton-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.skeleton-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  width: 100%;
  max-width: 400px;
}

.skeleton-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-text {
  height: 20px;
  border-radius: 10px;
  background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-title {
  width: 200px;
  height: 24px;
}

.skeleton-content {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.skeleton-line {
  height: 16px;
  border-radius: 8px;
  background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-line:nth-child(2) {
  width: 85%;
}

.skeleton-short {
  width: 60%;
}

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

/* Assessment-specific skeleton loaders */
.skeleton-assessment {
  background: #f8fafc;
  border-radius: 16px;
  padding: 30px;
  margin: 20px 0;
}

.skeleton-question {
  height: 24px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 12px;
  margin-bottom: 20px;
  width: 90%;
}

.skeleton-slider {
  height: 8px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin: 30px 0;
}

.skeleton-options {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.skeleton-option {
  height: 16px;
  width: 80px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* Layout shift prevention utilities */
.layout-stable {
  contain: layout style paint;
  transform: translateZ(0);
}

.reserve-space {
  contain-intrinsic-size: 0 500px; /* Reserve approximate space */
}

.loading-placeholder {
  background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
  contain: layout style paint;
}

/* Prevent layout shift during dynamic content loading */
.dynamic-content {
  min-height: 100px; /* Reserve minimum space */
  contain: layout style;
}

/* Buttons */
.btn {
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  position: relative;
  overflow: hidden;
  contain: layout style paint;
}

.btn-primary {
  background: linear-gradient(135deg, #1e90ff, #4169e1);
  color: white;
  box-shadow: 0 4px 12px rgba(30, 144, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30, 144, 255, 0.4);
}

.btn-secondary {
  background: rgba(58, 61, 74, 0.8);
  color: white;
  border: 1px solid rgba(30, 144, 255, 0.3);
}

.btn-secondary:hover {
  background: rgba(58, 61, 74, 0.9);
  border-color: rgba(30, 144, 255, 0.5);
}

/* Cards */
.card {
  background: linear-gradient(135deg, rgb(26 26 46 / 93%), rgb(22 33 62));
  border-radius: 16px;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(30, 144, 255, 0.2);
  padding: 24px;
  margin-bottom: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  contain: layout style paint;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  border-color: rgba(30, 144, 255, 0.4);
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(30, 144, 255, 0.3);
  border-radius: 8px;
  background: rgba(58, 61, 74, 0.8);
  color: white;
  font-size: 14px;
  transition: all 0.3s ease;
  contain: layout style paint;
}

.form-input:focus {
  outline: none;
  border-color: #1e90ff;
  box-shadow: 0 0 12px rgba(30, 144, 255, 0.3);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  contain: layout style paint;
}

.modal {
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.95), rgba(22, 33, 62, 0.95));
  border-radius: 20px;
  padding: 32px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(30, 144, 255, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  contain: layout style paint;
}