/* Visually hidden but accessible to screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* MAS Page Container - provides left/right margins */
.mas-page-container,
.mas-search-box {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* Page Title */
.mas-page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    padding-top: 0.5rem;
    display: block;
}

.mas-page-title::before {
    content: "";
    display: block;
    width: 3rem;
    height: 4px;
    background-color: #c5050c;
    margin-bottom: 0.5rem;
}

/* MAS Layout Classes */
.uw-inner-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.uw-inner-row > .uw-column {
    padding: 0 15px;
    padding-bottom: 1rem;
    box-sizing: border-box;
}

.uw-column.equal-column {
    flex: 1;
    min-width: 250px;
}

.uw-column.wide-column {
    flex: 2;
    min-width: 300px;
}

.uw-column.narrow-column {
    flex: 1;
    min-width: 250px;
    max-width: 350px;
}

/* MAS Search Box */
.mas-search-box {
    margin-bottom: 2rem;
}

.mas-search-box .letter-search {
    cursor: pointer;
    color: #0479a8;
    text-decoration: none;
}

.mas-search-box .letter-search:hover {
    text-decoration: underline;
}

.mas-search-box .letter-search.selected {
    font-weight: bold;
    color: #c5050c;
}

.mas-search-box .uw-inner-row > .uw-column {
    padding-bottom: 0;
    position: relative;
}

.mas-search-box .uw-inner-row > .uw-column label {
    display: block;
    padding-bottom: 1rem;
}

.mas-search-box select,
.mas-search-box input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Keyword Tag Input */
.keyword-tagsinput {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    cursor: text;
    width: 100%;
    box-sizing: border-box;
}

.keyword-tagsinput:focus-within {
    border-color: #0479a8;
    box-shadow: 0 0 0 2px rgba(4, 121, 168, 0.25);
}

.keyword-tagsinput .tag {
    display: inline-flex;
    align-items: center;
    background-color: #0479a8;
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.keyword-tagsinput .tag .tag-remove {
    margin-left: 6px;
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
}

.keyword-tagsinput .tag .tag-remove:hover {
    opacity: 1;
}

.mas-search-box .keyword-tagsinput input[type="text"] {
    border: none;
    outline: none;
    background: transparent;
    flex: 1;
    min-width: 80px;
    padding: 2px 4px;
    font-size: 1rem;
    width: auto;
    box-shadow: none;
}

/* Keyword Suggestions Dropdown */
.keyword-suggestions {
    display: none;
    position: absolute;
    background-color: #f1f1f1;
    min-width: 160px;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 10;
    box-sizing: border-box;
}

.keyword-suggestion-item {
    color: black;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.95rem;
}

.keyword-suggestion-item:hover,
.keyword-suggestion-item.highlighted {
    background-color: #ddd;
}

.keyword-suggestion-item.highlighted {
    border-left: 3px solid #c5050c;
    padding-left: 9px;
}

/* MAS Search Results */
.mas-search-results {
    margin: 1rem 0;
}

/* MAS List */
.mas-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mas-list {
    padding-left: 1.5rem;
}

.mas-list h2 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.mas-list ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin: 0 0 1rem 0;
}

.mas-list li {
    padding: 0.25rem 0;
}

.mas-list li a {
    color: #0479a8;
    text-decoration: underline;
}

.mas-list li a:hover {
    text-decoration: underline;
}

.mas-list > li > .keywords {
    display: none;
}

/* Helpful Definitions Sidebar */
.narrow-column h2 {
    font-size: 1.25rem;
    margin-top: 0;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid #c5050c;
}

.narrow-column h3 {
    font-size: 1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.narrow-column ul {
    padding-left: 1.25rem;
    margin: 0;
}

.narrow-column li {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* Dropdown Button */
.dropbtn {
    background-color: white;
    border: none;
    font-family: inherit;
    color: #0479a8;
    cursor: pointer;
    padding: 0;
}

/* The container <div> - needed to position the dropdown content */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Dropdown Content (Hidden by Default) */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f1f1f1;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
}

/* Links inside the dropdown */
.dropdown-content a {
    color: black;
    padding: 10px 12px;
    text-decoration: none;
    display: block;
}

/* Change color of dropdown links on hover */
.dropdown-content a:hover {
    background-color: #ddd;
}

/* Toggle button underline when hovered */
.dropdown:hover .dropbtn {
    border-bottom: 0.2rem solid #c5050c;
}

.fa-caret-down {
    color: #c5050c;
    fill: #c5050c;
}

.fa-caret-up {
    color: #c5050c;
    fill: #c5050c;
}

/* Learning Options Table */
table.learning-options-table {
    width: 100%;
    border-collapse: collapse;
}

table.learning-options-table thead {
    border: 1px solid #f1f1f1;
}

table.learning-options-table th {
    text-align: center;
    text-transform: capitalize;
    padding: 0.5rem;
}

table.learning-options-table td {
    font-size: 0.875rem;
    padding: 0.5rem;
}

table.learning-options-table td.checkable {
    text-align: center;
}

table.learning-options-table td.checked::after {
    content: "X";
}

/* Responsive */
@media only screen and (max-width: 768px) {
    .mas-page-container,
    .mas-search-box {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .mas-page-title {
        font-size: 1.5rem;
    }

    .uw-column.equal-column {
        flex: 100%;
        min-width: 100%;
    }

    .uw-column.wide-column,
    .uw-column.narrow-column {
        flex: 100%;
        max-width: none;
    }

    .uw-column.narrow-column {
        margin-top: 2rem;
    }

    /* Letter search responsive */
    .letter-search-container {
        line-height: 2;
    }

    .letter-search {
        padding: 0.25rem;
    }

    /* Suggestion dropdown on mobile */
    .keyword-suggestions {
        position: relative;
        box-shadow: 0px 4px 8px 0px rgba(0,0,0,0.15);
    }

    /* Dropdown positioning on mobile */
    .dropdown-content {
        width: auto;
        max-height: 60vh;
        overflow-y: auto;
    }
}

@media only screen and (max-width: 480px) {
    .mas-page-title {
        font-size: 1.25rem;
    }

    .dropdown-content {
        min-width: auto;
    }

    .mas-search-box select,
    .mas-search-box input[type="text"] {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
}

/* Focus styles for accessibility */
.letter-search:focus {
    outline: 2px solid #0479a8;
    outline-offset: 2px;
}

.dropbtn:focus {
    outline: 2px solid #0479a8;
    outline-offset: 2px;
}

.dropdown-content a:focus-visible {
    outline: 2px solid #0479a8;
    outline-offset: -2px;
    background-color: #ddd;
}
