:root {
  --primary-bg: rgba(255, 0, 0, 0.7);
  --secondary-bg: rgba(255, 255, 255, 0.3);
  --link-bg: rgba(0, 0, 0, 0.7);
  --link-hover-bg: rgba(150, 39, 39, 0.945);
  --text-color: white;
  --border-color: #ccc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-image: url("../assets/background.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed; /* Keeps background fixed when scrolling */
  color: var(--text-color);
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  background-color: var(--primary-bg);
  flex-wrap: wrap;
  text-align: center;
}

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  background-color: var(--primary-bg);
  font-size: 14px;
  margin-top: auto;
}

header .logo {
  height: 120px; /* Smaller logo for mobile */
  margin-right: 10px;
  max-width: 100%;
}

header h1 {
  margin: 0;
  font-size: 28px;
}

.container {
  display: flex;
  justify-content: space-between;
  padding: 15px;
  flex-wrap: wrap;
}

.center {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 15px;
}

.ad-space {
  width: 100%;
  max-width: 300px;
  margin: 0 auto 15px auto;
  min-height: 250px;
}

.ad-footer {
  width: 100%;
  min-height: 90px;
  margin-bottom: 15px;
}

.content {
  flex-grow: 1;
  width: 100%;
  max-width: 600px;
  margin: 0 auto 15px auto;
  text-align: center;
}

.search-container {
  display: flex;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.cep-input {
  flex-grow: 1;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 5px 0 0 5px;
  font-size: 16px;
  min-width: 0; /* Helps with flexbox sizing */
}

.search-button {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-left: none;
  border-radius: 0 5px 5px 0;
  background-color: var(--link-bg);
  color: var(--text-color);
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
  white-space: nowrap;
}

.search-button:hover {
  background-color: var(--link-hover-bg);
}

.link-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link {
  padding: 15px;
  background-color: var(--link-bg);
  color: var(--text-color);
  text-decoration: none;
  border-radius: 5px;
  transition: background-color 0.3s;
  word-break: break-word; /* Prevents text from overflowing */
}

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

/* Media Queries for responsive design */
@media (min-width: 768px) {
  header .logo {
    height: 150px;
  }
  
  header h1 {
    font-size: 32px;
  }
  
  .container {
    flex-wrap: nowrap;
  }
  
  .content {
    margin: 0 15px;
  }
  
  .ad-space {
    width: 160px;
    height: 600px;
    margin: 0;
  }
}

@media (min-width: 1024px) {
  header .logo {
    height: 200px;
  }
  
  header h1 {
    font-size: 40px;
  }
  
  .container {
    padding: 20px;
  }
}

/* Fix for very small screens */
@media (max-width: 380px) {
  .search-container {
    flex-direction: column;
  }
  
  .cep-input {
    border-radius: 5px;
    margin-bottom: 10px;
  }
  
  .search-button {
    border-radius: 5px;
    border-left: 1px solid var(--border-color);
    width: 100%;
  }
}

@media (max-width: 767px) {
  header .logo {
    display: none;
  }
  
  /* Adjust header spacing when logo is hidden */
  header {
    padding: 10px 15px;
    justify-content: center;
  }
  
  header h1 {
    margin: 0 auto;
  }
}