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;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* PWA and Mobile Responsive Improvements */

/* Connection Status Indicator */
#connection-status {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 9999;
    transition: all 0.3s ease;
}

#connection-status.online {
    background: linear-gradient(90deg, #10b981, #059669);
}

#connection-status.offline {
    background: linear-gradient(90deg, #ef4444, #dc2626);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .hidden.md\:flex {
        display: none !important;
    }

    /* Mobile menu toggle */
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
    }

    /* Mobile menu */
    .mobile-menu {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        z-index: 9998;
        overflow-y: auto;
        padding: 1rem;
    }

    .mobile-menu.active {
        display: block;
    }

    .mobile-menu a {
        display: block;
        padding: 1rem;
        color: #1f2937;
        border-bottom: 1px solid #e5e7eb;
    }

    .mobile-menu a:hover {
        background: #f3f4f6;
    }
}

/* Touch-friendly buttons for mobile */
@media (max-width: 768px) {
    button, .btn, a.btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important; /* Prevent zoom on iOS */
        min-height: 44px;
    }
}

/* Responsive tables */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 14px;
    }

    th, td {
        padding: 8px !important;
    }
}

/* Cards responsive */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }
}

/* Form improvements for mobile */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: 1.5rem;
    }

    label {
        font-size: 14px;
        font-weight: 600;
    }
}

/* PWA Install Prompt */
.pwa-install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    padding: 1rem;
    z-index: 9997;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.pwa-install-prompt.show {
    transform: translateY(0);
}

.pwa-install-prompt .close-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
}

/* Offline badge */
.offline-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Loading spinner */
.loading-spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Match scoring improvements for mobile */
@media (max-width: 768px) {
    .score-display {
        font-size: 2rem;
        font-weight: bold;
    }

    .score-controls {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .score-controls button {
        width: 100%;
    }
}

/* Live score card mobile optimizations */
@media (max-width: 768px) {
    .live-score-card {
        padding: 0.75rem;
    }

    .team-name {
        font-size: 1rem;
    }

    .score-value {
        font-size: 1.75rem;
    }
}

/* Prevent body scroll when mobile menu is open */
body.menu-open {
    overflow: hidden;
}

/* Safe area padding for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
}

/* Pull-to-refresh indicator */
.ptr-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 0.5rem 1rem;
    z-index: 9996;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ptr-indicator.active {
    opacity: 1;
}

/* Landscape mode optimizations */
@media (orientation: landscape) and (max-height: 500px) {
    .container {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .card {
        margin-bottom: 0.5rem;
    }
}