/**
 * ADA Compliance CSS Utility Classes
 * Replaces deprecated HTML presentation attributes
 */

/* Table styling - replaces border, cellpadding, cellspacing attributes */
.table-no-border {
    border-collapse: collapse;
    border-spacing: 0;
}

.table-border {
    border-collapse: collapse;
}

.table-border td,
.table-border th {
    border: 1px solid #ccc;
}

/* Text alignment - replaces align attribute */
.text-left {
    text-align: left;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Vertical alignment - replaces valign attribute */
.valign-top {
    vertical-align: top;
}

.valign-middle {
    vertical-align: middle;
}

.valign-bottom {
    vertical-align: bottom;
}

/* White space - replaces nowrap attribute */
.no-wrap {
    white-space: nowrap;
}

/* Image borders - replaces border attribute on img */
img.no-border {
    border: none;
}

/* Column widths - common widths used in tables */
.col-width-160 {
    width: 160px;
}

.col-width-30pct {
    width: 30%;
}

.col-width-70pct {
    width: 70%;
}

.col-width-55pct {
    width: 55%;
}

.col-width-8pct {
    width: 8%;
}

.col-width-25pct {
    width: 25%;
}

.col-width-7pct {
    width: 7%;
}

.col-width-5pct {
    width: 5%;
}

/* Table cell padding - replaces cellpadding */
.table-padding-0 td,
.table-padding-0 th {
    padding: 0;
}

.table-padding-10 td,
.table-padding-10 th {
    padding: 10px;
}

/* Ensure existing styles don't conflict */
table.table-no-border {
    border: none;
}

/* ADA Compliance: Minimum touch target size for interactive elements */
/* jQuery UI Accordion headers must meet 44x44px minimum size */
.ui-accordion-header {
    min-height: 44px !important;
    line-height: 1.5 !important;
    display: flex !important;
    align-items: center !important;
}

.ui-accordion-header a {
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    flex: 1 !important;
    text-decoration: none !important;
}

/* Ensure the clickable area covers the full header */
.ui-accordion-header {
    cursor: pointer !important;
}

/* ADA Compliance: Enhanced color contrast for accordion headers */
/* Background color #e5eaf0 requires dark text to meet WCAG AAA (7:1 ratio) */
.ui-accordion-header,
.ui-accordion-header a,
.ui-accordion-header span {
    color: #1a1a1a !important;
}

/* ADA Compliance: Improve contrast for pickadate calendar weekday labels */
/* Original color #999999 has insufficient contrast (2.85:1) against white background */
/* New color #595959 provides 7:1 contrast ratio, meeting WCAG AAA standards */
.picker__weekday {
    color: #595959 !important;
    font-weight: 600 !important;
}

/* ADA Compliance: Ensure search result table header rows meet minimum touch target height */
#searchResultTable thead tr, #searchResult thead tr {
    min-height: 44px;
    height: 44px;
}

/* ADA Compliance: Improve color contrast for search result table cells */
/* Ensure text meets WCAG AAA enhanced contrast requirement (7:1 ratio) */
table.searchResultDisplay tbody tr td {
    color: #000000 !important;
}

/* Improve contrast for pagination links */
.paging_full_numbers a.paginate_button {
    color: #000000 !important;
    background-color: #e0e0e0 !important;
}

.paging_full_numbers a.paginate_button:hover {
    background-color: #cccccc !important;
    color: #000000 !important;
}

.paging_full_numbers a.paginate_active {
    background-color: #0056b3 !important;
    color: #ffffff !important;
    font-weight: bold !important;
    border-color: #003d82 !important;
}

/* More specific override for DataTables pagination active button */
.dataTables_paginate.paging_full_numbers a.paginate_active,
.dataTables_wrapper .dataTables_paginate .paging_full_numbers a.paginate_active {
    background-color: #0056b3 !important;
    color: #ffffff !important;
}

/* Ensure disabled pagination links have sufficient contrast */
.paginate_disabled_previous,
.paginate_disabled_next {
    color: #595959 !important;
}

/* ADA Compliance: Improve contrast for unavailable documents (NV/NA text) */
/* Use darker gray that meets WCAG AAA (7:1) while still appearing "disabled" */
td[style*="color:gray"],
td[style*="color: gray"] {
    color: #595959 !important;
}


/* Improve contrast for picker box and other calendar elements */
.picker__box {
    border: 1px solid #595959 !important;
}

.picker__day--disabled {
    color: #999999 !important;
}

.picker__day--outfocus {
    color: #777777 !important;
}

/* ADA Compliance: Skip to main content link */
/* Hidden above viewport by default, drops down from top center when focused via keyboard */
.skip-link {
    position: fixed;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: #073873;
    color: #ffffff;
    padding: 8px 16px;
    text-decoration: none;
    font-weight: bold;
    z-index: 10000;
    border: 2px solid #ffffff;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 10px;
    outline: 3px solid #ffffff;
    outline-offset: 2px;
}

/* ADA Compliance: Keyboard focus indicators with maximum contrast */
/* Applies to all interactive elements for clear keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
    outline: 3px solid #000000 !important;
    outline-offset: 2px !important;
}

/* Focus for accordion headers */
.ui-accordion-header:focus {
    outline: 3px solid #000000 !important;
    outline-offset: 2px !important;
}

/* Focus for jQuery UI tabs */
.ui-tabs .ui-tabs-nav li a:focus {
    outline: 3px solid #000000 !important;
    outline-offset: 2px !important;
}

/* Focus for pagination buttons */
.paging_full_numbers a:focus,
.paginate_button:focus {
    outline: 3px solid #000000 !important;
    outline-offset: 2px !important;
}

/* Focus for scrollable regions - outline inside to avoid overflow issues */
[role="region"][tabindex="0"]:focus {
    outline: 3px solid #000000 !important;
    outline-offset: -3px !important;
}

/* Focus for checkboxes and radio buttons */
input[type="checkbox"]:focus,
input[type="radio"]:focus {
    outline: 3px solid #000000 !important;
    outline-offset: 2px !important;
}

/* Focus for custom styled elements */
.simple-button:focus,
.blue-button:focus {
    outline: 3px solid #000000 !important;
    outline-offset: 2px !important;
}

/* ADA Compliance: Prevent focus on purchasedOrderTable headers */
/* Table headers should not be in tab order - only interactive elements within them */
.purchasedOrderTable thead th {
    outline: none !important;
}

.purchasedOrderTable thead th:focus {
    outline: none !important;
}

/* Order info table - Cart ID, Confirmation Code, Expiration Date */
/* ADA compliant orange border with sufficient contrast */
.order-info-table {
    width: 100%;
    border: 2px solid #CC8400 !important; /* ADA compliant orange - 4.5:1 contrast ratio */
    border-collapse: collapse;
    background-color: transparent;
}

.order-info-table td {
    border: none !important;
    padding: 2px 10px !important;
    vertical-align: middle;
}

.order-info-table tr:first-child td,
.order-info-table tr:last-child td {
    padding: 5px 10px !important;
}

/* Ensure purchasedOrderTable is responsive and spans full width */
.purchasedOrderTable {
    width: 100% !important;
    max-width: 100%;
    table-layout: auto;
}

/* Responsive table wrapper for order data */
#orderData {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile responsive adjustments for order tables */
@media screen and (max-width: 768px) {
    .order-info-table td {
        padding: 3px 5px !important;
        font-size: 0.9em;
    }
    
    .purchasedOrderTable {
        font-size: 0.85em;
    }
    
    .purchasedOrderTable thead th,
    .purchasedOrderTable tbody td {
        padding: 5px 3px !important;
    }
}

/* ADA Compliance: Enhanced color contrast for purchasedOrderTable body cells */
/* Odd rows with #eee background need darker text to meet WCAG AAA (7:1 contrast ratio) */
.purchasedOrderTable tbody tr.odd td {
    color: #1a1a1a !important; /* Dark gray text for 10.8:1 contrast with #eee background */
}

/* Ensure even rows also have sufficient contrast */
.purchasedOrderTable tbody tr td {
    color: #000000 !important; /* Black text for maximum contrast with white background */
}

/* ADA Compliance: Modal Dialog Styles */
/* Replaces native alert() and confirm() with accessible modal dialogs */

/* Modal overlay - semi-transparent backdrop */
.ada-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

/* Modal dialog container */
.ada-modal-dialog {
    background-color: #ffffff;
    border: 3px solid #000000;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
    padding: 0;
    position: relative;
    animation: ada-modal-fadein 0.2s ease-in-out;
}

/* Modal fade-in animation */
@keyframes ada-modal-fadein {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modal content wrapper */
.ada-modal-content {
    padding: 24px;
}

/* Modal title */
.ada-modal-title {
    margin: 0 0 16px 0;
    font-size: 1.5em;
    font-weight: bold;
    color: #000000;
    border-bottom: 2px solid #073873;
    padding-bottom: 8px;
}

/* Modal message */
.ada-modal-message {
    margin: 16px 0 24px 0;
    font-size: 1.1em;
    line-height: 1.6;
    color: #000000;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Modal actions container */
.ada-modal-actions {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

/* Modal OK button */
.ada-modal-button {
    min-width: 100px;
    min-height: 44px;
    padding: 12px 24px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid #003d82;
    background-color: #0056b3;
    color: #ffffff;
    border-radius: 4px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.ada-modal-button:hover {
    background-color: #003d82;
    transform: translateY(-1px);
}

.ada-modal-button:active {
    background-color: #002952;
    transform: translateY(0);
}

.ada-modal-button:focus {
    outline: 3px solid #000000 !important;
    outline-offset: 2px !important;
}

/* Responsive adjustments for mobile */
@media screen and (max-width: 768px) {
    .ada-modal-dialog {
        max-width: 95%;
        width: 95%;
    }
    
    .ada-modal-content {
        padding: 20px;
    }
    
    .ada-modal-title {
        font-size: 1.3em;
    }
    
    .ada-modal-message {
        font-size: 1em;
    }
    
    .ada-modal-button {
        min-width: 80px;
        padding: 10px 20px;
        font-size: 1em;
    }
}