﻿*,
*::before,
*::after {
  box-sizing: border-box;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

:root {
  /* Modern Government Palette */
  --primary-color: #1a237e; /* Deep Navy Blue */
  --primary-gradient: linear-gradient(135deg, #1a237e 0%, #283593 100%);
  --secondary-color: #f57c00; /* Vibrant Orange/Gold */
  --secondary-gradient: linear-gradient(135deg, #f57c00 0%, #ff9800 100%);
  --accent-green: #2e7d32; /* Success Green */

  /* Backgrounds */
  --bg-body: #f4f7f6; /* Cool Light Grey */
  --bg-surface: #ffffff;
  --bg-sidebar: #ffffff;

  /* Text */
  --text-main: #2c3e50;
  --text-muted: #607d8b;
  --text-light: #ffffff;

  /* Borders & Shadows */
  --border-color: #e0e0e0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 12px 32px rgba(26, 35, 126, 0.15);

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  position: relative; /* Ensure body is relative for absolute children if any */
}

/* --- Header --- */
header {
  background: var(--primary-gradient);
  color: var(--text-light);
  padding: 15px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1150;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px); /* Glass effect if supported */
}

.header-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-emblem {
  height: 60px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  background-color: transparent;
}

.header-logo {
  height: 50px;
  width: 50px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* --- Controls --- */
.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.language-dropdown {
  background-color: rgba(255, 255, 255, 0.15);
  color: white;
  padding: 8px 16px;
  outline: none;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Poppins', sans-serif;
  transition: var(--transition);
}

.language-dropdown:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5); /* Subtle focus ring for accessibility */
}

.language-dropdown:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

.language-dropdown option {
  background-color: var(--primary-color);
  color: white;
}

.menu-toggle {
  display: block; /* Show on all screens */
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 24px;
  color: white;
  margin-right: 15px; /* Adds space between bars and emblem */
}

/* --- Layout --- */
.container {
  display: flex;
  width: 100%;
  margin-top: 85px; /* Matches header height */
  min-height: calc(100vh - 85px);
  overflow-x: hidden; /* Prevent horizontal scroll from any stray elements */
}

/* --- Sidebar --- */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  padding: 30px 20px;
  /* Fixed sidebar that stays in place */
  position: fixed;
  top: 85px;
  left: 0;
  height: calc(100vh - 85px);
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 1200; /* Above Header (1000) and Content */
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.03);
  border-right: 1px solid var(--border-color);
}

.sidebar.hidden {
  transform: translateX(-260px); /* Hide completely on desktop */
}

/* Custom Thin Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-muted);
}

.sidebar ul {
  list-style: none;
}

.sidebar ul li {
  margin-bottom: 8px;
}

.sidebar ul li a {
  color: var(--text-muted);
  text-decoration: none;
  display: flex; /* Use flex for icon alignment */
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  /* Tab style: rounded with transparent left border */
  border-radius: var(--radius-md);
  border-left: 5px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  font-size: 15px;
}

.sidebar ul li a:hover {
  background-color: #e8eaf6; /* Light indigo tint */
  color: var(--primary-color);
  border-left-color: var(--secondary-color); /* Orange border on hover */
  transform: translateX(5px);
}

.sidebar ul li a.active {
  background: var(--primary-gradient);
  color: var(--text-light);
  border-left-color: var(--secondary-color); /* Orange border on active */
  box-shadow: 0 4px 12px rgba(26, 35, 126, 0.3);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 85px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  z-index: 998;
}

.sidebar-overlay.active {
  display: block;
}

/* --- Content Content --- */
.content {
  flex: 1;
  min-width: 0; /* Ensures content can shrink and wrap nested items */
  margin-left: 260px; /* Restore margin for fixed sidebar */
  padding: 40px;
  min-height: calc(100vh - 85px); /* Ensure content pushes footer down */
  transition: margin-left 0.3s ease;
  position: relative;
  z-index: 950;
  box-sizing: border-box;
}

.content.full-width {
  margin-left: 0;
}

.section {
  display: none;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section.active {
  display: block;
}

h1 {
  color: var(--primary-color);
  margin-bottom: 30px;
  font-size: 28px;
  font-weight: 700;
  position: relative;
  display: inline-block;
}

h1::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 60px;
  height: 4px;
  background: var(--secondary-gradient);
  border-radius: 2px;
}

/* --- Hero Image --- */
.ram-image {
  width: 100%;
  height: 350px; /* Fixed height for consistency */
  border-radius: var(--radius-lg);
  display: block;
  margin-bottom: 40px;
  box-shadow: var(--shadow-md);
  object-fit: cover;
  transition: transform 0.5s ease;
}

.ram-image:hover {
  transform: scale(1.01);
}

/* --- News Slider --- */
.news-slider {
  background: var(--bg-surface);
  padding: 30px 0; /* Remove side padding to fix overflow mask */
  border-radius: var(--radius-md);
  margin-top: 40px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
  height: auto;
  min-height: 160px;
  border: 1px solid var(--border-color);
  border-left: 6px solid var(--secondary-color);
}

.news-slider h3 {
  color: var(--primary-color);
  margin-bottom: 20px;
  padding: 0 30px; /* Restore side padding for Title */
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
}

.news-items-wrapper {
  display: flex;
  width: 100%;
  transition: transform 0.6s ease-in-out;
}

.news-item {
  flex: 0 0 100%;
  max-width: 100%;
  font-size: 16px;
  color: var(--text-main);
  padding: 0 30px; /* Restore side padding for Content */
}

.news-item strong {
  color: var(--secondary-color);
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

/* --- Administrative Sections --- */
.admin-section,
.services-section {
  margin-top: 50px;
  text-align: center;
}

.admin-section h3,
.services-section h3 {
  color: var(--primary-color);
  margin-bottom: 30px;
  font-size: 24px;
  font-weight: 700;
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
}

.admin-section h3::after,
.services-section h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: var(--secondary-gradient);
  border-radius: 2px;
}

.officials-grid {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap !important;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 30px;
  padding: 0 15px;
  box-sizing: border-box;
}

.official-card {
  text-align: center;
  background: var(--bg-surface);
  padding: 25px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 280px;
  flex: 0 1 280px; /* Base width of 280px, allow shrinking, don't grow */
  transition: var(--transition);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.official-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--primary-gradient);
}

.official-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: var(--secondary-color);
}

.official-photo {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  margin: 0 auto 20px;
  display: block;
  object-fit: cover;
  border: 4px solid var(--bg-body);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.4s ease;
}

.official-card:hover .official-photo {
  transform: scale(1.05);
  border-color: var(--secondary-color);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.official-card h4 {
  margin-bottom: 5px;
  color: var(--secondary-color);
  font-size: 14px;
  font-weight: 500;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.official-card p {
  color: var(--primary-color);
  font-size: 16px;
  font-weight: 700;
}

/* --- Services Grid --- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 25px;
  max-width: 1200px;
  margin: 0 auto 50px;
  padding: 0 20px;
}

.service-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.service-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  transition: var(--transition);
}

.service-card:hover img {
  transform: scale(1.1);
}

.service-label {
  padding: 15px;
  text-align: center;
  background: var(--bg-surface);
  color: var(--primary-color);
  font-weight: 600;
  font-size: 16px;
  border-top: 1px solid var(--border-color);
}

/* --- About & Charts --- */
.about-intro {
  background: var(--bg-surface);
  padding: 40px;
  border-radius: var(--radius-md);
  margin-bottom: 40px;
  box-shadow: var(--shadow-sm);
  line-height: 1.8;
  color: var(--text-main);
  border-left: 4px solid var(--primary-color);
}

.chart-container,
.table-container {
  background: var(--bg-surface);
  padding: 30px;
  border-radius: var(--radius-md);
  margin-bottom: 40px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.chart-container h3,
.table-container h3 {
  color: var(--primary-color);
  margin-bottom: 25px;
  text-align: center;
  font-size: 20px;
}

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

table thead {
  background-color: #e8eaf6;
  color: var(--primary-color);
}

table th,
table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 15px;
}

table th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 1px;
}

table tbody tr:hover {
  background-color: #f5f5f5;
}

/* --- Village Charts --- */
.village-charts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
}

.chart-box {
  background: white;
  padding: 25px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  text-align: center;
  /* Critical for Chart.js responsiveness */
  position: relative;
  height: 350px;
  width: 100%;
  overflow: hidden;
}

.chart-box h3 {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-size: 18px;
}

/* Population Chart Specifics */
.chart-container {
  background: white;
  padding: 30px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-width: 500px;
  margin: 0 auto 40px;
  border: 1px solid var(--border-color);
  /* Critical for Chart.js responsiveness */
  position: relative;
  height: auto; /* Allow height to adjust */
  width: 100%;
  overflow: hidden;
}

/* --- Works Cards --- */
.work-item {
  background: var(--bg-surface);
  padding: 0; /* Remove padding to let image flush */
  border-radius: var(--radius-md);
  margin-bottom: 40px;
  box-shadow: var(--shadow-sm);
  display: flex;
  overflow: hidden; /* For image curve */
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.work-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.work-photo {
  width: 350px;
  height: 250px;
  object-fit: cover;
  flex-shrink: 0;
}

.work-description {
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.work-description strong {
  font-size: 20px;
  color: var(--primary-color);
  margin-bottom: 10px;
  display: block;
}

/* --- Schemes --- */
.schemes-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
  width: 100%; /* Ensure full width */
}

.scheme-item {
  background: var(--bg-surface);
  padding: 30px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border-top: 4px solid var(--secondary-color);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.scheme-item:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.scheme-item h4 {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-size: 18px;
  font-weight: 600;
  flex-grow: 1;
}

.scheme-item a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  margin-top: 15px;
  padding: 10px 24px;
  background: var(--secondary-gradient);
  border-radius: 50px;
  transition: var(--transition);
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(245, 124, 0, 0.3);
}

.scheme-item a:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(245, 124, 0, 0.4);
}

/* --- Documents --- */
.documents-container {
  background: var(--bg-surface);
  padding: 40px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--accent-green);
}

.documents-container ol {
  margin-left: 20px;
  line-height: 2.2;
}

.documents-container li {
  padding-left: 10px;
}

.documents-container li::marker {
  color: var(--accent-green);
  font-weight: 800;
}

/* --- Tourist & Contact --- */
.tourist-description,
.contact-container,
.video-container {
  background: var(--bg-surface);
  padding: 30px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
}

.gallery-item {
  background: var(--bg-surface);
  padding: 20px;
  border-radius: var(--radius-md);
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.gallery-photo {
  width: 100%;
  height: 350px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  margin-bottom: 20px;
}

/* --- Contact Section Redesign --- */
.contact-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.social-links {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  flex-wrap: nowrap; /* Keep icons side-by-side */
  flex-direction: row;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #f0f2f5;
  color: var(--primary-color);
  transition: var(--transition);
  text-decoration: none;
}

.social-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.social-link.instagram:hover {
  background: #e1306c;
  color: white;
}

.social-link.facebook:hover {
  background: #1877f2;
  color: white;
}

/* Left Column: Info & Map */
.contact-info-col {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.contact-card {
  background: var(--bg-surface);
  padding: 30px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
}

.contact-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 20px;
  font-size: 15px;
  color: var(--text-main);
}

.contact-icon {
  font-size: 22px;
  color: var(--secondary-color);
  min-width: 30px;
}

.contact-label {
  display: block;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 4px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.social-link.youtube {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  color: #ff0000; /* normal icon color */
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

.social-link.youtube:hover {
  background: #ff0000; /* red background */
  color: #ffffff; /* white icon */
}

.map-container-frame {
  background: var(--bg-surface);
  padding: 10px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  height: 300px;
  overflow: hidden;
}

.map-container-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius-sm);
}

/* Right Column: Form */
.contact-form-container {
  background: var(--bg-surface);
  padding: 40px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); /* Slightly stronger shadow for form */
  border: 1px solid var(--border-color);
  height: fit-content;
}

.contact-form-container h3 {
  color: var(--primary-color);
  margin-bottom: 25px;
  font-size: 22px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 15px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-main);
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  transition: var(--transition);
  background-color: #fafafa;
}

.form-control:focus {
  border-color: var(--secondary-color);
  outline: none;
  background-color: white;
  box-shadow: 0 0 0 3px rgba(245, 124, 0, 0.1);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* --- Footer --- */
/* --- Footer --- */
.main-footer {
  background: var(--primary-gradient);
  color: white;
  margin-top: 0;
  margin-left: 260px; /* Aligns with content/sidebar */
  transition:
    margin-left 0.3s ease,
    width 0.3s ease;
  padding: 60px 40px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 1100; /* Ensure it sits ON TOP of the fixed sidebar */
}

.main-footer.full-width {
  margin-left: 0;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-col h3 {
  font-size: 18px;
  margin-bottom: 20px;
  position: relative;
  padding-bottom: 10px;
}

.footer-col h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--secondary-color);
  border-radius: 2px;
}

.footer-links {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* Two columns for links */
  gap: 10px;
}

.footer-links li a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 14px;
  transition: var(--transition);
  cursor: pointer;
  display: block;
}

.footer-links li a:hover {
  color: var(--secondary-color);
  transform: translateX(5px);
}

.footer-socials {
  display: flex;
  gap: 15px;
}

.footer-socials .social-link {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  width: 45px;
  height: 45px;
}

.footer-socials .social-link:hover {
  background: white;
  color: var(--primary-color);
}

.footer-bottom {
  margin-top: 50px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}

.btn-submit {
  width: 100%;
  padding: 14px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 50px; /* Pill shape */
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(26, 35, 126, 0.3);
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(26, 35, 126, 0.4);
  background: linear-gradient(135deg, #283593 0%, #1a237e 100%);
}

/* Responsive adjustments */
/* --- Responsive & Overflow Fixes --- */
img,
iframe,
video,
canvas {
  max-width: 100%;
  height: auto;
  display: block; /* Removes bottom gap */
}

/* Ensure grids don't overflow small screens */
.schemes-container,
.village-charts,
.contact-wrapper,
.officials-section,
.news-items-wrapper {
  box-sizing: border-box;
}

/* Base Responsive Card Widths */
.official-card {
  flex: 0 1 280px;
}

/* Responsive Tables */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

/* === Tablet & Laptop (1024px and below) === */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed; /* Revert to fixed for overlay */
    left: 0;
    top: 0;
    height: 100vh;
    width: 250px;
    transform: translateX(-100%);
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
  }
  .sidebar.active {
    transform: translateX(0);
  }
  .content {
    margin-left: 0; /* Reset margin for mobile */
    width: 100%;
    padding: 30px;
  }
  .menu-toggle {
    display: block;
    color: var(--text-light);
  }
  .main-footer {
    margin-left: 0;
  }
}

/* Map Link Styling */
.map-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}
.map-link:hover {
  color: var(--secondary-color);
  text-decoration: underline;
}

/* === Mobile Landscape & Tablets (768px and below) === */
@media (max-width: 768px) {
  .header-content {
    gap: 15px;
  }
  .header-logo {
    height: 40px; /* Reduced for better mobile fit */
    width: auto;
  }
  .header-title {
    font-size: 16px; /* Reduced to prevent wrapping */
    white-space: nowrap; /* Keep title on one line if possible, or allow controlled wrap */
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Stack Grids */
  .contact-wrapper {
    grid-template-columns: 1fr;
    gap: 30px;
    justify-items: center; /* Center grid items */
    text-align: center;
  }

  /* Center individual contact items */
  .contact-detail-item {
    justify-content: center;
  }

  .officials-section,
  .schemes-container,
  .village-charts {
    justify-content: center;
  }

  .official-card {
    max-width: 100%; /* Full width on smaller screens */
    margin: 0 auto;
  }

  .work-item {
    flex-direction: column;
    align-items: center; /* Center flex items */
    text-align: center; /* Center text */
  }
  .work-photo {
    width: 100%;
    height: 250px;
  }

  .section {
    padding-bottom: 60px;
  }

  .gallery-photo {
    height: 250px;
  }

  /* Footer Centering */
  .footer-content {
    justify-items: center;
    text-align: center;
  }

  .footer-col h3::after {
    left: 50%;
    transform: translateX(-50%);
  }

  .footer-socials {
    justify-content: center;
  }

  /* Adjust Chart Sizes */
  .chart-container {
    padding: 15px;
  }
}

/* === Mobile Portrait (480px and below) === */
@media (max-width: 480px) {
  header {
    padding: 12px 15px;
  }

  .content {
    padding: 15px;
  }

  h1 {
    font-size: 24px;
    margin-bottom: 20px;
  }

  .gram-image {
    height: 200px;
    margin-bottom: 25px;
  }

  .news-slider {
    padding: 20px 0;
  }
  .news-slider h3 {
    padding: 0 15px;
    font-size: 18px;
  }
  .news-item {
    padding: 0 15px;
    font-size: 14px;
  }

  /* Force single column for charts/schemes */
  .schemes-container {
    grid-template-columns: 1fr;
  }
  .village-charts {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .chart-box,
  .scheme-item,
  .official-card,
  .contact-card,
  .contact-form-container {
    padding: 20px 15px;
  }

  .map-container-frame {
    height: 250px;
  }

  /* Tables */
  table th,
  table td {
    padding: 10px;
    font-size: 13px;
  }

  /* Contact Form */
  .btn-submit {
    width: 100%;
    padding: 12px;
  }

  /* Footer Mobile Fixes */
  .main-footer {
    margin-left: -15px; /* Matches mobile content padding */
    margin-right: -15px;
    margin-bottom: -15px;
    padding: 40px 20px;
  }

  .footer-links {
    grid-template-columns: 1fr; /* Single column links on small screens */
  }
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background-color: var(--bg-surface);
  padding: 30px;
  border: 1px solid var(--border-color);
  width: 80%;
  max-width: 600px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* animation: slideDown 0.4s ease-out; */
  color: var(--text-main);
  line-height: 1.6;
}

/* @keyframes slideDown {
  from { transform: translateY(-30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
} */

.close-btn {
  color: #aaa;
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: var(--transition);
}

.close-btn:hover,
.close-btn:focus {
  color: var(--secondary-color);
  text-decoration: none;
}

.modal-title {
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: 24px;
  border-bottom: 2px solid var(--secondary-color);
  padding-bottom: 10px;
  display: inline-block;
}

.modal-body {
  max-height: 60vh; /* Limits the height of the modal body to 60% of viewport height */
  overflow-y: auto; /* Adds a vertical scrollbar if content overflows */
  padding-right: 15px; /* Adds a little space for the scrollbar */
}

/* Custom Thin Scrollbar for Modal Body to match Sidebar */
.modal-body::-webkit-scrollbar {
  width: 4px;
}
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-muted);
}

.modal-body ul {
  padding-left: 20px;
  margin-bottom: 15px;
}

.modal-body li {
  margin-bottom: 8px;
}

.modal-body strong {
  color: var(--primary-color);
}
