/* ========================================
   Base Styles
   ======================================== */

body {
  background-color: #eee;
}

body.loggedin-user .header-container {
  border-top: 5px solid green;
}

.container {
  background-color: white;
  padding: 30px 30px 15px;
}

div.login-page {
  box-shadow: 1px 1px 1px #000;
}

.menu-row {
  justify-content: flex-end;
}

/* ========================================
   Buttons
   ======================================== */

.tableeditbtn {
  background-color: gray;
  margin: 10px;
  color: white;
  font-weight: 700;
}

.tableeditbtn:hover {
  background-color: gray;
  color: white;
  font-weight: 700;
}

.tableeditbtn img {
  width: 20px;
  padding-bottom: 4px;
}

.btnsearch,
.tableeditbtnsecond {
  outline: 2px solid #363986;
  background-color: #363986;
  color: white;
  font-weight: 700;
}

.tableeditbtnsecond img {
  width: 20px;
  padding-bottom: 3px;
}

/* ========================================
   Accessibility Improvements
   ======================================== */

/* WCAG 2.1 AA Compliant Focus Indicators */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
.btn:focus {
  outline: 3px solid #4A90E2;
  outline-offset: 2px;
}

*:focus-visible {
  outline: 3px solid #4A90E2;
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px 16px;
  z-index: 100;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
}

/* Required field indicator */
.required {
  color: #dc3545;
  font-weight: bold;
  margin-left: 2px;
}

/* Form validation states */
.form-control.is-invalid,
.form-select.is-invalid {
  border-color: #dc3545;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-valid,
.form-select.is-valid {
  border-color: #28a745;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.invalid-feedback,
.valid-feedback {
  display: none;
  margin-top: 0.25rem;
  font-size: 0.875em;
}

.form-control.is-invalid ~ .invalid-feedback,
.form-select.is-invalid ~ .invalid-feedback {
  display: block;
  color: #dc3545;
}

.form-control.is-valid ~ .valid-feedback,
.form-select.is-valid ~ .valid-feedback {
  display: block;
  color: #28a745;
}

/* ========================================
   Tables
   ======================================== */

.table-bordered > thead > tr > th,
.table-bordered > tbody > tr > th,
.table-bordered > tfoot > tr > th,
.table-bordered > thead > tr > td,
.table-bordered > tbody > tr > td,
.table-bordered > tfoot > tr > td {
  border: 1px solid #dddddd;
  border-right-width: 0px;
  border-left-width: 0px;
  border-top-width: 0px;
}

/* ========================================
   Error Messages
   ======================================== */

.error p {
  color: #ff0000;
  font-size: 20px;
  font-weight: bold;
  margin: 50px;
}

/* ========================================
   Footer
   ======================================== */

footer.container {
  background-color: #dedee0;
  padding: 15px 30px;
}

footer.container,
footer.container p {
  font-size: 14px;
}

/* ========================================
   Images
   ======================================== */

img {
  max-width: 100%;
}

/* ========================================
   Navigation & Dropdown
   ======================================== */

.dropdown-menu {
  right: 0;
  left: auto;
}

.dropdown-menu.show {
  position: absolute;
}

.navbar-collapse {
  padding-left: 5px;
}

/* ========================================
   Responsive Design & Mobile Optimization
   ======================================== */

/* Large devices (tablets and below) */
@media (max-width: 992px) {
  .menu-row {
    width: 100%;
    display: block;
  }

  .dropdown.float-end {
    text-align: right;
  }
}

/* Medium devices (tablets and phones) */
@media (max-width: 767.98px) {
  /* Fix dropdown positioning on mobile */
  .dropdown-menu.show {
    left: auto;
    right: 0;
  }

  .navbar-collapse {
    padding-left: 5px;
  }

  .menu-row {
    width: 100%;
    display: block;
  }

  .menu.float-start {
    width: auto;
  }

  .dropdown.float-end {
    width: auto;
  }

  /* Mobile touch targets - minimum 44x44px */
  .btn {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 16px;
    font-size: 16px; /* Prevents iOS zoom */
  }

  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    min-height: 44px;
    font-size: 16px; /* Prevents iOS zoom */
  }

  input[type="checkbox"],
  input[type="radio"] {
    width: 24px;
    height: 24px;
    margin: 10px;
  }

  /* Improve link touch targets */
  a {
    padding: 4px;
    margin: -4px;
  }

  /* Responsive tables */
  .table-responsive-stack table {
    border: 0;
  }

  .table-responsive-stack table thead {
    display: none;
  }

  .table-responsive-stack table tr {
    display: block;
    margin-bottom: 1.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .table-responsive-stack table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: none;
    border-bottom: 1px solid #dee2e6;
    min-height: 44px;
  }

  .table-responsive-stack table td:last-child {
    border-bottom: 0;
  }

  .table-responsive-stack table td::before {
    content: attr(data-label);
    font-weight: 600;
    margin-right: 1rem;
    flex-shrink: 0;
    color: #495057;
  }

  img.footer-logo {
    max-width: 25%;
  }

  .right-footer img {
    max-width: 75%;
  }

  footer.container {
    padding: 15px;
  }

  footer.container .float-start .text-muted p br {
    display: none;
  }
}

/* Small devices (phones) */
@media (max-width: 575.98px) {
  .container {
    padding: 15px 15px 5px;
  }

  .footer-logo {
    padding: 0;
    margin: 0 auto;
  }

  img.footer-logo {
    max-width: 25%;
  }

  .footer .float-start {
    text-align: center;
  }

  .right-footer .text-end {
    text-align: center;
  }

  .p-5,
  .ps-3 {
    padding: 0;
  }
}

/* ========================================
   Loading Spinner - Modern UI/UX Design
   ======================================== */

#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.3s ease-in-out;
}

/* Spinner Container */
#loader::before {
  content: '';
  width: 60px;
  height: 60px;
  border: 4px solid #e0e0e0;
  border-radius: 50%;
  border-top-color: #363986;
  border-right-color: #4A90E2;
  animation: spin 0.8s cubic-bezier(0.65, 0.05, 0.36, 1) infinite;
}

/* Optional Loading Text */
#loader::after {
  content: 'Loading...';
  margin-top: 20px;
  font-size: 14px;
  font-weight: 500;
  color: #363986;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: 0.5px;
}

/* Smooth Spin Animation */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@-webkit-keyframes spin {
  0% {
    -webkit-transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
  }
}

/* Fade-in Animation for Content */
.animate-bottom {
  animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@-webkit-keyframes fadeInUp {
  from {
    opacity: 0;
    -webkit-transform: translateY(20px);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
  }
}

/* Responsive Design */
@media screen and (max-width: 768px) {
  #loader::before {
    width: 50px;
    height: 50px;
    border-width: 3px;
  }

  #loader::after {
    font-size: 13px;
    margin-top: 16px;
  }
}

@media screen and (max-height: 600px) {
  #loader::before {
    width: 45px;
    height: 45px;
  }

  #loader::after {
    font-size: 12px;
  }
}

/* Accessibility - Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  #loader::before {
    animation: pulse 1.5s ease-in-out infinite;
  }

  .animate-bottom {
    animation: fadeIn 0.3s ease-out;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#myDiv {
  display: none;
  text-align: center;
}
