:root {
  --bg-color: #ffffff;
  --text-color: #202124;
  --border-color: #dadce0;
  --hover-bg: #f8f9fa;
  --button-bg: #f8f9fa;
  --button-hover: #e8eaed;
  --link-color: #1a0dab;
  --visited-color: #681da8;
  --description-color: #2d3136;
  --url-color: #175728;
}

[data-theme="dark"] {
  --bg-color: #202124;
  --text-color: #e8eaed;
  --border-color: #5f6368;
  --hover-bg: #303134;
  --button-bg: #303134;
  --button-hover: #3c4043;
  --link-color: #8ab4f8;
  --visited-color: #c58af9;
  --description-color: #e8eaed;
  --url-color: #79d191;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: 14px;
  transition: background-color 0.3s, color 0.3s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

hr {
  margin-top: 16px;
  margin-bottom: 16px;
  color: var(--text-color);
  opacity: 0.2;
}

a {
  color: var(--link-color);
}

a:visited {
  color: var(--visited-color);
}

ol, ul {
  list-style-position: inside;
}

/* Theme Toggle */
.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 1000;
}

/* Homepage Styles */
.homepage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.logo {
  font-size: 90px;
  font-weight: bold;
  color: var(--text-color);
  margin-bottom: 30px;
  font-family: 'Product Sans', Arial, sans-serif;
  user-select: none;
  cursor: default;
}

.about-link {
  font-style: italic;
  color: var(--text-color);
  opacity: 0.4;
  text-decoration: none;
}

.about-link:visited {
  color: var(--text-color);
}

.info-page {
  font-size: 16px;
  line-height: 1.5em;
  margin-top: auto;
  margin-bottom: auto;
}

.info-page * {
  margin: revert;
}

.results-page {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  flex: 1;
}

.pagination {
  padding: 20px 0;
  text-align: center;
}

.search-container {
  width: 100%;
  max-width: 584px;
  position: relative;
  margin-bottom: 30px;
  position: relative;
  display: inline-block;
}

.search-box {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 0 45px 0 20px;
  font-size: 16px;
  outline: none;
  background: var(--bg-color);
  color: var(--text-color);
  transition: box-shadow 0.3s, border-color 0.3s;
}

.search-box:hover {
  border-color: var(--border-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-box:focus {
  border-color: var(--border-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.search-button {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  padding: 5px;
}

.header {
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 30px;
}

a.logo-small {
  font-size: 30px;
  font-weight: bold;
  text-decoration: none;
  color: var(--text-color);
}

.search-container-header {
  flex: 1;
  max-width: 584px;
  position: relative;
  display: inline-block;
}

.search-box-header {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 0 45px 0 20px;
  font-size: 16px;
  outline: none;
  background: var(--bg-color);
  color: var(--text-color);
}

.results-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.results-info {
  color: var(--description-color);
  font-size: 14px;
  margin-bottom: 20px;
}

.result {
  margin-bottom: 20px;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-image {
  max-width: 2em;
  max-height: 2em;
  display: inline-block;
  object-fit: contain;
  vertical-align: middle;
}

.result-url {
  color: var(--url-color);
  font-size: 14px;
  margin-bottom: 4px;
  align-items: center;
  text-decoration: none;
}

.result-url:visited {
  color: var(--url-color);
}

.result-url:hover {
  text-decoration: underline;
}

.result-title {
  color: var(--link-color);
  font-size: 20px;
  text-decoration: none;
  line-height: 1.3;
  margin-bottom: 4px;
  vertical-align: middle;
}

.result-title:hover {
  text-decoration: underline;
}

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

.result-description {
  color: var(--description-color);
  font-size: 14px;
  line-height: 1.4;
  margin-top: 8px;
  margin-bottom: 8px;
}

.favicon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border-radius: 2px;
}

.page-link, .page-link:visited {
 display: inline-block;
 padding: 8px 12px;
 margin: 0 2px;
 text-decoration: none;
 color: var(--text-color);
 border-radius: 4px;
 font-size: 14px;
}

a.page-link:hover {
 background-color: #f1f3f4;
 text-decoration: underline;
}

.page-link.current-page, .page-link.current-page:visited {
 background-color: #4285f4;
 color: white;
 font-weight: bold;
}

a.page-link.current-page:hover {
 background-color: #4285f4;
 text-decoration: none;
}


/* Mobile Responsive */
@media (max-width: 768px) {
  .logo {
    font-size: 60px;
    margin-bottom: 20px;
  }

  .search-container {
    max-width: 90%;
    margin-bottom: 20px;
  }

  .buttons {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .btn {
    width: 150px;
  }

  .header-content {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .logo-small {
    text-align: center;
  }

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

  .results-container {
    padding: 15px;
  }

  .theme-toggle {
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 50px;
  }

  .search-container {
    max-width: 95%;
  }

  .search-box,
  .search-box-header {
    height: 40px;
    font-size: 14px;
    padding: 0 40px 0 16px;
  }
}
