/* Header styles */
#navbar {
  display: flex;
  justify-content: space-between; /* Adjusted for better spacing */
  align-items: center;
  padding: 0.5em 1.5em; /* Increased horizontal padding */
  background-color: #eee9e5;
  position: relative;
  flex-wrap: nowrap; /* Prevent main items from wrapping initially */
}

#navbar .logo-link img { /* Target logo image specifically */
  height: 4.5em; /* Adjusted logo size */
  display: block; /* Removes extra space below image */
}

#main-nav { /* Targeted by ID */
  display: flex;
  align-items: center;
  flex-grow: 1;
  justify-content: center; /* Center nav items */
}

#main-nav a {
  color: #735339;
  font-size: 1.1em;
  margin: 0 0.6em;
  padding: 0.4em 0.6em;
  border-radius: 0.3em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.3s, color 0.3s;
}

#main-nav a:hover {
  background-color: #735339;
  color: #f0f0f0;
}

.search-form {
  display: flex;
  align-items: center;
  margin-left: 1em; /* Space from last nav item */
  margin-right: 1em; /* Space before user actions */
}

.search-input {
  padding: 0.5em 0.8em;
  border-radius: 1em 0 0 1em;
  border: 1px solid #c5bbb3; /* Slightly darker border */
  border-right: none;
  background-color: #fff; /* White background */
  outline: none;
  font-size: 0.9em;
  height: 36px; /* Match button height */
  box-sizing: border-box;
  width: 180px;
  transition: width 0.3s ease-in-out;
}
.search-input:focus {
  width: 220px;
  border-color: #735339;
}

.search-button {
  padding: 0 0.8em;
  border-radius: 0 1em 1em 0;
  border: 1px solid #c5bbb3;
  background-color: #e0dace; /* Lighter accent */
  color: #735339;
  cursor: pointer;
  font-size: 0.9em;
  height: 36px; /* Match input height */
  box-sizing: border-box;
  border-left: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-button:hover {
  background-color: #d1c5bc;
}
.search-button i {
  font-size: 1.1em;
}

#user-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0; /* Prevent user actions from shrinking too much */
}

.user-icon {
  color: #735339;
  font-size: 1.1em;
  padding: 0.5em 0.7em; /* Adjusted padding */
  border-radius: 0.3em;
  margin-left: 0.5em;
  text-decoration: none;
  white-space: nowrap;
  display: flex; /* For aligning icon and text */
  align-items: center;
  gap: 0.3em; /* Space between icon and text */
}
.user-icon .nav-link-text { /* Hide text on larger screens by default */
    display: none;
}

.user-icon:hover {
  color: #f0f0f0;
  background-color: #735339;
}

#mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #735339;
  font-size: 1.8em;
  cursor: pointer;
  padding: 0.3em 0.5em;
  margin-left: 0.5em; /* Space from user actions */
}

/* Footer styles */
.footer {
  background-color: #ddd9d5;
  display: flex;
  width: 100%;
  justify-content: space-around;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 2em 1em;
  color: #735339;
}

.footer .left, .footer .right {
  flex: 1;
  min-width: 250px;
  padding: 1em;
  text-align: center;
}

.footer .left img {
  width: 12em; /* Adjusted footer logo */
  max-width: 100%;
  height: auto;
  margin-bottom: 1em;
}

.footer .left p {
  font-size: 0.95em; /* Adjusted font size */
  margin: 0.3em 0;
  line-height: 1.4;
}

.footer .right h4 {
  font-size: 1.1em; /* Adjusted font size */
  margin-bottom: 0.8em;
}

.footer .right ul {
  list-style-type: none;
  padding: 0;
  margin: 0 auto;
  display: inline-block;
  text-align: left;
}

.footer .right ul li {
  font-size: 0.95em; /* Adjusted font size */
  padding: 0.2em 0;
}

.footer .right ul li a {
  color: #735339;
  text-decoration: none;
}
.footer .right ul li a:hover {
  text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 992px) { /* Adjust breakpoint as needed */
    #main-nav a {
        font-size: 1em;
        margin: 0 0.4em;
    }
    .search-input {
        width: 150px;
    }
    .search-input:focus {
        width: 180px;
    }
    .user-icon {
        font-size: 1em;
        padding: 0.5em;
    }
     .user-icon .nav-link-text { /* Still hide text on medium screens if icons are enough */
        display: none;
    }
}

@media (max-width: 768px) {
    #navbar {
        padding: 0.5em 1em; /* Adjust padding for mobile */
    }
    #navbar .logo-link img {
        height: 3.8em;
    }

    #main-nav {
        display: none; /* Hide nav by default */
        flex-direction: column;
        width: 100%;
        background-color: #eee9e5;
        position: absolute;
        top: 100%; /* Position below header based on actual header height */
        left: 0;
        z-index: 1000;
        box-shadow: 0 3px 5px rgba(0,0,0,0.1);
        padding: 1em 0; /* Add some padding */
    }
    #main-nav.active {
        display: flex; /* Show when active */
    }
    #main-nav a {
        width: 100%;
        text-align: left; /* Align text left for dropdown items */
        margin: 0;
        padding: 0.8em 1.5em; /* Padding for dropdown items */
        border-bottom: 1px solid #d1c5bc;
        border-radius: 0; /* No radius for dropdown items */
    }
    #main-nav a:last-child {
        border-bottom: none;
    }
    .search-form { /* Move search into the dropdown */
        width: 90%;
        margin: 1em auto;
        order: 10; /* Place at the end of the nav items */
    }

    #user-actions {
        margin-left: auto; /* Pushes toggle to right if user-actions are hidden */
        order: 3; /* Ensure toggle is last on mobile */
    }
     .user-icon i { /* Show only icons on mobile if text is too much */
        font-size: 1.3em; /* Make icons slightly larger on mobile */
    }
    .user-icon .nav-link-text {
         display: none; /* Hide text part of user links on mobile if desired */
    }


    #mobile-menu-toggle {
        display: block; /* Show toggle button */
        order: 4; /* Make it the very last item */
    }

    /* Ensure main content area is below fixed/absolute header */
    .main-content-area {
      padding-top: 60px; /* Adjust this value to match your header's height */
    }
}

@media (max-width: 480px) {
    #navbar .logo-link img {
        height: 3.2em;
    }
    .user-icon {
         padding: 0.5em 0.4em;
    }
    .user-icon i {
        font-size: 1.2em;
    }

    .footer .left, .footer .right {
        min-width: 100%; /* Stack columns */
        text-align: center;
    }
}