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

body {
  font-family: arial, sans-serif;
  color: #202124;
  background: #fff;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font: inherit; }
ul, ol { list-style: none; }

.view[hidden] { display: none !important; }

/* === Loading Overlay === */
.loading-overlay {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff; z-index: 1000;
}
.loading-overlay[hidden] { display: none; }

.loading-dots {
  display: flex; gap: 8px;
}
.dot {
  width: 12px; height: 12px; border-radius: 50%;
  animation: dotBounce 1.4s ease-in-out infinite;
}
.dot1 { background: #4285f4; animation-delay: 0s; }
.dot2 { background: #ea4335; animation-delay: 0.2s; }
.dot3 { background: #fbbc05; animation-delay: 0.4s; }
.dot4 { background: #34a853; animation-delay: 0.6s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.loading-overlay p {
  margin-top: 20px; color: #70757a; font-size: 14px;
}

/* === HOME VIEW === */
.home-container {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  min-height: 100vh; padding: 20px;
}

/* Google-style colorful logo */
.home-logo {
  font-size: 92px;
  font-weight: 400;
  margin-bottom: 28px;
  letter-spacing: -2px;
  user-select: none;
  font-family: 'Product Sans', arial, sans-serif;
}

.logo-s  { color: #4285f4; }
.logo-i  { color: #ea4335; }
.logo-m  { color: #fbbc05; }
.logo-u  { color: #4285f4; }
.logo-l  { color: #34a853; }
.logo-a  { color: #ea4335; }
.logo-t  { color: #4285f4; }
.logo-e  { color: #fbbc05; }
.logo-d  { color: #34a853; }
.logo-space { }
.logo-w  { color: #ea4335; }
.logo-e2 { color: #4285f4; }
.logo-b  { color: #34a853; }

/* Search box container */
.search-box-container {
  width: 100%;
  max-width: 584px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Google-style search box */
.search-box {
  width: 100%;
  position: relative;
}

.search-box-inner {
  display: flex;
  align-items: center;
  height: 44px;
  border: 1px solid #dfe1e5;
  border-radius: 24px;
  padding: 0 14px;
  transition: box-shadow 0.2s, border-color 0.2s;
  background: #fff;
}

.search-box-inner:hover,
.search-box-inner:focus-within {
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
  border-color: rgba(223, 225, 229, 0);
}

.search-box-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  margin-right: 12px;
}

.search-box-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  color: #202124;
  background: transparent;
  height: 100%;
  padding: 0;
}

.clear-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: 8px;
}
.clear-btn:hover { background: #f1f3f4; }
.clear-btn[hidden] { display: none; }

.search-box-divider {
  width: 1px;
  height: 28px;
  background: #dadce0;
  margin: 0 12px;
  flex-shrink: 0;
}

.search-box-search-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}
.search-box-search-btn:hover { background: #f1f3f4; }

/* Home page buttons */
.home-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  position: relative;
  z-index: 300;
}

.home-btn {
  height: 36px;
  padding: 0 16px;
  border-radius: 4px;
  font-size: 14px;
  color: #3c4043;
  background: #f8f9fa;
  border: 1px solid #f8f9fa;
  min-width: 54px;
  text-align: center;
  font-family: arial, sans-serif;
}
.home-btn:hover {
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  background: #f8f9fa;
  border-color: #dadce0;
  color: #202124;
}

.home-footer {
  margin-top: 18px;
  color: #70757a;
  font-size: 13px;
}

/* === Suggestions Dropdown (Google style) === */
.suggestions-dropdown {
  position: absolute;
  top: calc(100% - 1px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid #dfe1e5;
  border-top: none;
  border-radius: 0 0 24px 24px;
  box-shadow: 0 4px 6px rgba(32, 33, 36, 0.28);
  z-index: 200;
  overflow: hidden;
  padding-bottom: 4px;
}
.suggestions-dropdown[hidden] { display: none; }

/* When suggestions are visible, flatten bottom of search box */
.search-box.has-suggestions .search-box-inner {
  border-radius: 24px 24px 0 0;
  border-bottom-color: transparent;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  font-size: 16px;
  color: #202124;
  cursor: pointer;
}
.suggestion-item::before {
  content: '';
  display: block;
  width: 20px; height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z' fill='%239aa0a6'/%3E%3C/svg%3E");
  background-size: contain;
  flex-shrink: 0;
}
.suggestion-item:hover { background: #f1f3f4; }

.suggestions-dropdown .divider {
  height: 1px;
  background: #e8eaed;
  margin: 4px 20px;
}

/* === RESULTS VIEW === */
.results-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
}

.results-header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 16px 20px 10px 20px;
}

.results-header-border {
  border-bottom: 1px solid #dadce0;
}

/* Results page logo */
.results-logo-link {
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -1px;
  text-decoration: none;
  font-family: 'Product Sans', arial, sans-serif;
  flex-shrink: 0;
  padding-bottom: 6px;
}

.rlogo-s  { color: #4285f4; }
.rlogo-i  { color: #ea4335; }
.rlogo-m  { color: #fbbc05; }
.rlogo-u  { color: #4285f4; }
.rlogo-l  { color: #34a853; }
.rlogo-a  { color: #ea4335; }
.rlogo-t  { color: #4285f4; }
.rlogo-e  { color: #fbbc05; }
.rlogo-d  { color: #34a853; }
.rlogo-space { }
.rlogo-w  { color: #ea4335; }
.rlogo-e2 { color: #4285f4; }
.rlogo-b  { color: #34a853; }

.results-search-box-wrap {
  flex: 1;
  max-width: 690px;
}

.search-box--results .search-box-inner {
  height: 44px;
  box-shadow: 0 2px 5px 1px rgba(64, 60, 67, 0.16);
  border-color: rgba(223, 225, 229, 0);
}
.search-box--results .search-box-inner:hover,
.search-box--results .search-box-inner:focus-within {
  box-shadow: 0 2px 8px 1px rgba(64, 60, 67, 0.24);
}

/* Results suggestions */
.search-box--results .suggestions-dropdown {
  box-shadow: 0 4px 6px rgba(32, 33, 36, 0.28);
}

/* === Results Body === */
.results-body {
  max-width: 652px;
  margin-left: 180px;
  padding: 12px 0 32px 0;
}

/* Results info bar */
.results-info {
  padding: 0 0 8px 0;
}
.results-count {
  font-size: 14px;
  color: #70757a;
}
.results-count strong {
  font-weight: 400;
}

/* Results list */
.results-list { }

.result-item {
  margin-bottom: 28px;
}

/* Result favicon + site row */
.result-cite {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.result-favicon {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
  border: 1px solid #dadce0;
}

.result-cite-text {
  min-width: 0;
  line-height: 1.3;
}

.result-site-name {
  font-size: 14px;
  color: #202124;
  display: block;
}

.result-url {
  font-size: 12px;
  color: #4d5156;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Result title */
.result-title {
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 4px;
}
.result-title a {
  color: #1a0dab;
  text-decoration: none;
}
.result-title a:visited { color: #681da8; }
.result-title a:hover { text-decoration: underline; }

/* Result snippet */
.result-snippet {
  font-size: 14px;
  line-height: 1.58;
  color: #4d5156;
  word-wrap: break-word;
}
.result-snippet mark {
  background: transparent;
  color: #202124;
  font-weight: 700;
}

.result-title mark {
  background: transparent;
  color: inherit;
  font-weight: inherit;
}

.no-results {
  font-size: 14px;
  color: #70757a;
  padding: 30px 0;
}

/* === Pagination (Google style) === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 24px 0 40px;
  margin-top: 20px;
}

.pagination-logo {
  display: flex;
  align-items: baseline;
  gap: 0;
  margin-bottom: 16px;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.5px;
  font-family: 'Product Sans', arial, sans-serif;
  user-select: none;
  justify-content: center;
}

.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 4px;
  font-size: 14px;
  color: #1a0dab;
  border-radius: 8px;
}
.page-btn:hover {
  background: #f1f3f4;
  text-decoration: underline;
}
.page-btn.active {
  color: #202124;
  font-weight: 700;
  cursor: default;
}
.page-btn.active:hover {
  background: none;
  text-decoration: none;
}

.page-ellipsis {
  padding: 0 4px;
  color: #70757a;
  font-size: 14px;
}

.page-nav {
  font-size: 14px;
  color: #1a0dab;
  padding: 0 12px;
  height: 40px;
  display: flex;
  align-items: center;
  border-radius: 8px;
}
.page-nav:hover {
  background: #f1f3f4;
  text-decoration: underline;
}

/* === Responsive === */
@media (max-width: 768px) {
  .home-logo { font-size: 56px; letter-spacing: -1px; }

  .results-header-inner { padding: 12px 16px 8px; gap: 16px; }
  .results-logo-link { font-size: 22px; }
  .results-search-box-wrap { max-width: none; }

  .results-body {
    margin-left: 0;
    padding: 12px 16px 32px;
    max-width: none;
  }

  .result-title { font-size: 18px; }
}

@media (max-width: 480px) {
  .home-logo { font-size: 40px; }
  .search-box-container { max-width: 100%; }
}
