/*
 * Self-hosted Roboto fonts
 * The paths now point to .ttf files as requested.
 */
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    src: url('fonts/roboto-regular.woff2') format('woff2'),
    url('fonts/roboto-regular.ttf') format('truetype');
    font-display: swap; /* Ensures text is visible during font loading */
}
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 700;
    src: url('fonts/roboto-bold.woff2') format('woff2'),
    url('fonts/roboto-bold.ttf') format('truetype');
    font-display: swap; /* Ensures text is visible during font loading */
}

/* A reset for consistent box-sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    height: 100%; /* Ensure HTML takes full height for fixed background to work */
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh; /* Ensures the body takes at least the full viewport height */
    font-family: 'Roboto', sans-serif;

    /* Set the fallback background image */
    background-image: url('background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative; /* Needed for body::before to position correctly */
    color: white;
    overflow-y: auto; /* Allows vertical scrolling if content overflows */
    overflow-x: hidden; /* Prevents horizontal scrolling */
}

body::before {
    content: "";
    position: fixed; /* Fixed position relative to viewport */
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.0); /* Semi-transparent overlay */
    z-index: 0; /* Ensures it's behind content but above background image */
}

/* --- START: MODIFIED CSS for Background Video --- */
#background-video {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -1;
    /* Hide the video by default */
    opacity: 0;
    /* Add a smooth transition for the fade-in effect */
    transition: opacity 1s ease-in-out;
}

/* When the body has the 'video-loaded' class, make the video visible */
body.video-loaded #background-video {
    opacity: 1;
}
/* --- END: MODIFIED CSS for Background Video --- */

/* ACCESSIBILITY: Styles for the video control button */
#video-control {
    position: fixed;
    bottom: 70px; /* MOVED UP: Changed from 20px to avoid overlapping footer text */
    right: 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: 1px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
}

#video-control:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}


.page-wrapper {
    position: relative;
    z-index: 1; /* Ensures page content is above the overlay */
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90vw;
    max-width: 450px; /* Applying desktop max-width here for consistency across devices */
    gap: 10px;
    background: transparent;
    padding: 20px 0;
    flex-grow: 1; /* Allows it to take available space */
    justify-content: center; /* Center content vertically within itself */
    margin-top: 50px; /* Adjusted to prevent overlap with fixed logo on smaller screens */
    margin-bottom: 50px; /* Adjusted to prevent overlap with fixed footer on smaller screens */
}

#dob-label {
    margin-bottom: 0;
}


/* Updated footer styling using flexbox for left/right alignment */
.sticky-footer-text {
    position: fixed; /* Fixed position relative to viewport */
    bottom: 20px;
    left: 50px;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 10; /* Higher z-index to be on top of everything */
    color: white;
    font-size: 0.8125rem; /* FIX: Use rem for scalable font size (13px / 16px) */
    letter-spacing: 2px;
}

/* ACCESSIBILITY FIX: Added background to footer links for visibility */
.sticky-footer-text a {
    color: white;
    text-decoration: none;
    margin: 0 5px;
    background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent black background */
    padding: 5px 10px; /* Added padding for spacing */
    border-radius: 5px; /* Softened corners */
    display: inline-block; /* Ensure padding and background are applied correctly */
    border: 1px solid #ffffff; /* Adds a white border */
}

.sticky-footer-text a:hover {
    text-decoration: underline;
    border: 1px solid #ffffff; /* Adds a white border */
}

.sticky-footer-text .pipe-separator {
    margin: 0 10px;
}

.form-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 100%;
    padding: 30px 35px; /* Increased padding */
    display: flex;
    flex-direction: column;
    color: black;
}

/* FIX: Added margin-bottom to create space below the h2 */
.form-container h2 {
    margin-bottom: 30px;
}


/* --- Mobile adjustment for form heading --- */
@media (max-width: 721px) {
    .form-container h2 {
    font-size: 1.2em; /* link*/
    }
}


.top-text {
    text-align: center;
    line-height: 1.2;
    margin-bottom: 10px;
    padding: 0 10px;
}

/* ACCESSIBILITY CHANGE: Added a semi-transparent background for guaranteed contrast. */
.top-text a.top-link {
    font-size: 2.0rem;
    font-weight: bold;
    color: white;
    text-decoration: none; /* Removed underline, background provides affordance */
    display: inline-block;
    background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent black background */
    padding: 10px 15px; /* Added padding for spacing */
    border-radius: 5px; /* Softened corners */
}

.top-text a.top-link:hover {
    text-decoration: underline; /* Add underline on hover for extra clarity */
}


/* Desktop styles for wider screens */
@media (max-width: 721px) {
    .page-wrapper {
    max-width: 450px; /* form width */
    }
    .top-text a.top-link {
    font-size: 1.4em; /* white text */
    }
}

form {
    display: none; /* Forms are hidden by default, shown by .active class */
    margin-top: 8px;
    flex-grow: 1;
}
form.active {
    display: block;
}

/* ACCESSIBILITY: Visible focus styles for all interactive elements */
a:focus,
button:focus,
input:focus,
select:focus,
[tabindex]:not([tabindex="-1"]):focus {
    outline: 3px solid #fd4157 !important;
    outline-offset: 2px;
    box-shadow: none !important; /* Override other focus styles */
}


/* --- START: MODERNIZED FIELD STYLES --- */
/* FIXED: Changed from fixed px to rem for accessibility scaling */
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 0.8em 0.9em; 
    margin: 0.5rem 0;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    /* The font size is now controlled by the JavaScript fix below to override the widget. */
    font-size: 1rem; 
    background-color: #f9f9f9;
    transition: all 0.2s ease-in-out;
}

/* ACCESSIBILITY: Darken placeholder text for better contrast */
::placeholder {
    color: #555;
    opacity: 1; /* Firefox */
}

/* Custom rule for focused inputs to override browser autofill */
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
    border-color: rgba(253, 65, 87, 0.8) !important;
    
    /* Use a combined box-shadow to create the red glow and force a white background. */
    box-shadow: 0 0 8px rgba(253, 65, 87, 0.8), inset 0 0 0 1000px white !important;
    
    /* Set background to transparent to ensure the inset shadow is visible. */
    background-color: transparent !important;
}


/* FIX: Reduced margin for tighter spacing */
.birthdate-select {
    display: flex;
    gap: 10px;
    margin: 0 0 1px 0; /* Removed top margin */
}
.birthdate-select select {
    flex: 1;
    /* Inherits the modernized styles from the rule above */
}

/* FIXED: Style for all form labels to be consistent and scalable */
.form-label-scalable {
    font-size: 1rem; /* Use scalable rem units */
    font-weight: 600;
    display: block;
    text-align: left;
    margin: 0 0 0.25rem 0; /* REDUCED: Halved the space below the label */
    user-select: none;
}
/* --- END: MODERNIZED FIELD STYLES --- */

/* FIX: Group for labels and inputs, with labels on top */
.form-group {
    margin-bottom: 15px; /* Space between form groups */
}
.form-group:last-of-type {
    margin-bottom: 0; /* Remove margin from the last group */
}
.form-group input, .form-group .password-input-container {
    width: 100%;
    margin: 0; /* Reset margin from general input rule */
}


/* FIX: Align checkbox and its label on one line, with reduced top margin */
.terms-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px; /* Reduced space above checkbox */
}
.terms-container label {
    margin: 0; /* Reset margin for this specific label */
    font-weight: normal; /* Make the "I agree to the" text normal weight */
}
.terms-container input[type="checkbox"] {
    margin: 0;
    /* Make checkbox scale with font size */
    width: 1em;
    height: 1em;
    min-width: 16px;
    min-height: 16px;
}


/* --- START: MODERNIZED BUTTON STYLE --- */
button {
    width: 100%;
    padding: 14px; /* Increased padding */
    background: #c60016;
    color: white;
    border: none;
    border-radius: 8px; /* Consistent with inputs */
    font-size: 18px; /* Larger font size */
    cursor: pointer;
    margin-top: 25px; /* space above button */
    font-weight: bold;
    letter-spacing: 0.5px; /* Added letter spacing */
    transition: background-color 0.2s ease-in-out; /* Smooth hover transition */
}
button:hover {
    background: #a80014;
}
/* --- END: MODERNIZED BUTTON STYLE --- */

.message {
    color: #c70017; /* A standard red for errors */
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 14px;
    text-align: center;
}
.success-message {
    color: #2c682c; /* A standard green for success */
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 14px;
    text-align: center;
}
#terms-error, #age-error, #password-error {
    color: #c70017;
    font-size: 14px;
    margin: 3px 0 8px 2%;
    display: none;
    font-weight: bold;
}
a {
    color: #c70017;
    text-decoration: none;
    font-size: 13px;
}
a:hover {
    text-decoration: underline;
}

/* FIX: Corrected color to make links visible */
.terms-container a {
    color: #000; /* Set color to black */
    font-weight: bold; /* Makes the text bold */
    text-decoration: underline; /* Underlines the links */
    font-size: inherit; /* Makes the links match the parent text size */
}

.terms-container a:hover {
    text-decoration: none; /* Optional: remove underline on hover */
}

/* Style for forgot password link to match terms links */
.forgot-password-link {
    color: #000 !important; /* Set color to black */
    font-weight: bold !important; /* Makes the text bold */
    text-decoration: underline !important; /* Underlines the links */
    font-size: inherit !important; /* Makes the links match the parent text size */
}

.forgot-password-link:hover {
    text-decoration: none !important; /* Remove underline on hover */
}

/* Style for back to login link to match forgot password link style */
.back-to-login-link {
    color: #000 !important; /* Set color to black */
    font-weight: bold !important; /* Makes the text bold */
    text-decoration: underline !important; /* Underlines the links */
    font-size: inherit !important; /* Makes the links match the parent text size */
}

.back-to-login-link:hover {
    text-decoration: none !important; /* Remove underline on hover */
}

/* New class for underlined links that lose underline on hover */
.link-active {
    text-decoration: underline;
}
.link-active:hover {
    text-decoration: none;
}

/* Rule for the link in the h2 title on login.php and index.php */
h2 a {
    color: black;
    font-size: inherit;
}

/* FIX: Remove the border from the fieldset */
fieldset {
    border: none;
    padding: 0;
    margin: 0;
}


/* Basic styling for the password input container */
.password-input-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}
.password-input-container input[type="password"],
.password-input-container input[type="text"] {
    flex-grow: 1;
    padding: 14px 50px 14px 14px; /* Added right padding for the toggle button */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background-color: #f9f9f9;
    box-sizing: border-box;
    margin: 0;
}

/* Style the password toggle icon */
.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #666;
    width: auto;
    height: auto;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
}

.toggle-password:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #333;
}

.toggle-password:focus {
    outline: 2px solid #fd4157;
    outline-offset: 2px;
    background-color: rgba(253, 65, 87, 0.1);
}

/* Style the SVG eye icon */
.eye-icon {
    width: 20px;
    height: 20px;
    transition: all 0.2s ease-in-out;
}

.toggle-password:hover .eye-icon {
    transform: scale(1.1);
}

/* --- UPDATED LOGO STYLES --- */

.logo {
    text-align: center;
    position: fixed; /* Fixed position relative to viewport */
    top: 15px; /* Adjusted for better spacing */
    left: 50%;
    transform: translateX(-50%);
    z-index: 10; /* Higher z-index to be on top of everything */
}

/* Style for the logo image itself (mobile-first) */
.logo img {
    height: 50px; /* Mobile height */
    width: auto;  /* Maintain aspect ratio */
    display: block; /* Ensures proper rendering */
}



/* --- DESKTOP STYLES --- */
@media (min-width: 721px) {
    /* Style for the logo image on desktop */
    .logo img {
    height: 70px; /* Desktop height */
    }

    
}

/* --- START: MOBILE FOOTER FIX --- */
@media (max-width: 721px) {
    .sticky-footer-text {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        /* Increased padding to give more space around the links */
        padding: 15px 10px;
        bottom: 0;
        left: 0;
        right: 0;
    }
    #video-control {
        display: none;
    }
    /* ADDED: Removes top space and prevents footer overlap on mobile */
    .page-wrapper {
        margin-top: 35px;
        margin-bottom: 140px;
    }
}
/* --- END: MOBILE FOOTER FIX --- */

/* Style for form options container (login page) */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0 0 0; 
    gap: 10px;
}

.form-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    flex-shrink: 0;
}

/* Style for checkbox when it is focused (clicked or tabbed to) */
#terms:focus, #remember:focus {
    outline: none; /* Removes the default blue outline */
    box-shadow: 0 0 8px rgba(253, 65, 87, 0.5); /* Adds a pink/red glow */
}

    .skip-link {
            position: absolute;
            top: -40px;
            left: 6px;
            background: #000;
            color: #fff;
            padding: 8px;
            text-decoration: none;
            z-index: 1000;
            border-radius: 4px;
    }
    .skip-link:focus {
            top: 6px;
    }