/* General Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
}

/* Navigation */
nav {
  background: linear-gradient(135deg, #003087, #0051c7);
  color: white;
  padding: 10px 20px; /* 减少默认内边距以降低高度 */
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-height: 50px; /* 确保导航栏高度适中 */
}

/* Hamburger Menu Icon */
.nav-toggle {
  display: none;
  font-size: 1.5rem;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
}

nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

nav ul li {
  margin: 0 15px;
  position: relative;
}

nav ul li a {
  color: white;
  text-decoration: none;
  padding: 8px 12px; /* 减少内边距 */
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.95rem; /* 字体稍小以优化空间 */
  transition: background-color 0.3s ease, transform 0.2s ease;
}

nav ul li a:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Dropdown Menu */
.dropdown {
  display: none;
  position: absolute;
  background: white;
  min-width: 200px;
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 101;
  padding: 10px 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

nav ul li:hover .dropdown,
nav ul li.active .dropdown {
  display: block;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  animation: dropdownFadeIn 0.3s ease forwards;
}

.dropdown li {
  margin: 0;
  padding: 0;
}

.dropdown li a {
  color: #333;
  display: block;
  padding: 10px 20px; /* 减少内边距 */
  font-size: 0.9rem;
  transition: background-color 0.2s, padding-left 0.2s;
}

.dropdown li a:hover {
  background: #f0f4ff;
  color: #003087;
  padding-left: 25px;
}

/* Dropdown Animation */
@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Hero Section */
.hero {
  background: url('../images/drone-sewage-bg.jpg') center/cover no-repeat;
  height: 60vh;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  z-index: 2;
  margin: 0 20px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Sections */
.section {
  padding: clamp(40px, 8vw, 80px) 20px;
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
}

/* Cards */
.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  padding: 0 20px;
}

.card {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
}

.card img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
}

/* Highlight Section */
.highlight {
  background: #e0f7fa;
  padding: 20px;
  margin: 20px auto;
  border-radius: 8px;
  max-width: 1200px;
}

/* News Section */
.news {
  margin: 20px auto;
  max-width: 1200px;
}

.news-item {
  margin: 15px 0;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

/* Form */
form {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px;
}

input, select, textarea, button {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: #003087;
  outline: none;
}

textarea {
  height: 150px;
  resize: vertical;
}

button {
  background: #003087;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

button:hover {
  background: #0051c7;
}

/* Pagination */
.pagination {
  margin: 20px 0;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.pagination a {
  text-decoration: none;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  color: #333;
  transition: background-color 0.3s ease;
}

.pagination a:hover {
  background: #f0f4ff;
}

.pagination a.active {
  background: #003087;
  color: white;
  border-color: #003087;
}

/* Footer */
footer {
  background: linear-gradient(135deg, #003087, #0051c7);
  color: white;
  text-align: center;
  padding: 20px;
  font-size: 0.9rem;
}

/* Responsive Design for Mobile */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
    position: absolute;
    right: 15px;
    top: 12px;
    z-index: 102;
  }

  nav {
    padding: 10px 15px; /* 进一步减少内边距 */
    min-height: 48px; /* 降低导航栏高度 */
  }

  nav ul {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 48px; /* 与 nav 高度一致 */
    left: 0;
    width: 100%;
    height: calc(100vh - 48px);
    background: linear-gradient(135deg, #003087, #0051c7);
    overflow-y: auto;
    padding: 15px;
    transition: transform 0.3s ease;
    transform: translateX(-100%);
    z-index: 101;
  }

  nav ul.active {
    display: flex;
    transform: translateX(0);
  }

  nav ul li {
    margin: 8px 0;
    width: 100%;
  }

  nav ul li a {
    display: block;
    padding: 10px 15px; /* 减少内边距 */
    font-size: 1rem;
  }

  .dropdown {
    position: static;
    transform: none;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: none;
    border-radius: 0;
    display: none;
    opacity: 1;
    margin-left: 15px; /* 缩进以区分层级 */
    padding: 5px 0;
  }

  nav ul li.active .dropdown {
    display: block;
  }

  .dropdown li a {
    padding: 8px 25px; /* 减少内边距 */
    font-size: 0.95rem;
  }

  .hero {
    height: 50vh;
    min-height: 250px;
  }

  .card-container {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: clamp(1.5rem, 6vw, 2rem);
  }

  .section {
    padding: 30px 10px;
  }

  .card-container {
    grid-template-columns: 1fr;
  }

  form {
    padding: 0 15px;
  }

  input, select, textarea, button {
    font-size: 0.9rem;
  }

  nav {
    padding: 8px 15px;
    min-height: 44px; /* 更小的导航栏高度 */
  }

  nav ul {
    top: 44px;
    height: calc(100vh - 44px);
  }

  .nav-toggle {
    top: 10px;
    right: 10px;
  }
}

/* Landscape Orientation */
@media (orientation: landscape) and (max-height: 500px) {
  .hero {
    height: 80vh;
  }

  nav ul.active {
    flex-direction: column;
    height: calc(100vh - 48px);
  }
}