@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap");

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

:root {
  --bg-primary: #140608;
  --bg-secondary: #220a10;
  --bg-card: rgba(28, 10, 14, 0.78);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --border-glass: rgba(255, 255, 255, 0.12);
  --text-primary: #fff5f6;
  --text-secondary: #f6b4bd;
  --text-muted: #c2808a;
  --accent-1: #ef4444;
  --accent-2: #fb2d5b;
  --accent-3: #ff7a1a;
  --accent-glow: rgba(239, 68, 68, 0.35);
  --success: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.25);
  --error: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.25);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-depth: 0 24px 70px -18px rgba(0, 0, 0, 0.6);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background:
    radial-gradient(
      circle at top left,
      rgba(239, 68, 68, 0.22),
      transparent 30%
    ),
    linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.05),
    transparent 40%,
    rgba(255, 255, 255, 0.03)
  );
  pointer-events: none;
  z-index: 0;
}

/* ===== Animated Background ===== */
.bg-animation {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.3;
  animation: orbFloat 20s ease-in-out infinite;
}

.bg-orb:nth-child(1) {
  width: 600px;
  height: 600px;
  background: var(--accent-1);
  top: -200px;
  left: -100px;
  animation-duration: 25s;
}

.bg-orb:nth-child(2) {
  width: 500px;
  height: 500px;
  background: var(--accent-2);
  bottom: -150px;
  right: -100px;
  animation-duration: 30s;
  animation-delay: -5s;
}

.bg-orb:nth-child(3) {
  width: 400px;
  height: 400px;
  background: var(--accent-3);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 22s;
  animation-delay: -10s;
}

@keyframes orbFloat {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(60px, -40px) scale(1.05);
  }
  50% {
    transform: translate(-30px, 60px) scale(0.95);
  }
  75% {
    transform: translate(40px, 30px) scale(1.02);
  }
}

/* Grid pattern overlay */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

/* ===== Main Layout ===== */
.app-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

/* ===== Header / Branding ===== */
.brand {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeSlideUp 0.8s var(--transition-smooth) both;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.brand-badge .dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

.brand h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  background: linear-gradient(
    135deg,
    #fff 0%,
    var(--accent-2) 48%,
    var(--accent-3) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  text-shadow: 0 8px 30px rgba(239, 68, 68, 0.16);
}

.brand p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ===== Search Card ===== */
.search-card {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(
    145deg,
    rgba(35, 14, 18, 0.9),
    rgba(22, 8, 10, 0.82)
  );
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow-depth);
  animation: fadeSlideUp 0.8s var(--transition-smooth) 0.15s both;
  transition:
    border-color var(--transition-fast),
    transform var(--transition-smooth);
}

.search-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

.search-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

.input-wrapper {
  position: relative;
  margin-bottom: 1.25rem;
}

.input-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.input-wrapper:focus-within .input-icon {
  color: var(--accent-2);
}

#certId {
  width: 100%;
  padding: 16px 18px 16px 50px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  outline: none;
  transition: all var(--transition-fast);
}

#certId::placeholder {
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
}

#certId:focus {
  border-color: var(--accent-2);
  background: rgba(168, 85, 247, 0.06);
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.1);
}

.verify-btn {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(239, 68, 68, 0.24);
  transition: all var(--transition-fast);
}

.verify-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.verify-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 34px rgba(251, 45, 91, 0.3);
}

.verify-btn:hover::before {
  opacity: 1;
}

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

.verify-btn .btn-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.verify-btn .spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.verify-btn.loading .spinner {
  display: block;
}

.verify-btn.loading .btn-text {
  display: none;
}

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

/* ===== Result Card ===== */
.result-area {
  margin-top: 1.5rem;
  min-height: 0;
  overflow: hidden;
}

.result-card {
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid;
  animation: resultReveal 0.5s var(--transition-bounce) both;
  position: relative;
  overflow: hidden;
}

@keyframes resultReveal {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Success state */
.result-card.success {
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.2);
}

.result-card.success::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--success), var(--accent-3));
  border-radius: 3px 3px 0 0;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.25rem;
}

.result-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.result-card.success .result-icon {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.result-card.error .result-icon {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.result-icon svg {
  width: 22px;
  height: 22px;
}

.result-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.result-card.success .result-title {
  color: var(--success);
}

.result-card.error .result-title {
  color: var(--error);
}

.result-details {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 100px;
}

.detail-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.detail-value.name-highlight {
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff, var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Error state */
.result-card.error {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.2);
}

.result-card.error::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--error), #f97316);
  border-radius: 3px 3px 0 0;
}

.error-message {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== Footer ===== */
.footer {
  margin-top: 3rem;
  text-align: center;
  animation: fadeSlideUp 0.8s var(--transition-smooth) 0.3s both;
}

.footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.footer a {
  color: #ff8a5b;
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.footer a:hover {
  color: #ffb36b;
}

/* ===== Animations ===== */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Particles ===== */
.particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(239, 68, 68, 0.5);
  border-radius: 50%;
  animation: particleDrift linear infinite;
}

@keyframes particleDrift {
  0% {
    transform: translateY(100vh) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-10vh) scale(1);
    opacity: 0;
  }
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .app-container {
    padding: 1.5rem 1rem;
  }

  .search-card {
    padding: 2rem 1.5rem;
    border-radius: var(--radius-lg);
  }

  .brand h1 {
    font-size: 2rem;
  }

  .detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .detail-label {
    min-width: auto;
  }
}
