/* Mobile-specific styles for ScoreDash */

/* Action icon links - larger tap targets (Apple HIG recommends 44x44px minimum) */
.mobile-action-icon {
  display: inline-block;
  font-size: 1.5em;
  padding: 0.5em;
  min-width: 44px;
  min-height: 44px;
  text-align: center;
  line-height: 1;
  text-decoration: none;
}

.mobile-action-icon:hover {
  opacity: 0.7;
}

/* Ensure tables scroll smoothly on touch devices */
.table-responsive {
  -webkit-overflow-scrolling: touch;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  /* Larger form controls - prevents iOS zoom on focus */
  .form-control {
    font-size: 16px;
  }

  /* Larger buttons for easier tapping */
  .btn-sm {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
  }

  /* Make number inputs easier to use */
  input[type="number"] {
    font-size: 1.25rem;
    padding: 0.75rem;
    text-align: center;
  }

  /* Hide less important columns if needed */
  .hide-mobile {
    display: none;
  }
}

/* Clickable rows */
tr[onclick] {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

tr[onclick]:hover {
  background-color: #f8f9fa;
}

tr[onclick]:active {
  background-color: #e9ecef;
}

/* Match Detail - Mobile Card Layout */
@media (max-width: 768px) {
  /* Hide the complex table on mobile */
  .match-detail-table {
    display: none;
  }

  /* Show card-based layout on mobile */
  .match-cards {
    display: block;
  }

  .match-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }

  .match-card-header {
    font-weight: bold;
    color: #056AD6;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
  }

  .match-card-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
  }

  .match-card-player:last-of-type {
    border-bottom: none;
  }

  .player-info {
    flex: 1;
    font-size: 16px;
  }

  .player-name {
    font-weight: 500;
  }

  .player-level {
    color: #666;
    font-size: 14px;
  }

  .player-sub {
    font-weight: bold;
  }

  .score-section {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .score-display {
    font-size: 24px;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
  }

  .score-winner {
    color: #056AD6;
  }

  .match-status {
    background-color: #fff3cd;
    padding: 8px;
    border-radius: 4px;
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
  }

  .match-totals {
    background-color: #e8f4fd;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
  }

  .match-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
  }

  .captain-delegation-mobile {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
  }

  .delegation-section {
    margin-bottom: 12px;
  }

  .delegation-section:last-child {
    margin-bottom: 0;
  }

  .delegation-label {
    font-weight: 500;
    margin-bottom: 6px;
    color: #444;
  }

  .delegation-select {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
  }

  .delegation-button {
    width: 100%;
    margin-top: 10px;
  }
}

/* Desktop - hide mobile cards, show table */
@media (min-width: 769px) {
  .match-cards {
    display: none;
  }

  .match-detail-table {
    display: block;
  }
}

/* Mobile Navigation Improvements */
@media (max-width: 991px) {
  /* Larger tap targets for nav links on mobile */
  .navbar-nav .nav-link {
    padding: 12px 16px;
    font-size: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .navbar-nav .nav-link:last-child {
    border-bottom: none;
  }

  /* Ensure navbar brand doesn't get too small */
  .navbar-brand {
    font-size: 20px;
    padding: 10px 0;
  }

  /* Make hamburger icon larger for easier tapping */
  .navbar-toggler {
    padding: 10px;
    font-size: 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.5);
  }

  .navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25);
  }

  /* Add spacing when menu is expanded */
  .navbar-collapse {
    margin-top: 10px;
  }

  /* Style the logout button better on mobile */
  .form-inline {
    padding: 10px 16px;
    width: 100%;
  }

  .form-inline .btn {
    width: 100%;
    padding: 10px;
    font-size: 16px;
  }

  /* Highlight Find Subs link better on mobile */
  .navbar-nav .nav-link[style*="yellow"] {
    background-color: rgba(255, 255, 0, 0.2);
    font-weight: 500;
  }
}

/* Scoring Page (courtMatch) Mobile Improvements */
@media (max-width: 768px) {
  /* Make submit button more prominent on mobile */
  form[action*="/score"] tfoot input[type="submit"] {
    width: 100%;
    padding: 12px;
    font-size: 18px;
  }

  /* Improve spacing for doubles partner names */
  form[action*="/doubles/"][action*="/score"] .table tbody tr:nth-child(2) td {
    font-size: 14px;
    color: #666;
    padding-top: 4px;
  }
}
