/* ==========================================
   1. BASE & HTML/BODY
   ========================================== */
html {
  scroll-behavior: smooth;
}

html,
body {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: #333;
  background-color: #f4f7f9;
}

h5 {
  margin-bottom: 0;
}

/* ==========================================
   2. GLOBAL LAYOUT WRAPPERS
   ========================================== */
.content-wrapper {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.content {
  flex: 1;
}

/* Core Layout Sticky Footer Overrides */
.footer {
  background-color: #04395e;
  color: rgba(255, 255, 255, 0.9);
  /* Slightly softened white reading level */
  text-align: center;
  position: relative;
  bottom: 0;
  width: 100%;
}

/* Ensure font sizes look neat across viewports */
.footer span {
  font-size: 0.9rem;
  letter-spacing: 0.025em;
}

/* NOTE: Avoid overriding the global Bootstrap .container class unless necessary. 
   If you need this specific flex behavior, consider renaming it to .custom-container */
/* 
.container {
    width: auto;
    max-width: 1200px;
    margin: auto;
    flex-grow: 1;
    padding: 20px;
} 
*/

/* ==========================================
   3. NAVBAR
   ========================================== */
.navbar {
  padding: 0.5rem 1rem;
}

.navbar-brand {
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

.navbar-brand:hover {
  opacity: 0.8;
}

.navbar-brand strong {
  color: yellow;
}

.nav-link {
  color: white;
}

/* Show dropdown on hover for desktop screens */
@media (min-width: 992px) {
  /* Keep dropdown parent container relative */
  .navbar .nav-item.dropdown {
    position: relative;
  }

  /* Target dropdown menus on hover */
  .navbar .nav-item.dropdown:hover .dropdown-menu {
    display: block;
    margin-top: 0 !important;
    /* Forces removal of any top margin gap */
    animation: fadeIn 0.15s ease-in-out;
  }

  /* Bridge the gap using a pseudo-element so the mouse never enters a dead zone */
  .navbar .nav-item.dropdown .dropdown-menu::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
  }
}

/* Subtle fade-in animation for smooth feel */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

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

/* Transition icons on hover, but exclude destructive/danger items */
.dropdown-item i {
  transition: color 0.15s ease-in-out;
}

.dropdown-item:not(.text-danger):hover i {
  color: #0056b3 !important;
  /* Brand primary blue for standard links */
}

/* Ensure danger/logout icon remains red on hover */
.dropdown-item.text-danger:hover i {
  color: #dc3545 !important;
  /* Danger red */
}

/* ==========================================
   4. CONTENT CONTAINERS & COMPONENTS
   ========================================== */
.content-container {
  max-width: auto;
  margin: 40px auto;
  padding: 30px;
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
}

.content-container h1 {
  font-size: 2.5em;
  color: #004e92;
  text-align: center;
  margin-bottom: 20px;
}

.content-container h2 {
  font-size: 1.8em;
  color: #333333;
  margin-top: 25px;
  text-align: center;
}

.content-container h3 {
  font-size: 1.4em;
  color: #666666;
  margin-top: 20px;
  text-align: left;
}

.content-container p,
.content-container ul {
  font-size: 1.1em;
  line-height: 1.8;
  color: #555555;
  margin: 15px 0;
}

.content-container ul {
  padding-left: 20px;
  list-style-type: disc;
}

.page-image {
  width: 100%;
  height: auto;
  margin-bottom: 20px;
  border-radius: 10px;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}

/* Solutions Section */
.solution {
  margin: 20px 0;
  padding: 15px;
  background-color: #f8f9fb;
  border-left: 4px solid #004e92;
  border-radius: 8px;
  box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.05);
}

.solution h3 {
  font-size: 1.6em;
  color: #004e92;
  margin-top: 0;
}

.solution-image {
  width: 100%;
  height: auto;
  margin: 15px 0;
  border-radius: 8px;
}

/* ==========================================
   5. FORMS & BUTTONS
   ========================================== */
.cta-button,
.content-container a.btn {
  display: inline-block;
  background-color: #0056b3;
  color: white;
  padding: 10px 20px;
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

.cta-button:hover,
.content-container a.btn:hover {
  background-color: #004494;
  color: white;
}

/* Support & Contact Forms */
.support-contact-form,
.contact-form {
  background-color: #f0f5ff;
  padding: 20px 30px;
  border: 1px solid #cfd9e7;
  border-radius: 8px;
  margin-top: 30px;
}

.support-contact-form h3 {
  font-size: 1.5em;
  color: #333333;
}

.contact-form label {
  display: block;
  font-weight: bold;
  color: #333333;
  margin-top: 10px;
}

.support-contact-form input,
.support-contact-form textarea,
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1em;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: #04395e;
  outline: none;
}

.support-contact-form input[type="submit"],
.contact-form input[type="submit"] {
  background-color: #04395e;
  color: #ffffff;
  font-weight: bold;
  border: none;
  cursor: pointer;
  padding: 12px;
  transition: background-color 0.3s ease;
}

.support-contact-form input[type="submit"]:hover,
.contact-form input[type="submit"]:hover {
  background-color: #0077cc;
}

/* ==========================================
   6. MISCELLANEOUS (Auth, Alerts, Panels)
   ========================================== */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 30px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

.auth-link {
  display: block;
  margin-top: 10px;
  text-align: center;
}

.analytics-panel {
  display: none;
  position: fixed;
  right: 20px;
  bottom: 20px;
  background-color: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  max-width: 300px;
}

.analytics-panel.visible {
  display: block;
}

.disabled-link {
  background-color: gray !important;
  color: white !important;
  border-color: gray !important;
  cursor: not-allowed !important;
}

.click-cursor {
  cursor: pointer;
}

.prevent-select {
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.bg-light-danger {
  background-color: #f8d7da;
  color: #842029;
}

.bg-light-warning {
  background-color: #fff3cd;
  color: #664d03;
}

/* Global Toasts */
#global-toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1080;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.global-toast {
  color: #fff;
  border-radius: 5px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  min-width: 250px;
  max-width: 500px;
  margin-bottom: 0.5rem;
  padding: 0.5rem 1rem;
  animation: slideDown 0.5s ease-out forwards;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toast-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.toast-header {
  font-weight: bold;
  font-size: 0.9rem;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  margin-right: 1rem;

  /* Adds bottom spacing ONLY on mobile so it doesn't collide with the body text below it */
  margin-bottom: 0.5rem;
  display: inline-block;
  background-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.toast-body {
  flex: 1;
  word-break: break-word;
}

/* On desktop, reset the bottom margin back to 0 so it aligns beautifully with the body text */
@media (min-width: 768px) {
  .toast-header {
    margin-bottom: 0;
  }
}

.close-btn {
  background: none !important;
  border: none;
  padding: 0;
  color: inherit;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
}

.close-btn:hover {
  opacity: 1;
}

.global-toast[data-type="error"],
.global-toast[data-type="danger"] {
  background-color: #dc3545;
}

.global-toast[data-type="success"] {
  background-color: #28a745;
}

.global-toast[data-type="warning"] {
  background-color: #ffc107;
  color: #000;
}

.global-toast[data-type="info"] {
  background-color: #17a2b8;
}

@keyframes slideDown {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Back to Top */
.btn-mobile-full {
  width: 100%;
}

.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1050;
  border-radius: 50%;
  padding: 10px 14px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ⏳ Dynamic dimming utility for metadata save operations */
.loading-fade {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.15s ease-in-out;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 255, 255, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

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

/* ==========================================
   7. RESPONSIVE / MEDIA QUERIES
   ========================================== */
@media (min-width: 768px) {
  .btn-mobile-full {
    width: auto;
  }

  .back-to-top {
    bottom: 15px;
    right: 15px;
  }

  .w-md-auto {
    width: auto !important;
  }
}

@media (max-width: 767.98px) {
  .content-container {
    padding: 20px;
    margin: 20px 15px;
    /* Adds breathing room on phone screens */
  }

  .content-container h1 {
    font-size: 2em;
  }

  .content-container h2 {
    font-size: 1.6em;
  }

  .content-container p,
  .content-container ul {
    font-size: 1em;
  }

  .contact-details {
    margin: 20px 0;
    font-size: 1.1em;
    color: #555;
    line-height: 1.6;
  }

  /* Mobile utility classes */
  .w-mobile-100 {
    display: block !important;
    width: 100% !important;
    margin-right: 0 !important;
    margin-bottom: 0.5rem !important;
  }

  .w-mobile-100:last-child {
    margin-bottom: 0 !important;
  }

  .w-mobile-50 {
    width: calc(50% - 0.25rem) !important;
    margin-right: 0 !important;
    margin-bottom: 0.5rem !important;
  }

  .mt-mobile-2 {
    margin-top: 0.5rem !important;
  }

  .mt-mobile-3 {
    margin-top: 1rem !important;
  }

  .px-mobile-0 {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .px-mobile-4 {
    padding-left: 1.6rem !important;
    padding-right: 1.6rem !important;
  }
}

/* Allow flex children containing long text to truncate instead of
   forcing the row to expand. Used for the detail page heading. */
.min-w-0 {
  min-width: 0;
}
