/* ==========================================================================
   Google Homepage Clone Stylesheet
   ========================================================================== */

/* Design Tokens / Variables */
:root {
  /* Color Palette (Light Mode - Standard Google) */
  --bg-color: #ffffff;
  --text-color: #202124;
  --link-color: #202124;
  --link-hover-color: #202124;
  --secondary-text: #70757a;
  
  --header-bg: #ffffff;
  
  --footer-bg: #f2f2f2;
  --footer-border: #dadce0;
  --footer-link-color: #70757a;
  --footer-link-hover: #3c4043;
  
  --search-bg: #ffffff;
  --search-border: #dfe1e5;
  --search-text: #202124;
  --search-hover-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
  --search-focus-bg: #ffffff;
  --search-icon-fill: #9aa0a6;
  
  --btn-bg: #f8f9fa;
  --btn-border: #f8f9fa;
  --btn-text: #3c4043;
  --btn-hover-bg: #f1f3f4;
  --btn-hover-border: #dadce0;
  --btn-hover-text: #202124;
  --btn-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  
  --waffle-fill: #5f6368;
  --waffle-hover-bg: rgba(60, 64, 67, 0.08);
  
  --signin-bg: #1a73e8;
  --signin-text: #ffffff;
  --signin-hover-bg: #1b66c9;
  --signin-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
  
  --lang-link-color: #1a0dab;
  --suggestion-hover-bg: #f8f9fa;
  --suggestion-divider: #e8eaed;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Color Palette (Dark Mode - Match Google Dark) */
    --bg-color: #202124;
    --text-color: #e8eaed;
    --link-color: #e8eaed;
    --link-hover-color: #ffffff;
    --secondary-text: #bdc1c6;
    
    --header-bg: #202124;
    
    --footer-bg: #171717;
    --footer-border: #303134;
    --footer-link-color: #bdc1c6;
    --footer-link-hover: #ffffff;
    
    --search-bg: #202124;
    --search-border: #5f6368;
    --search-text: #e8eaed;
    --search-hover-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
    --search-focus-bg: #303134;
    --search-icon-fill: #9aa0a6;
    
    --btn-bg: #303134;
    --btn-border: #303134;
    --btn-text: #e8eaed;
    --btn-hover-bg: #3c4043;
    --btn-hover-border: #5f6368;
    --btn-hover-text: #ffffff;
    --btn-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    
    --waffle-fill: #bdc1c6;
    --waffle-hover-bg: rgba(232, 240, 254, 0.08);
    
    --signin-bg: #8ab4f8;
    --signin-text: #202124;
    --signin-hover-bg: #9ec2f9;
    --signin-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    
    --lang-link-color: #8ab4f8;
    --suggestion-hover-bg: #3c4043;
    --suggestion-divider: #3c4043;
  }
}

/* Reset and Core Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Roboto', arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navigation Header */
header {
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 24px 0;
  background-color: var(--header-bg);
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-left: auto; /* Pushes to the right if left is empty */
}

.nav-link {
  font-size: 13px;
  color: var(--link-color);
  text-decoration: none;
  padding: 5px;
  letter-spacing: 0.1px;
}

.nav-link:hover {
  text-decoration: underline;
  color: var(--link-hover-color);
}

/* Icons and buttons */
.icon-button {
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.15s ease;
  outline: none;
}

.apps-btn {
  width: 40px;
  height: 40px;
}

.apps-btn:hover {
  background-color: var(--waffle-hover-bg);
}

.apps-btn svg {
  width: 24px;
  height: 24px;
  fill: var(--waffle-fill);
}

/* Sign In Button */
.signin-btn {
  background-color: var(--signin-bg);
  color: var(--signin-text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  padding: 9px 23px;
  border-radius: 4px;
  transition: background-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--signin-shadow);
  display: inline-block;
  line-height: 1.2;
}

.signin-btn:hover {
  background-color: var(--signin-hover-bg);
  box-shadow: 0 2px 4px 0 rgba(0,0,0,0.2);
}

/* Main Section */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 100px;
  width: 100%;
}

/* Google Logo */
.logo-container {
  margin-bottom: 28px;
  user-select: none;
}

.google-logo {
  width: 272px;
  height: 92px;
  max-width: 90vw;
}

/* Search Form and Box wrapper */
.search-form {
  width: 100%;
  max-width: 584px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px;
}

.search-box-wrapper {
  width: 100%;
  position: relative;
  background-color: var(--search-bg);
  border: 1px solid var(--search-border);
  border-radius: 24px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
  z-index: 5;
}

.search-box-wrapper:hover {
  box-shadow: var(--search-hover-shadow);
  border-color: transparent;
}

/* On focus within search box */
.search-box-wrapper:focus-within {
  box-shadow: var(--search-hover-shadow);
  border-color: transparent;
  background-color: var(--search-focus-bg);
  border-radius: 24px 24px 0 0;
}

.search-box-container {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 14px;
}

.search-icon-wrapper {
  display: flex;
  align-items: center;
  margin-right: 12px;
}

.search-icon-wrapper svg {
  width: 20px;
  height: 20px;
  fill: var(--search-icon-fill);
}

.search-input {
  flex: 1;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--search-text);
  font-size: 16px;
}

/* Voice & Lens controls */
.search-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-controls .icon-button {
  width: 36px;
  height: 36px;
}

.search-controls .icon-button:hover {
  background-color: var(--waffle-hover-bg);
}

.search-controls svg {
  width: 24px;
  height: 24px;
}

/* Lens SVG scale specifically */
.lens-btn svg {
  width: 24px;
  height: 24px;
}

/* Search suggestions - initially hidden, displayed on focus */
.search-suggestions {
  display: none;
  position: absolute;
  top: 100%;
  left: -1px;
  right: -1px;
  background-color: var(--search-focus-bg);
  border-radius: 0 0 24px 24px;
  box-shadow: 0 4px 6px rgba(32, 33, 36, 0.28);
  border: 1px solid transparent;
  border-top: 1px solid var(--suggestion-divider);
  padding: 8px 0 16px;
  z-index: 4;
}

/* Toggle suggestions on focus within */
.search-box-wrapper:focus-within .search-suggestions {
  display: block;
}

.suggestion-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.suggestion-item:hover {
  background-color: var(--suggestion-hover-bg);
}

.suggestion-icon {
  margin-right: 14px;
  display: flex;
  align-items: center;
}

.suggestion-icon svg {
  width: 16px;
  height: 16px;
  fill: var(--search-icon-fill);
}

.suggestion-text {
  font-size: 15px;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Search buttons container */
.search-buttons {
  display: flex;
  gap: 12px;
  margin-top: 29px;
  margin-bottom: 29px;
}

.btn {
  background-color: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-text);
  font-size: 14px;
  padding: 0 16px;
  height: 36px;
  min-width: 54px;
  text-align: center;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  outline: none;
  transition: box-shadow 0.1s ease, border-color 0.1s ease, background-color 0.1s ease, color 0.1s ease;
}

.btn:hover {
  box-shadow: var(--btn-shadow);
  background-color: var(--btn-hover-bg);
  border-color: var(--btn-hover-border);
  color: var(--btn-hover-text);
}

.btn:focus {
  border-color: #4285f4;
}

/* Language Selection section */
.language-selection {
  font-size: 13px;
  margin-top: 10px;
  color: var(--secondary-text);
}

.language-selection a {
  color: var(--lang-link-color);
  text-decoration: none;
  margin-left: 6px;
}

.language-selection a:hover {
  text-decoration: underline;
}

/* Fixed Footer Section */
footer {
  background-color: var(--footer-bg);
  border-top: 1px solid var(--footer-border);
  width: 100%;
  z-index: 10;
  margin-top: auto;
}

.footer-top {
  padding: 15px 30px;
  border-bottom: 1px solid var(--footer-border);
}

.country {
  color: var(--secondary-text);
  font-size: 15px;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0 20px;
}

.footer-left,
.footer-right {
  display: flex;
  flex-wrap: wrap;
}

.footer-bottom a {
  color: var(--footer-link-color);
  font-size: 14px;
  padding: 15px;
  text-decoration: none;
  display: inline-block;
  transition: color 0.15s ease;
}

.footer-bottom a:hover {
  color: var(--footer-link-hover);
  text-decoration: none;
}

/* ==========================================================================
   Responsive Media Queries
   ========================================================================== */

/* Tablet Layout (Width < 768px) */
@media (max-width: 768px) {
  header {
    padding: 6px 16px 0;
  }
  
  main {
    padding-top: 80px;
  }
  
  .google-logo {
    width: 200px;
    height: 68px;
  }
  
  .footer-bottom {
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
  }
  
  .footer-left,
  .footer-right {
    justify-content: center;
    width: 100%;
  }
  
  .footer-bottom a {
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* Mobile Layout (Width < 480px) */
@media (max-width: 480px) {
  header {
    height: 50px;
  }
  
  .header-left {
    display: none; /* Hide store/about links on header in mobile */
  }
  
  main {
    padding-top: 50px;
  }
  
  .google-logo {
    width: 160px;
    height: 54px;
  }
  
  .search-form {
    padding: 0 10px;
  }
  
  .search-box-container {
    height: 40px;
    padding: 0 10px;
  }
  
  .search-input {
    font-size: 14px;
  }
  
  .search-controls .icon-button {
    width: 32px;
    height: 32px;
  }
  
  .search-controls svg {
    width: 20px;
    height: 20px;
  }
  
  .search-buttons {
    margin-top: 20px;
    margin-bottom: 20px;
    gap: 8px;
  }
  
  .btn {
    font-size: 13px;
    padding: 0 12px;
    height: 32px;
  }
  
  .language-selection {
    font-size: 12px;
    text-align: center;
    padding: 0 15px;
    line-height: 1.5;
  }
  
  .footer-top {
    padding: 10px 20px;
    text-align: center;
  }
  
  .footer-bottom a {
    padding: 8px 10px;
    font-size: 12px;
  }
}
