﻿input[type="date"], input[type="email"], input[type="number"], input[type="password"], input[type="search"], input[type="tel"], input[type="text"], input[type="url"], select, textarea {
    margin-bottom: 0px !important;
}

select {
    -webkit-appearance: menulist !important;
}
#Content {
    overflow-x: auto;
}
#Footer .footer_copy .one {
    margin-bottom: 0px;
    padding-top: 10px;
    min-height: 0px;
}

table {
    margin-bottom: 0px !important;
    width: auto !important;
}

    table td {
        text-align: left !important;
        border-color: transparent !important;
    }

    table tr:first-child td {
        box-shadow: inset 0px 0px 0px 0px rgba(0,0,0,0);
    }

    table th {
        box-shadow: inset 0px 0px 0px 0px rgba(0,0,0,0) !important;
        border-color: transparent !important;
        text-align: left !important;
    }

label {
    display: inline !important;
}

#popup label {
    font-weight: normal !important;
}

#popup2 label {
    font-weight: normal !important;
}

.override-grid tr {
    line-height: 0px;
}

.override-grid th {
    padding: 0px 0px 0px 0px;
}

.bg {
    position: fixed;
    top: 0;
    left: 0;
    background-color: gray !important;
    opacity: 0.5 !important;
    filter: alpha(opacity=50) !important; /* For IE8 and earlier */
}

.bgwidth {
    width: 100%;
}

.bgheight {
    height: 100%;
}

/* ===================================================================
   MOBILE-FRIENDLY ENHANCEMENTS
   Improves usability on phones for registration, login, and home pages.
   =================================================================== */

/* --- Base: touch-friendly inputs on all screen sizes --- */
input[type="date"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="text"],
input[type="url"],
select,
textarea {
    font-size: 16px; /* prevents iOS zoom on focus */
    box-sizing: border-box;
}

/* --- Mobile: screens up to 767px --- */
@media only screen and (max-width: 767px) {

    /* Allow content area to use full phone width */
    .section_wrapper,
    .container,
    .four.columns .widget-area {
        max-width: 100% !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        box-sizing: border-box !important;
    }

    /* Stack form table rows vertically (label above input) */
    #Content table:not(.gridview):not(.override-grid) tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 10px;
    }

    #Content table:not(.gridview):not(.override-grid) td {
        display: block;
        width: 100% !important;
        padding: 2px 0 !important;
    }

    /* Full-width form inputs */
    #Content input[type="text"],
    #Content input[type="email"],
    #Content input[type="password"],
    #Content input[type="date"],
    #Content input[type="tel"],
    #Content input[type="number"],
    #Content input[type="url"],
    #Content input[type="search"],
    #Content select,
    #Content textarea {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 44px; /* Apple HIG touch target */
        padding: 10px !important;
        font-size: 16px !important;
        box-sizing: border-box !important;
    }

    /* Touch-friendly buttons */
    #Content input[type="submit"],
    #Content input[type="button"],
    #Content button,
    #Content .btn,
    #Content .action_button {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 16px !important;
        font-size: 16px !important;
        box-sizing: border-box;
    }

    /* Login form: full width on mobile */
    .auth-form {
        max-width: 100% !important;
    }

    .auth-input {
        max-width: 100% !important;
        width: 100% !important;
        min-height: 44px;
    }

    .auth-actions {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .auth-actions input[type="submit"] {
        width: 100% !important;
    }

    /* Radio buttons: easier tap targets */
    #Content .RadioButtonList label,
    #Content input[type="radio"] + label,
    #Content span label {
        display: inline-block !important;
        padding: 8px 12px !important;
        margin: 2px 4px 2px 0 !important;
        font-size: 15px !important;
    }

    /* Stack radio button lists vertically */
    #Content table:not(.gridview) input[type="radio"] {
        width: 20px;
        height: 20px;
        margin-right: 6px;
        vertical-align: middle;
    }

    /* Modals: proper mobile sizing */
    .modalPopup,
    .modal-popup {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }

    /* Home page heading */
    h1 {
        font-size: 1.5em !important;
        word-wrap: break-word;
    }

    h2 {
        font-size: 1.2em !important;
    }

    /* Validation messages inline */
    span[id$="Validator"] {
        display: block !important;
        margin-top: 2px;
    }

    /* 2FA code inputs: larger touch targets */
    .code-input {
        width: 40px !important;
        height: 48px !important;
        font-size: 20px !important;
        text-align: center !important;
    }

    /* Navigation buttons row: stack if multiple */
    #Content > div > table + input[type="submit"],
    #Content > div > table + .aspNetDisabled {
        width: 100% !important;
        margin-bottom: 6px !important;
    }

    /* Ensure the sticky session timer doesn't obscure content */
    .sticky-top {
        font-size: 10px !important;
        top: 5px !important;
        padding: 2px 6px !important;
    }

    /* Grid views: horizontal scroll rather than break */
    .gridview,
    div[id*="GridView"],
    table.gridview {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Logo: smaller on mobile */
    .logo img {
        max-height: 50px !important;
    }
}

/* --- Small phones: 479px and below --- */
@media only screen and (max-width: 479px) {

    #Content input[type="text"],
    #Content input[type="email"],
    #Content input[type="password"],
    #Content input[type="date"],
    #Content select,
    #Content textarea {
        font-size: 16px !important;
    }

    /* 2FA code: tighter gap on very small screens */
    #verificationCodeContainer {
        gap: 3px !important;
    }

    .code-input {
        width: 34px !important;
        height: 44px !important;
        font-size: 18px !important;
    }
}

/* --- Registration form: targeted mobile stacking --- */
@media only screen and (max-width: 767px) {
    table.reg-form {
        width: 100% !important;
    }

    table.reg-form tr {
        display: flex !important;
        flex-direction: column !important;
        margin-bottom: 12px !important;
        border-bottom: 1px solid #eee;
        padding-bottom: 8px;
    }

    table.reg-form td {
        display: block !important;
        width: 100% !important;
        padding: 2px 0 !important;
    }

    /* First td is the label */
    table.reg-form td:first-child {
        font-weight: 600;
        font-size: 14px;
        color: #333;
        padding-bottom: 4px !important;
    }

    table.reg-form input[type="text"],
    table.reg-form input[type="email"],
    table.reg-form input[type="password"],
    table.reg-form input[type="date"],
    table.reg-form input[type="tel"],
    table.reg-form select,
    table.reg-form textarea {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 44px;
        padding: 10px !important;
        font-size: 16px !important;
        border: 1px solid #c9c9c9;
        border-radius: 4px;
        box-sizing: border-box !important;
    }

    table.reg-form input[type="submit"],
    table.reg-form button {
        width: 100% !important;
        min-height: 44px;
        padding: 10px 16px !important;
        font-size: 16px !important;
        margin-top: 4px !important;
    }
}
