/* ============================================
   INTERACTIVE PHASE 2 — Search, Progress, Recent
   SFX Smart Academy Library
   ============================================ */

/* ---------- SEARCH OVERLAY ---------- */
#gc-search-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
#gc-search-overlay.open {
  opacity: 1;
  visibility: visible;
}

.gc-search-modal {
  background: #ffffff;
  border-radius: 16px;
  width: 640px;
  max-width: 90vw;
  max-height: 72vh;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(-12px) scale(0.97);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
}
#gc-search-overlay.open .gc-search-modal {
  transform: translateY(0) scale(1);
}

/* Search header */
.gc-search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
}
.gc-search-header svg {
  flex-shrink: 0;
  color: #5f6368;
}
#gc-search-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-size: 16px !important;
  font-family: 'Google Sans', sans-serif !important;
  background: transparent !important;
  padding: 0 !important;
  color: #202124 !important;
  min-width: 0;
}
#gc-search-input::placeholder {
  color: #80868b;
}
.gc-search-kbd {
  background: #f1f3f4;
  border: 1px solid #dadce0;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: #5f6368;
  flex-shrink: 0;
}

/* Search results area */
.gc-search-results {
  flex: 1;
  overflow-y: auto;
  min-height: 180px;
  max-height: 52vh;
}

/* Empty / placeholder state */
.gc-search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: #80868b;
  text-align: center;
}
.gc-search-empty svg {
  opacity: 0.4;
}
.gc-search-empty p {
  margin: 16px 0 0;
  font-size: 15px;
  color: #5f6368;
  font-family: 'Google Sans', sans-serif;
}
.gc-search-empty span {
  font-size: 13px;
  margin-top: 4px;
  color: #9aa0a6;
}

/* Loading state */
.gc-search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: #5f6368;
  font-size: 14px;
  font-family: 'Google Sans', sans-serif;
}
.gc-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid #e0e0e0;
  border-top-color: #1a73e8;
  border-radius: 50%;
  animation: gc-spin 0.6s linear infinite;
}
@keyframes gc-spin {
  to { transform: rotate(360deg); }
}

/* Result count */
.gc-search-count {
  padding: 10px 20px 6px;
  font-size: 12px;
  color: #80868b;
  font-weight: 500;
  font-family: 'Google Sans Text', sans-serif;
}

/* Result groups */
.gc-search-group {
  padding-bottom: 4px;
}
.gc-search-group-title {
  padding: 10px 20px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #80868b;
  font-family: 'Google Sans', sans-serif;
}

/* Individual result items */
.gc-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.12s ease;
  text-decoration: none;
}
.gc-search-item:hover,
.gc-search-item.selected {
  background: #f0f6ff;
}
.gc-search-item-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #e8f0fe;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a73e8;
}
.gc-search-item-content {
  flex: 1;
  min-width: 0;
}
.gc-search-item-title {
  font-size: 14px;
  color: #202124;
  font-weight: 500;
  font-family: 'Google Sans', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gc-search-item-title mark {
  background: #fef3b8;
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}
.gc-search-item-subtitle {
  font-size: 12px;
  color: #80868b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Google Sans Text', sans-serif;
}
.gc-search-item-arrow {
  flex-shrink: 0;
  color: #dadce0;
  transition: color 0.12s;
}
.gc-search-item:hover .gc-search-item-arrow,
.gc-search-item.selected .gc-search-item-arrow {
  color: #1a73e8;
}

/* Footer with keyboard hints */
.gc-search-footer {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 20px;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
  font-size: 12px;
  color: #80868b;
  font-family: 'Google Sans Text', sans-serif;
}
.gc-search-footer kbd {
  background: #f1f3f4;
  border: 1px solid #dadce0;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: 'SF Mono', 'Consolas', monospace;
  margin: 0 2px;
}

/* ---------- CTRL+K HINT PILL ---------- */
.gc-search-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: 'SF Mono', 'Consolas', monospace;
  margin-left: 8px;
  flex-shrink: 0;
}
.gc-search-hint:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.9);
}

/* ---------- RECENTLY VIEWED PANEL ---------- */
#gc-recent {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(60,64,67,.08);
  animation: gc-fadeSlideUp 0.3s ease-out forwards;
}
.gc-recent-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5f6368;
  font-family: 'Google Sans', sans-serif;
  border-bottom: 1px solid #f0f0f0;
}
.gc-recent-header svg {
  color: #1a73e8;
}
.gc-recent-items {
  padding: 4px 0;
}
.gc-recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  text-decoration: none !important;
  transition: background 0.12s;
  cursor: pointer;
}
.gc-recent-item:hover {
  background: #f0f6ff;
}
.gc-recent-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1a73e8;
  flex-shrink: 0;
}
.gc-recent-name {
  font-size: 13px;
  color: #202124;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Google Sans Text', sans-serif;
}
.gc-recent-course {
  font-size: 11px;
  color: #9aa0a6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: auto;
  flex-shrink: 0;
  max-width: 120px;
}

/* ---------- PROGRESS BANNER ADDITION ---------- */
.gc-banner-progress-wrap {
  margin-top: 14px;
  position: relative;
  z-index: 1;
}
.gc-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  overflow: hidden;
}
.gc-progress-bar-fill {
  height: 100%;
  background: rgba(255,255,255,0.9);
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
  position: relative;
}
.gc-progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: gc-shimmer 2.5s ease-in-out infinite;
}
.gc-progress-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.85;
  font-family: 'Google Sans', sans-serif;
}

/* ---------- TOPIC COMPLETION INDICATOR ---------- */
.gc-topic-viewed {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e6f4ea;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
}
.gc-topic-viewed svg {
  width: 12px;
  height: 12px;
  color: #0d904f;
}

/* ---------- TOAST NOTIFICATIONS ---------- */
.gc-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10001;
  background: #323232;
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-family: 'Google Sans', sans-serif;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(.4,0,.2,1);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 400px;
}
.gc-toast.show {
  transform: translateY(0);
  opacity: 1;
}
.gc-toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* ---------- MOBILE OVERRIDES ---------- */
@media (max-width: 768px) {
  .gc-search-modal {
    width: 95vw;
    max-height: 80vh;
    border-radius: 12px;
  }
  #gc-search-overlay {
    padding-top: 5vh;
  }
  .gc-search-footer {
    display: none;
  }
  .gc-search-hint {
    display: none;
  }
}

/* ---------- DARK MODE ---------- */
@media (prefers-color-scheme: dark) {
  .gc-search-modal {
    background: #1e1e2e;
  }
  .gc-search-header {
    border-color: #2d3748;
  }
  #gc-search-input {
    color: #e8eaed !important;
  }
  .gc-search-item:hover,
  .gc-search-item.selected {
    background: rgba(26,115,232,0.15);
  }
  .gc-search-item-title {
    color: #e8eaed;
  }
  .gc-search-item-icon {
    background: rgba(26,115,232,0.15);
  }
  .gc-search-footer {
    background: #16213e;
    border-color: #2d3748;
  }
  .gc-search-footer kbd {
    background: #2d3748;
    border-color: #4a5568;
    color: #9aa0a6;
  }

  #gc-recent {
    background: #16213e;
    border-color: #2d3748;
  }
  .gc-recent-header {
    border-color: #2d3748;
    color: #9aa0a6;
  }
  .gc-recent-name {
    color: #e8eaed;
  }
  .gc-recent-item:hover {
    background: rgba(26,115,232,0.15);
  }
  .gc-toast {
    background: #2d3748;
  }
}
