/* Custom styles for IOMR Class replica enhancements & complete responsiveness */
:root {
  --primary: #063b5c;
  --primary-dark: #04253a;
  --primary-light: #0d5a8a;
  --primary-50: #f2f8fc;
  --accent: #2563eb;
}

/* Global Responsive Base */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  overflow-x: hidden;
  width: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

/* Fluid image, svg, and media responsiveness */
img, svg, video, canvas, audio, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* Prevent long strings, emails, and links from breaking horizontal viewport on mobile */
a, p, span, h1, h2, h3, h4, h5, h6, address, td, th {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Mobile Drawer */
#mobile-menu {
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, visibility 0.3s;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#mobile-menu.open {
  max-height: 85vh;
  opacity: 1;
  visibility: visible;
}

/* Hamburger icon animation */
.hamburger-line {
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}

.hamburger-active .line-1 {
  transform: translateY(8px) rotate(45deg);
}

.hamburger-active .line-2 {
  opacity: 0;
}

.hamburger-active .line-3 {
  transform: translateY(-8px) rotate(-45deg);
}

/* Floating Back to top button */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 16px;
  width: 42px;
  height: 42px;
  background-color: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(6, 59, 92, 0.25);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 40;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.25);
  touch-action: manipulation;
}

@media (min-width: 640px) {
  .back-to-top {
    bottom: 28px;
    right: 28px;
    width: 48px;
    height: 48px;
  }
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: #084c77;
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(6, 59, 92, 0.35);
}

/* Active Nav Link indicator */
.nav-link.active {
  color: #0b4970;
  position: relative;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary);
  border-radius: 2px;
}

/* Interactive Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.65);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #ffffff;
  border-radius: 12px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(6, 59, 92, 0.25);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 440px;
  pointer-events: none;
}

.toast {
  background: #063b5c;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  font-size: 13.5px;
  line-height: 1.4;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* iOS Safari Input auto-zoom fix & touch target improvements */
@media (max-width: 767px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="search"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Responsive buttons touch states & minimum touch target sizes */
button, a {
  -webkit-tap-highlight-color: transparent;
}

#mobile-menu a,
#mobile-menu-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Responsive Table Wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

/* Clean custom scrollbar for horizontal containers */
.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(6, 59, 92, 0.2);
  border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 59, 92, 0.4);
}
