html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* --- Mobile-first improvements --- */

/* Safe area for notched devices */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* Navbar: truncate long league name on small screens */
.league-switcher-nav .league-switcher-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}

@media (min-width: 576px) {
  .league-switcher-nav .league-switcher-name {
    max-width: 160px;
  }
}

@media (min-width: 768px) {
  .league-switcher-nav .league-switcher-name {
    max-width: none;
  }
}

/* Ensure touch-friendly nav and dropdowns on mobile */
@media (max-width: 575.98px) {
  .navbar .nav-link,
  .navbar .dropdown-item {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .navbar .dropdown-menu {
    max-height: min(70vh, 400px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Notification dropdown: scroll when many items */
.notification-dropdown {
  max-height: min(80vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Tables: smooth horizontal scroll on touch devices */
.table-responsive {
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
}

/* Footer: allow wrapping on narrow screens */
.footer {
  white-space: normal;
  line-height: 1.4;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

@media (max-width: 575.98px) {
  .footer .container {
    font-size: 0.875rem;
    text-align: center;
  }

  .footer .container a,
  .footer .container span {
    display: inline-block;
    margin: 0.25rem 0;
  }

  body {
    margin-bottom: 80px;
  }
}

/* Touch-friendly minimum height for buttons/links (e.g. Select League list) */
.min-touch-target {
  min-height: 48px;
}

/* Prevent zoom on focus for inputs (iOS) when font-size >= 16px in inputs */
@media (max-width: 575.98px) {
  input.form-control,
  select.form-select,
  textarea.form-control {
    font-size: 16px;
  }
}

/* Admin sidebar on mobile: compact and touch-friendly */
@media (max-width: 767.98px) {
  .admin-sidebar {
    margin-bottom: 1rem;
  }

  .admin-current-league {
    font-size: 0.95rem;
  }

  .admin-nav-list .list-group-item {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

  /* Ensure admin main content is full width when sidebar stacks */
  .row .col-md-9:not([class*="col-12"]) {
    flex: 0 0 100%;
    max-width: 100%;
  }
}