/* ===== FONT FACE ===== */
@font-face {
  font-family: 'Great Vibes';
  src: url('assets/great-vibes-names-only.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ===== CSS RESET & BASE ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --google-blue: #4285F4;
  --google-red: #EA4335;
  --google-yellow: #FBBC05;
  --google-green: #34A853;
  --bg-glass: rgba(255, 255, 255, 0.72);
  --bg-glass-hover: rgba(255, 255, 255, 0.85);
  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-medium: 0 8px 40px rgba(0, 0, 0, 0.12);
  --shadow-strong: 0 12px 48px rgba(0, 0, 0, 0.18);
  --radius-pill: 50px;
  --radius-card: 20px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-medium: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: Georgia, serif;
}

/* ===== LOADER SPLASH SCREEN ===== */
#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

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

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(66, 133, 244, 0.2);
  border-left-color: var(--google-blue);
  border-radius: 50%;
  display: inline-block;
  animation: rotation 1s linear infinite;
}

@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.loader-text {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  color: #9AA0A6;
  text-align: center;
  margin-top: -8px;
  line-height: 1.5;
  padding: 0 24px;
}

html,
body {
  min-height: 100dvh;
  width: 100%;
  overflow-x: hidden;
  font-family: var(--font-primary);
  color: #202124;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== VANTA BACKGROUND ===== */
#vanta-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background-color: #adc1de;
  /* Seamless fallback when Chrome destroys WebGL */
}

/* ===== MAIN APP ===== */
#app {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  contain: layout paint;
}

/* ===== VIEWS ===== */
.view {
  display: none;
  width: 100%;
  min-height: 100dvh;
  padding: 40px 16px;
  /* Allow safe-area scrolling when content exceeds viewport */
  align-items: center;
  justify-content: center;
  animation: fadeInUp 0.6s var(--transition-medium) both;
}

.view.active {
  display: flex;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-4px);
  }

  20%,
  40%,
  60%,
  80% {
    transform: translateX(4px);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: scaleY(0);
  }

  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

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

  100% {
    background-position: 200% center;
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-8px);
  }
}

/* ===== SEARCH VIEW ===== */
.search-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 32px;
  max-width: 620px;
  width: 100%;
}

/* Logo Section */
.logo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: subtleFloat 5s ease-in-out infinite;
}


.title {
  font-size: 2.6rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.title-gdg {
  background: linear-gradient(135deg, var(--google-blue), var(--google-red), var(--google-yellow), var(--google-green));
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 20s linear infinite alternate-reverse;
  /* filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2)); */
}

.thank-you-img {
  height: 36px;
  width: auto;
  margin-top: 6px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
  opacity: 1;
}

/* Search Bar */
.search-bar-wrapper {
  width: 100%;
  position: relative;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-glass);
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 30px;
  padding: 14px 24px;
  box-shadow: var(--shadow-soft);
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
  position: relative;
  z-index: 2;
}

.search-bar:focus-within {
  background: var(--bg-glass-hover);
}

.search-bar.has-results {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
  background: #ffffff;
}

.search-bar.error {
  border-color: var(--google-red);
  box-shadow: var(--shadow-medium), 0 0 0 4px rgba(234, 67, 53, 0.15);
  animation: shake 0.5s ease-in-out;
}

.search-icon {
  flex-shrink: 0;
  opacity: 0.6;
}

#search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1.05rem;
  font-family: var(--font-primary);
  color: #202124;
  outline: none;
  font-weight: 400;
}

#search-input::placeholder {
  color: #9AA0A6;
  font-weight: 400;
}

.clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.clear-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Autocomplete */
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top: 1px solid #e8eaed;
  /* Thin separator line */
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  z-index: 1;
  padding: 8px 0 16px 0;
  /* No side padding so hover is edge-to-edge */
  /* Hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.autocomplete-list::-webkit-scrollbar {
  display: none;
}

.autocomplete-list li {
  padding: 8px 24px;
  /* match search bar inner padding */
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  color: #3C4043;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-list li:hover,
.autocomplete-list li.highlight {
  background: rgba(66, 133, 244, 0.1);
  color: var(--google-blue);
}

.autocomplete-list li mark {
  background: transparent;
  color: var(--google-blue);
  font-weight: 600;
}

/* Search Button */
.search-actions {
  display: flex;
  gap: 12px;
}

.btn-search {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  background: var(--google-blue);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.35);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn-search::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s;
}

.btn-search:hover {
  background: #3367D6;
  box-shadow: 0 4px 16px rgba(66, 133, 244, 0.45);
  transform: translateY(-1px);
}

.btn-search:hover::before {
  transform: translateX(200%);
}

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

/* Error */
.error-msg {
  display: flex;
  align-items: center;
  font-size: 0.88rem;
  color: var(--google-red);
  background: rgba(234, 67, 53, 0.12);
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid rgba(234, 67, 53, 0.2);
  animation: fadeInUp 0.3s ease-out;
}

/* ===== FLOATING LOGOS ===== */
.floating-logos {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.floating-logo {
  position: absolute;
  opacity: 0.85;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
  transition: opacity var(--transition-medium);
}

.floating-gdg {
  top: 24px;
  left: 28px;
  height: 56px;
  width: auto;
  animation: subtleFloat 5s ease-in-out infinite;
}

.floating-cloud {
  top: 4px;
  right: 28px;
  height: 96px;
  width: auto;
  animation: subtleFloat 5s ease-in-out infinite;
}

@keyframes subtleFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

/* ===== CERTIFICATE VIEW ===== */
.cert-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 32px;
  width: 100%;
  max-width: 900px;
  animation: scaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  overflow: hidden;
}

.cert-card {
  background: rgba(255, 255, 255, 0.75);
  /* Slightly transparent white instead of glassmorphism */
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-card);
  padding: 16px;
  box-shadow: var(--shadow-strong);
  transition: transform var(--transition-medium);
  width: 100%;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  will-change: transform, opacity;
  transform: translateZ(0);
  aspect-ratio: 1.414;
}

/* Shine Effect */
.cert-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(to right,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.6) 50%,
      rgba(255, 255, 255, 0) 100%);
  transform: translateX(-150%) skewX(-25deg);
  z-index: 10;
  pointer-events: none;
}

.cert-card.animate-shine::before {
  animation: shine 1.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes shine {
  0% {
    transform: translateX(-150%) skewX(-25deg);
  }

  100% {
    transform: translateX(400%) skewX(-25deg);
  }
}

.cert-card:hover {
  transform: perspective(800px) rotateY(-2deg) rotateX(1deg);
}

#cert-canvas {
  width: 100%;
  height: 100%;
  max-width: 100%;
  border-radius: 12px;
  display: block;
  object-fit: contain;
}

.cert-name-display {
  display: none !important;
}

/* Cert Buttons */
.cert-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: var(--google-green);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(52, 168, 83, 0.35);
  transition: all var(--transition-fast);
}

.btn-download:hover {
  background: #2D9249;
  box-shadow: 0 4px 16px rgba(52, 168, 83, 0.45);
  transform: translateY(-1px);
}

.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: var(--bg-glass);
  color: #5F6368;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-back:hover {
  background: var(--bg-glass-hover);
  color: #202124;
  border-color: rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

/* ===== UTILITY ===== */
.hidden {
  display: none !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .title {
    font-size: 1.8rem;
  }

  .search-container {
    padding: 20px 16px;
    gap: 18px;
  }

  .search-bar {
    padding: 12px 18px;
  }

  #search-input {
    font-size: 16px;
    /* Prevents iOS Safari from auto-zooming */
  }

  .autocomplete-list {
    max-height: 40vh;
    /* Keeps results above virtual keyboard */
  }

  /* .floating-logos {
    opacity: 0.25;
    z-index: 0;
  } */

  .btn-search,
  .btn-download,
  .btn-back {
    padding: 10px 20px;
    font-size: 0.88rem;
  }

  .cert-container {
    padding: 16px;
  }

  .cert-card {
    padding: 10px;
  }

  .thank-you-img {
    height: 28px;
  }

  .floating-gdg {
    height: 38px;
    top: 12px;
    left: 12px;
  }

  .floating-cloud {
    height: 64px;
    top: -2px;
    right: 12px;
  }
}