:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --background: #f4f7fa;
  --container-bg: #ffffff;
  --lavender: #c8a2ff;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Roboto, sans-serif;
  background: var(--background);
  color: #222;
  display: flex;
  flex-direction: column;
  align-items: center;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* centers container vertically */
  width: 100%;
  max-width: 640px;
  padding: 2rem 1rem;
  box-sizing: border-box;
}

h1 {
  font-size: 2.4rem;
  color: var(--primary-dark);
  text-shadow: 0 0 12px rgba(37, 99, 235, 0.2);
  transition: all 0.6s ease;
  cursor: pointer;
  margin-bottom: 1.5rem;
  text-align: center;
}

body.search-active h1 {
  font-size: 1.4rem;
  margin-top: 2rem;
  opacity: 0.85;
  transform: translateY(-10px);
}

.container {
  background: var(--container-bg);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.5s ease;
  animation: fadeInUp 0.8s ease forwards;
}

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

input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.3s ease, transform 0.15s ease;
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.share-btn {
  background: var(--lavender);
  color: #222;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  flex: 1;
  min-width: 120px;
  transition: all 0.25s ease;
  text-shadow: 0 0 4px rgba(200, 162, 255, 0.3);
}

.share-btn:hover {
  filter: brightness(1.1);
  text-shadow: 0 0 8px rgba(200, 162, 255, 0.7);
}

.loader {
  display: none;
  text-align: center;
  margin-top: 1rem;
}

.loader span {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 4px;
  background: var(--lavender);
  border-radius: 50%;
  animation: bounce 1.2s infinite ease-in-out;
}

.loader span:nth-child(2) { animation-delay: 0.2s; }
.loader span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.results {
  margin-top: 1.5rem;
}

.result-item {
  background: #f9fafb;
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 0.8rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.result-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

.result-item h3 {
  margin: 0 0 0.4rem 0;
  color: var(--primary-dark);
  font-size: 1.1rem;
}

.result-item p {
  margin: 0.25rem 0;
  color: var(--secondary);
  font-size: 0.9rem;
}

.result-item-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

.result-item a {
  flex: 1;
  min-width: 120px;
  text-align: center;
  text-decoration: none;
  background: var(--lavender);
  color: #222;
  font-weight: 600;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  transition: all 0.25s ease;
  text-shadow: 0 0 4px rgba(200, 162, 255, 0.3);
}

.result-item a:hover {
  filter: brightness(1.1);
  text-shadow: 0 0 8px rgba(200, 162, 255, 0.7);
}

footer {
  text-align: center;
  font-size: 0.9rem;
  color: #555;
  padding: 1rem 0;
  width: 100%;
  margin-top: auto;
}

footer a {
  color: var(--lavender);
  text-decoration: none;
  font-weight: 600;
  text-shadow: 0 0 6px rgba(200, 162, 255, 0.4);
  transition: text-shadow 0.2s ease;
}

footer a:hover {
  text-shadow: 0 0 10px rgba(200, 162, 255, 0.8);
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  body.search-active h1 {
    margin-top: 1.2rem;
  }

  .container {
    padding: 1.2rem;
  }

  input, button {
    font-size: 0.95rem;
  }

  .result-item-actions {
    flex-direction: column;
  }

  .result-item a, .share-btn {
    width: 100%;
  }
}