/* Top Bar Styles */
.top-bar {
  background-color: #f8f9fa;
  padding: 5px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  border-bottom: 1px solid #dee2e6;
}

.left-links,
.right-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.left-links a,
.right-links a {
  color: #495057;
  text-decoration: none;
  padding: 2px 5px;
}

.left-links a:hover,
.right-links a:hover {
  text-decoration: underline;
}

/* Override skip-main styling when in top bar */
.top-bar .skip-main {
  position: static;
  background-color: transparent;
  color: #495057;
  padding: 2px 5px;
  border-radius: 0;
  border: none;
  box-shadow: none;
  font-weight: normal;
  z-index: auto;
}

.top-bar .skip-main:hover {
  text-decoration: underline;
  background-color: transparent;
}

.top-bar .skip-main:focus {
  outline: 3px solid #f47920;
  outline-offset: 2px;
}

/* Screen Reader Access link */
.screen-reader {
  color: #495057;
  text-decoration: none;
  padding: 2px 5px;
  cursor: pointer;
}

.screen-reader:hover {
  text-decoration: underline;
}


.language-select {
  padding: 4px 10px;
  border: 1px solid #ced4da;
  border-radius: 3px;
  color: #495057;
  background-color: white;
  cursor: pointer;
  font-size: 13px;
}

/* Contrast Toggle Button */
.contrast-toggle {
  padding: 4px 10px;
  border: 1px solid #ced4da;
  border-radius: 3px;
  background-color: white;
  color: #495057;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.2s;
}

.contrast-toggle:hover {
  background-color: #e9ecef;
}

.contrast-icon {
  font-size: 16px;
  line-height: 1;
}

/* Main Header Styles */
.main-header {
  padding: 15px 20px;
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

.emblem-logo {
  height: 90px;
  width: auto;
}

.ddrc-logo {
  height: 90px;
  width: auto;
}

.header-text {
  flex-grow: 1;
}

.header-text h1 {
  color: var(--primary-color);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.header-text p {
  color: #495057;
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

/* Hide mobile header text on desktop */
.header-title-mobile,
.header-subtitle-mobile {
  display: none;
}



/* Navigation Menu */
.main-nav {
  background-color: var(--primary-color);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-nav a {
  color: white;
  text-decoration: none;
  padding: 15px 20px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.main-nav a:first-child {
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.main-nav a:not(.nav-logout-btn):hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-icon {
  padding: 12px 20px !important;
}

.nav-icon img {
  height: 18px;
  width: auto;
  filter: brightness(0) invert(1);
}

/* Mobile Top Bar - Hidden on Desktop */
.mobile-top-bar {
  display: none;
  background-color: var(--primary-color);
  padding: 8px 15px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mobile-top-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.mobile-top-bar .mobile-contrast-toggle {
  height: 36px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.mobile-top-bar .mobile-contrast-toggle:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.mobile-top-bar .mobile-language-select {
  height: 36px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.2s;
  max-width: 110px;
}

.mobile-top-bar .mobile-language-select:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.mobile-top-bar .mobile-language-select option {
  background-color: var(--primary-color);
  color: white;
}

/* Hamburger Menu Button - Fluid Animation */
.hamburger-menu {
  display: none;
  position: relative;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.hamburger-menu:hover {
  transform: scale(1.05);
}

.hamburger-menu:active {
  transform: scale(0.95);
}

.hamburger-menu span {
  position: absolute;
  right: 0;
  height: 2.5px;
  background-color: #ffffff;
  border-radius: 2px;
  display: block !important;
  opacity: 1;
  transform-origin: center;
  /* Smooth fluid transition with cubic-bezier easing */
  transition:
    top 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.1s,
    width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1) 0.1s;
}

/* Graduated widths - longest to shortest */
.hamburger-menu span:nth-child(1) {
  top: 6px;
  width: 100%;
}

.hamburger-menu span:nth-child(2) {
  top: 14.5px;
  width: 85%;
}

.hamburger-menu span:nth-child(3) {
  top: 23px;
  width: 70%;
}

/* Fluid X animation when active */
.hamburger-menu.active span {
  /* Synchronized smooth transitions */
  transition:
    top 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.1s,
    width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger-menu.active span:nth-child(1) {
  top: 14.5px;
  width: 100%;
  transform: rotate(45deg);
}

.hamburger-menu.active span:nth-child(2) {
  top: 14.5px;
  width: 100%;
  opacity: 0;
  transform: scale(0.5);
}

.hamburger-menu.active span:nth-child(3) {
  top: 14.5px;
  width: 100%;
  transform: rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
  display: block;
  opacity: 1;
}


/* Spacer for navigation - hidden on mobile */
.nav-spacer {
  flex: 1;
}

/* Mobile Menu Header - Hidden on desktop/tablet */
.mobile-menu-header {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  background-color: rgba(0, 0, 0, 0.2);
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.mobile-menu-header h2 {
  color: white;
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.mobile-menu-close {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 4px;
}

.mobile-menu-close:hover {
  transform: rotate(90deg) scale(1.1);
  background-color: rgba(255, 255, 255, 0.1);
}

.mobile-menu-close:active {
  transform: rotate(90deg) scale(0.95);
}

.mobile-menu-close svg {
  width: 24px;
  height: 24px;
  transition: stroke-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-close:hover svg {
  stroke-width: 2.5;
}

/* Mobile Accessibility Controls - At bottom of menu */
.mobile-accessibility-controls {
  display: none;
  padding: 15px 15px;
  background-color: rgba(0, 0, 0, 0.1);
  border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.mobile-contrast-btn {
  width: 100%;
  padding: 14px 16px;
  background-color: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: white;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background-color 0.2s;
}

.mobile-contrast-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.mobile-contrast-btn .contrast-icon {
  font-size: 18px;
}

/* Mobile-only navigation items - Hidden on desktop/tablet */
.mobile-only-nav {
  display: none !important;
}

.mobile-menu-divider {
  display: none;
}

/* Language selector in mobile menu */
.language-selector-mobile {
  display: none;
  padding: 15px 25px;
  background-color: rgba(255, 255, 255, 0.05);
}

.language-selector-mobile label {
  color: white;
  font-size: 14px;
  font-weight: 500;
  margin-right: 10px;
}

.language-selector-mobile select {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 14px;
  cursor: pointer;
  flex: 1;
  min-width: 120px;
}

.language-selector-mobile select option {
  background-color: var(--primary-color);
  color: white;
}

/* Tablet Responsive Design (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 768px) {
  .top-bar {
    padding: 5px 15px;
    font-size: 12px;
  }

  .left-links,
  .right-links {
    gap: 15px;
  }

  .logo-section {
    gap: 20px;
    padding: 0 10px;
  }

  .emblem-logo,
  .ddrc-logo {
    height: 75px;
  }

  .header-text h1 {
    font-size: 22px;
  }

  .header-text p {
    font-size: 13px;
  }

  .main-nav {
    flex-wrap: nowrap;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
  }

  /* Hide scrollbar for Chrome, Safari and Opera */
  .main-nav::-webkit-scrollbar {
    display: none;
  }

  .main-nav a {
    padding: 12px 12px;
    font-size: 12px;
    flex-shrink: 0;
  }

  .nav-icon {
    padding: 10px 12px !important;
  }

  .nav-icon img {
    height: 16px;
  }

  .nav-login-btn,
  .nav-logout-btn {
    padding: 12px 15px;
    font-size: 12px;
  }
}

/* Mobile Responsive Design (â‰¤767px) */
@media (max-width: 767px) {

  /* Show mobile top bar */
  .mobile-top-bar {
    display: flex !important;
  }

  /* Show hamburger button on mobile */
  .hamburger-menu {
    display: block !important;
  }

  /* Hide desktop top bar on mobile */
  .top-bar {
    display: none;
  }

  /* Main Header - Reorganized Layout */
  .main-header {
    padding: 12px 15px;
  }

  /* Logo Section - Horizontal with grouped emblem + text */
  .logo-section {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
  }

  .emblem-logo {
    height: 60px;
    order: 1;
    flex-shrink: 0;
  }

  .header-text {
    order: 2;
    flex: 1;
    text-align: left;
    min-width: 0;
  }

  .ddrc-logo {
    height: 60px;
    order: 3;
    flex-shrink: 0;
  }

  /* Hide desktop header text on mobile */
  .header-title-desktop,
  .header-subtitle-desktop {
    display: none;
  }

  /* Show mobile header text */
  .header-title-mobile,
  .header-subtitle-mobile {
    display: block;
  }

  .header-title-mobile {
    font-size: 16px;
    line-height: 0.8;
    font-weight: 600;
    color: var(--primary-color);
  }

  .header-subtitle-mobile {
    font-size: 9px;
    line-height: 1.3;
    margin: 0;
    color: #495057;
  }

  /* Navigation - Transform to Mobile Menu */
  .main-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background-color: var(--primary-color);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    transition: right 0.3s ease;
    z-index: 10000;
    overflow-y: auto;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
  }

  .main-nav.active {
    right: 0;
  }

  /* Show mobile menu header */
  .mobile-menu-header {
    display: flex !important;
  }

  /* Show mobile accessibility controls */
  .mobile-accessibility-controls {
    display: block !important;
  }

  .main-nav a {
    padding: 16px 25px;
    font-size: 15px;
    border-right: none;
    border-left: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: normal;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    /* Touch-friendly */
  }

  .main-nav a:first-child {
    border-left: none;
    border-top: none;
  }

  .main-nav a:last-child {
    border-bottom: none;
  }

  .nav-icon {
    padding: 16px 25px !important;
    justify-content: flex-start;
  }

  .nav-icon img {
    height: 20px;
  }

  /* Login/Logout buttons in mobile menu */
  .nav-login-btn,
  .nav-logout-btn {
    margin: 10px 15px;
    border-radius: 6px;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  .nav-logout-btn {
    background-color: #e06810;
    margin-top: auto;
  }

  /* User email in mobile menu */
  .nav-user-email {
    display: block;
    text-align: center;
    margin: 10px 15px;
    padding: 10px 15px;
    font-size: 14px;
    max-width: none;
  }

  .nav-login-btn {
    background-color: rgba(255, 255, 255, 0.1);
  }

  .nav-login-btn:hover,
  .nav-login-btn:active {
    background-color: rgba(255, 255, 255, 0.2) !important;
  }

  /* Spacer pushes logout to bottom */
  .nav-spacer {
    flex: 1;
    min-height: 20px;
  }

  /* Show mobile-only navigation items in mobile menu */
  .mobile-only-nav {
    display: flex !important;
    padding: 14px 25px;
    font-size: 14px;
    color: white;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    align-items: center;
    gap: 10px;
    min-height: 44px;
  }

  .mobile-only-nav:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }

  /* Language selector in mobile menu */
  .language-selector-mobile {
    display: flex !important;
    align-items: center;
    flex-wrap: wrap;
  }

  /* Mobile menu divider */
  .mobile-menu-divider {
    display: block;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0;
    border: none;
  }

  /* External Link Modal - Mobile Optimized */
  .external-modal-content {
    width: 95%;
    margin: 20px;
  }

  .external-modal-header {
    padding: 18px 20px;
  }

  .external-modal-header h3 {
    font-size: 16px;
  }

  .external-modal-body {
    padding: 20px;
  }

  .external-modal-body p {
    font-size: 14px;
  }

  .external-modal-body .external-url {
    font-size: 12px;
    padding: 12px;
  }

  .external-modal-footer {
    padding: 15px 20px;
    flex-direction: column-reverse;
  }

  .modal-btn {
    width: 100%;
    padding: 12px;
  }
}

/* Extra Small Mobile (â‰¤480px) */
@media (max-width: 480px) {
  .top-bar {
    font-size: 10px;
  }

  .header-text h1 {
    font-size: 16px;
  }

  .header-text p {
    font-size: 11px;
  }

  .emblem-logo,
  .ddrc-logo {
    height: 50px;
  }

  .main-nav {
    width: 100%;
    right: -100%;
  }

  .main-nav.active {
    right: 0;
  }
}

/* Prevent body scroll when mobile menu is open */
body.menu-open {
  overflow: hidden;
}

/* Logout button styles */
.nav-logout-btn {
  color: white;
  text-decoration: none;
  padding: 8px 20px;
  background-color: #e06810;
  border-radius: 0;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.nav-logout-btn img {
  filter: brightness(0) invert(1);
}

/* Gradient sweep animation */
.nav-logout-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(120deg,
      transparent 0%,
      rgba(255, 255, 255, 0.3) 50%,
      transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.5s ease-out;
}

.nav-logout-btn:hover::before {
  transform: translateX(100%);
}

.nav-logout-btn:hover {
  background-color: #e06810 !important;
  color: white;
}

/* User email display in navigation */
.nav-user-email {
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  padding: 8px 15px;
  padding-left: 15px;
  white-space: nowrap;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 15px;
  border-left: 2px solid rgba(255, 255, 255, 0.3);
  font-weight: 400;
}

/* Divyangjan login button styles */
.main-nav a.nav-login-btn[href="/login"] {
  position: relative;
  overflow: hidden;
  background-color: var(--primary-color) !important;
  transition: none !important;
}

/* Override all hover states */
.main-nav a.nav-login-btn[href="/login"]:hover,
.main-nav a.nav-login-btn[href="/login"]:active,
.main-nav a.nav-login-btn[href="/login"]:focus {
  background-color: var(--primary-color) !important;
}

.main-nav a.nav-login-btn[href="/login"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  /* Extend much further */
  width: 200%;
  /* Double width to ensure coverage */
  height: 100%;
  background: linear-gradient(120deg,
      transparent 0%,
      rgba(255, 255, 255, 0.2) 50%,
      transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.main-nav a.nav-login-btn[href="/login"]:hover::before {
  transform: translateX(100%);
}

/* Department login button - keep original transition */
.main-nav a.nav-login-btn[href="/department-login"] {
  transition: background-color 0.3s ease;
}

/* External Link Modal Styles - Government Portal Theme */
.external-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.external-modal-content {
  background: white;
  border-radius: 0;
  max-width: 580px;
  width: 90%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border-top: 4px solid #00205b;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(40px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.external-modal-header {
  padding: 22px 30px;
  background: #00205b;
  border-bottom: 2px solid #f47920;
}

.external-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}

.external-modal-header h3::before {
  content: '⚠️';
  font-size: 16px;
}

.external-modal-body {
  padding: 30px;
  background: white;
}

.external-modal-body p {
  margin: 0 0 18px 0;
  font-size: 15px;
  line-height: 1.6;
  color: #333;
}

.external-modal-body p:first-child {
  font-weight: 600;
  color: #00205b;
  margin-bottom: 14px;
}

.external-modal-body p:last-child {
  margin-bottom: 0;
  font-size: 14px;
  color: #555;
  font-style: italic;
}

.external-modal-body .external-url {
  background-color: #f8f9fa;
  padding: 14px 16px;
  border-radius: 0;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #00205b;
  word-break: break-all;
  border: 1px solid #dee2e6;
  border-left: 4px solid #00205b;
  font-weight: 600;
  margin: 18px 0;
}

.external-modal-footer {
  padding: 20px 30px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
}

.modal-btn {
  padding: 11px 28px;
  border: none;
  border-radius: 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-btn-secondary {
  background-color: #6c757d;
  color: white;
}

.modal-btn-secondary:hover {
  background-color: #5a6268;
}

.modal-btn-primary {
  background-color: #00205b;
  color: white;
}

.modal-btn-primary:hover {
  background-color: #003a7a;
}

@media (max-width: 576px) {
  .external-modal-content {
    width: 95%;
    margin: 20px;
  }

  .external-modal-header {
    padding: 20px 24px;
  }

  .external-modal-header h3 {
    font-size: 17px;
  }

  .external-modal-body {
    padding: 24px;
  }

  .external-modal-body p {
    font-size: 14px;
  }

  .external-modal-body .external-url {
    font-size: 13px;
    padding: 12px 14px;
  }

  .external-modal-footer {
    padding: 16px 24px;
    flex-direction: column-reverse;
  }

  .modal-btn {
    width: 100%;
    padding: 13px;
  }
}