/* ==========================================================================
   SKELETON SCREEN & SEARCH FLOW DESIGN SYSTEM
   Standardized UI Loading & Progressive Feedback Engine
   ========================================================================== */

/* 1. SHIMMER WAVE ANIMATION */
@keyframes skeletonShimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes skeletonPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.skeleton-base {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.8s infinite ease-in-out;
  border-radius: 8px;
  display: inline-block;
  vertical-align: middle;
}

/* 2. SKELETON GEOMETRIC PRIMITIVES */
.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: 8px;
  border-radius: 6px;
}
.skeleton-text.short { width: 45%; }
.skeleton-text.medium { width: 75%; }
.skeleton-text.long { width: 92%; }

.skeleton-title {
  height: 22px;
  width: 70%;
  margin-bottom: 12px;
  border-radius: 8px;
}

.skeleton-badge {
  height: 20px;
  width: 72px;
  border-radius: 999px;
  margin-right: 6px;
  display: inline-block;
}

.skeleton-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-btn {
  height: 38px;
  width: 100%;
  border-radius: 10px;
  margin-top: 10px;
}

/* 3. COMPOUND SKELETON COMPONENTS */
/* 3.1 Skeleton Card (Cho Kho Bài Tập, Homework, Video) */
.skeleton-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(13, 59, 102, 0.04);
  animation: skeletonPulse 2.4s infinite ease-in-out;
}

.skeleton-card-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.skeleton-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.skeleton-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #F1F5F9;
}

/* 3.2 Skeleton Profile Block */
.skeleton-profile-box {
  background: #FFFFFF;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.skeleton-profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #F8FAFC;
}

/* 3.3 Skeleton Schedule Grid */
.skeleton-schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 9px;
  width: 100%;
}
.skeleton-schedule-cell {
  min-height: 110px;
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  padding: 12px;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 4. SEARCH FLOW STATE MACHINE STYLES */
.search-flow-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 380px;
}

.search-flow-input {
  width: 100%;
  border: 1.5px solid #CBD5E1;
  border-radius: 999px;
  padding: 8px 40px 8px 18px;
  font-size: 13.5px;
  outline: none;
  background: #FFFFFF;
  transition: all 0.2s ease;
}

.search-flow-input:focus {
  border-color: #0B42A1;
  box-shadow: 0 0 0 3px rgba(11, 66, 161, 0.12);
}

.search-flow-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748B;
  font-size: 14px;
  pointer-events: none;
  transition: all 0.2s ease;
}

/* Indicator trạng thái gõ / đang tải */
.search-flow-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #CBD5E1;
  border-top-color: #FF6B00;
  border-radius: 50%;
  animation: searchSpin 0.65s linear infinite;
  display: none;
}

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

.search-flow-wrapper.is-typing .search-flow-spinner,
.search-flow-wrapper.is-loading .search-flow-spinner {
  display: block;
}
.search-flow-wrapper.is-typing .search-flow-static-icon,
.search-flow-wrapper.is-loading .search-flow-static-icon {
  display: none;
}

/* Khối Empty State chuyên nghiệp */
.search-empty-state {
  grid-column: 1 / -1;
  padding: 42px 24px;
  text-align: center;
  background: #F8FAFC;
  border: 1.5px dashed #CBD5E1;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  animation: fadeIn 0.25s ease;
}

.search-empty-icon {
  font-size: 38px;
  margin-bottom: 4px;
  opacity: 0.85;
}

.search-empty-title {
  font-size: 16px;
  font-weight: 800;
  color: #0D3B66;
}

.search-empty-desc {
  font-size: 13px;
  color: #64748B;
  max-width: 440px;
  line-height: 1.5;
}

.search-empty-action {
  margin-top: 8px;
  background: #EFF6FF;
  color: #0B42A1;
  border: 1px solid #BFDBFE;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}
.search-empty-action:hover {
  background: #DBEAFE;
  color: #052466;
}

/* 5. CONTROLLED LOAD MORE & PAGINATION CONTROLLER */
.load-more-container {
  grid-column: 1 / -1;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #F8FAFC;
  border-radius: 16px;
  border: 1px solid #E2E8F0;
}

.load-more-status {
  font-size: 12.5px;
  font-weight: 700;
  color: #64748B;
  display: flex;
  align-items: center;
  gap: 8px;
}

.load-more-progress-bar {
  width: 100%;
  max-width: 320px;
  height: 6px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
}

.load-more-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0B42A1, #FF6B00);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.btn-load-more {
  background: #0D3B66;
  color: #FFFFFF;
  border: none;
  border-radius: 999px;
  padding: 11px 28px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(13, 59, 102, 0.16);
  transition: all 0.22s ease;
}

.btn-load-more:hover {
  background: #FF6B00;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 107, 0, 0.28);
}

.btn-load-more:active {
  transform: translateY(0);
}

.load-more-completed {
  font-size: 13px;
  font-weight: 800;
  color: #10B981;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #ECFDF5;
  border-radius: 999px;
  border: 1px solid #A7F3D0;
}
