html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    /* Mobile optimizations to prevent screen shifts */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* Prevent horizontal scrolling */
    overflow-x: hidden;
    width: 100%;
    
    /* Safe area support for devices with notches */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    
    /* Prevent zooming on input focus for iOS */
    touch-action: manipulation;
}

/* Prevent iOS Safari zoom on form inputs */
input, select, textarea {
    font-size: 16px; /* Prevents zoom on iOS when font-size is less than 16px */
}

/* Ensure consistent viewport behavior */
* {
    box-sizing: border-box;
}

/* Mobile viewport stability */
@media screen and (max-width: 768px) {
    body {
        /* Prevent elastic scrolling bounce on iOS */
        -webkit-overflow-scrolling: touch;
        position: relative;
        
        /* Handle safe areas for devices with notches */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    /* Prevent horizontal scrolling on mobile */
    html, body {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* Stabilize viewport height on mobile browsers */
    .page {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    /* Prevent text inflation on Android */
    html {
        -webkit-text-size-adjust: none;
        text-size-adjust: none;
    }
    
    /* Improve touch targets */
    button, a, input, select, textarea {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Mobile viewport stability using JavaScript-set custom properties */
@media screen and (max-width: 768px) {
    .page {
        /* Use custom property set by JavaScript for consistent viewport height */
        min-height: calc(var(--vh, 1vh) * 100);
    }
    
    /* Prevent content from jumping when virtual keyboard appears */
    .main {
        position: relative;
        width: 100%;
        overflow: hidden;
    }
    
    /* Improve input stability on mobile */
    input, select, textarea {
        /* Prevent zoom on iOS by ensuring minimum font size */
        font-size: max(16px, 1em);
        /* Improve touch targets */
        /* min-height: 44px; */
        /* Prevent layout shifts */
        box-sizing: border-box;
    }
    
    /* Handle keyboard appearance */
    .form-control:focus {
        /* Prevent aggressive zooming */
        zoom: 1;
        /* Maintain stable layout */
        transform: none;
    }
}

/* Additional safe area handling for modern devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    @media screen and (max-width: 768px) {
        body {
            padding-top: max(0px, env(safe-area-inset-top));
            padding-bottom: max(0px, env(safe-area-inset-bottom));
        }
    }
}

/* Prevent iOS Safari bottom bar shifting */
@media screen and (max-width: 768px) and (orientation: portrait) {
    .page {
        height: 100vh;
        height: -webkit-fill-available;
    }
}

@media screen and (max-width: 768px) and (orientation: landscape) {
    .page {
        height: 100vh;
        height: -webkit-fill-available;
    }
}

/* Login Required Message Styles */
.login-required-message {
    max-width: 500px;
    margin: 20px auto;
    text-align: center;
}

.race-login-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #dee2e6;
    position: relative;
    overflow: hidden;
}

.race-login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;

    
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #ff4e50, #f9d423);
}

.race-login-icon {
    background-color: #f8f9fa;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border: 3px solid #e9ecef;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.race-login-icon .fas {
    font-size: 30px;
    color: #dc3545;
}

.login-required-message h3 {
    margin-top: 10px;
    margin-bottom: 15px;
    color: #343a40;
    font-size: 24px;
    font-weight: 600;
}

.login-required-message p {
    margin-bottom: 25px;
    color: #495057;
    font-size: 16px;
}

.race-login-benefits {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
    text-align: left;
    padding: 0 10px;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.benefit-item .fas {
    color: #28a745;
    font-size: 18px;
    width: 24px;
}

.benefit-item span {
    color: #495057;
    font-size: 15px;
}

.race-login-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.btn-race-login, .btn-race-register {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-race-login {
    background-color: #007bff;
    border-color: #007bff;
}

.btn-race-login:hover {
    background-color: #0069d9;
    border-color: #0062cc;
    transform: translateY(-2px);
}

.btn-race-register {
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-race-register:hover {
    background-color: #5a6268;
    border-color: #545b62;
    transform: translateY(-2px);
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.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;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiI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zg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.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;
}

/* Form stability improvements for mobile */
@media screen and (max-width: 768px) {    /* Prevent form inputs from causing zoom and shifts */
    .form-control, .form-select, .form-check-input {
        font-size: 16px !important; /* Prevent iOS zoom */
        border-radius: 8px; /* Consistent appearance */
        transition: none; /* Prevent layout shifts during focus */
        touch-action: manipulation;
        -webkit-appearance: none; /* Remove iOS styling */
        appearance: none; /* Remove default styling */
    }
    
    .form-control:focus, .form-select:focus {
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
        border-color: #86b7fe;
        transform: none; /* Prevent scaling transforms */
        zoom: 1; /* Prevent browser zoom */
    }
      /* Button improvements */
    .btn {
        font-size: 16px; /* Prevent zoom */
        min-height: 44px; /* Proper touch target size */
        touch-action: manipulation;
        -webkit-appearance: none;
        appearance: none;
        border-radius: 8px;
    }
    
    /* Select dropdown improvements */
    select {
        font-size: 16px !important;
        -webkit-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23666' d='m2 0-2 2h4zm0 5 2-2h-4z'/></svg>");
        background-repeat: no-repeat;
        background-position: right 0.7rem center;
        background-size: 0.65rem auto;
        padding-right: 2.5rem;
    }
    
    /* Prevent double-tap zoom */
    a, button, [role="button"], .btn {
        touch-action: manipulation;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Landscape orientation specific fixes */
@media screen and (max-width: 768px) and (orientation: landscape) {
    /* Adjust for virtual keyboard in landscape */
    .form-control:focus {
        position: relative;
        z-index: 1000;
    }
    
    /* Ensure content doesn't shift when keyboard appears */
    .main {
        min-height: 50vh; /* Reduced for landscape */
    }
}

/* Address bar hide/show handling for iOS Safari */
@supports (-webkit-touch-callout: none) {
    /* iOS-specific styles */
    .page {
        height: -webkit-fill-available;
    }
    
    @media screen and (max-width: 768px) {
        /* Handle iOS Safari's dynamic viewport */
        .main {
            min-height: -webkit-fill-available;
        }
        
        /* Prevent content jumping when address bar hides/shows */
        body {
            position: fixed;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        
        .page {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
    }
}