/* ==========================================================================
   base.css — Core primitives shared by every page
   Part of the v2.0 CSS modularization. Loaded FIRST so variables, reset
   rules, and layout primitives are in place before any feature styles.

   Contents: variables, reset, body, theme classes, layout & typography,
   card/resource primitives, header & navigation, buttons & inputs,
   scroll-to-top, shared settings-accordion, lightbox, live-time, logos,
   footer, global media queries, Resources nav badge + tool-badge keyframes.
   ========================================================================== */

/* ==========================================================================
   Base Styles & Variables
   ========================================================================== */
@keyframes flash-effect {
    50% {
        box-shadow: 0 0 0 5px rgba(13, 110, 253, 0.7);
        border-color: var(--primary-blue);
    }
}

* {
    box-sizing: border-box;
}

:root {
    --primary-blue: #0d6efd;
    --light-bg: #f3f4f6;
    --dark-bg: #1a202c;
    --light-text: #333;
    --dark-text: #f8f8f8;
    --light-card-bg: #ffffff;
    --dark-card-bg: #212833;
    --highlight-outline-light: #fff;
    --highlight-outline-dark: #000;
    --border-light: #e5e7eb;
    --border-dark: #4a5568;
    --table-strip-light: #f9fafb;
    --table-strip-dark: #2c313a;
    --accent-red: #ef4444;
    --sunday-highlight-bg: #C0C0C0;
    --sunday-highlight-text: #333;
    --main-content-max-width: 720px;
    --carrier-black-bg: #000;
    --carrier-black-text: #fff;
    --carrier-black-day-cell-text: #fff;
    --carrier-yellow-bg: #ffea00;
    --carrier-yellow-text: #000;
    --carrier-yellow-day-cell-text: #000;
    --carrier-blue-bg: #1f51ff;
    --carrier-blue-text: #fff;
    --carrier-blue-day-cell-text: #fff;
    --carrier-green-bg: green;
    --carrier-green-text: #fff;
    --carrier-green-day-cell-text: #fff;
    --carrier-brown-bg: #7b3f00;
    --carrier-brown-text: #fff;
    --carrier-brown-day-cell-text: #fff;
    --carrier-red-bg: red;
    --carrier-red-text: #fff;
    --carrier-red-day-cell-text: #fff;
}

body {
    font-family: sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.theme-light {
    background-color: var(--light-bg);
    color: var(--light-text);
}

.theme-dark {
    background-color: var(--dark-bg);
    color: var(--dark-text);
}

/* ==========================================================================
   Layout & Typography
   ========================================================================== */
.wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 320px;
    overflow-x: hidden;
}

.container,
.main-content {
    width: 100%;
    max-width: var(--main-content-max-width);
}

.container {
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.main-content {
    flex-grow: 1;
    padding: 1.5rem 0;
    margin: 0 auto;
    min-width: 0;
}

.page-content-wrapper {
    padding: 1rem;
}

.page-content-wrapper.align-center,
.page-title {
    text-align: center;
}

.page-content-wrapper.align-left {
    text-align: left;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.page-title.tight-padding {
    padding-left: 0;
    padding-right: 0;
}

.info-text {
    padding: 0.5rem 0;
    line-height: 1.6;
}

.bg-usps-blue {
    background-color: var(--primary-blue);
}

.text-usps-blue {
    color: var(--primary-blue);
}

/* ==========================================================================
   Cards & Resources
   ========================================================================== */
.card-bg,
.resource-list li {
    background-color: var(--light-card-bg);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.theme-dark .card-bg,
.theme-dark .resource-list li {
    background-color: var(--dark-card-bg);
}

.resource-list {
    list-style: none;
    padding: 0;
    margin-top: 1.5rem;
}

.resource-list li {
    margin-bottom: 1rem;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease;
}

.resource-link {
    font-weight: 600;
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 1.1rem;
    display: block;
    margin-bottom: 0.25rem;
}

.resource-link:hover {
    text-decoration: underline;
}

.resource-description {
    font-size: 0.9rem;
    color: var(--light-text);
    line-height: 1.4;
}

.theme-dark .resource-description {
    color: var(--dark-text);
}

.resource-list a {
    word-break: break-word;
}

.card {
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.2s ease-in-out;
}

.theme-dark .card {
    border-color: var(--border-dark);
}

.card-carrier {
    background-color: #fff1f2;
    border-color: #fecaca;
}

.theme-dark .card-carrier {
    background-color: #3b1111;
    border-color: #b91c1c;
}

.card-customer {
    background-color: #f0fdf4;
    border-color: #dcfce7;
}

.theme-dark .card-customer {
    background-color: #1a2b1f;
    border-color: #15803d;
}

.card-carrier h4,
.card-customer h4 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.card-carrier h4 {
    color: #b91c1c;
}

.card-customer h4 {
    color: #15803d;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.header {
    background-color: var(--primary-blue);
    color: #fff;
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

.header-accent-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--accent-red);
    height: 3px;
}

.nav-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    gap: 0.5rem;
}

#theme-toggle {
    display: flex;
    align-items: center;
    order: 1;
    padding: 0;
    background: 0 0;
    border: 0;
    cursor: pointer;
    justify-content: center;
}

.theme-icon-img {
    width: 100%;
    height: auto;
    display: block;
    max-width: 35px;
    min-width: 20px;
    transition: transform 0.2s ease-in-out;
}

.theme-icon-img:hover {
    transform: scale(1.1);
}

.theme-icon-img:active {
    transform: scale(0.9);
}

.home-link {
    border-radius: 0.375rem;
    align-items: center;
    flex-shrink: 0;
    flex-grow: 0;
    width: auto;
    order: 2;
    font-size: 1.5rem;
    font-weight: 700;
    padding: 0.5rem;
    display: flex;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.3s ease;
    border: 0;
    margin-left: 0.5rem;
    margin-right: auto;
}

.install-app-button {
    border-radius: 0.375rem;
    align-items: center;
    flex-shrink: 0;
    flex-grow: 0;
    width: auto;
    order: 3;
    margin-left: auto;
    padding: 0.5rem 1rem;
    background: 0 0;
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    display: none;
    gap: 0.5rem;
}

.install-app-button .install-app-text {
    display: none;
}

.install-app-button::before {
    content: "⬇";
    font-size: 1.2rem;
    line-height: 1;
}

.nav-links-group {
    order: 4;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-grow: 1;
    justify-content: center;
    flex-shrink: 1;
    min-width: 0;
    width: 100%;
    margin-top: 0.5rem;
}

.nav-link {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    text-decoration: none;
    color: inherit;
    white-space: nowrap;
    font-size: clamp(0.8rem, 3vw, 1rem);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    background: 0 0;
    border: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.nav-link:active {
    background-color: rgba(255, 255, 255, 0.35);
    transform: translateY(1px);
}

/* Hide Scrollbars */
.acronyms-controls-group::-webkit-scrollbar,
.calendar-main-nav::-webkit-scrollbar,
.calendar-year-controls::-webkit-scrollbar,
.carrier-buttons-grid::-webkit-scrollbar,
.lightbox-content::-webkit-scrollbar,
.nav-links-group::-webkit-scrollbar,
.pay-period-controls-group::-webkit-scrollbar,
.t6-route-inputs::-webkit-scrollbar,
.user-control-nav-box::-webkit-scrollbar {
    display: none;
}

/* ==========================================================================
   Buttons & Inputs
   ========================================================================== */
.button-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.button {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.primary-button {
    background-color: var(--primary-blue);
    color: #fff;
    border: 1px solid var(--primary-blue);
}

.primary-button:hover {
    background-color: rgba(13, 110, 253, 0.8);
    transform: translateY(-2px);
}

.primary-button:active {
    background-color: rgba(13, 110, 253, 0.9);
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.nav-button,
input[type=text] {
    border: 1px solid var(--border-light);
    border-radius: 0.375rem;
    color: var(--light-text);
}

.nav-button {
    padding: 0.5rem 1rem;
    background-color: var(--light-bg);
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

.nav-button.tight-padding {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.nav-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.nav-button:active {
    background-color: rgba(0, 0, 0, 0.1);
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.theme-dark .nav-button {
    background-color: var(--dark-card-bg);
    color: var(--dark-text);
    border-color: var(--border-dark);
}

.theme-dark .nav-button:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.theme-dark .nav-button:active {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

input[type=text] {
    padding: 0.75rem 1rem;
    background-color: var(--light-card-bg);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
}

input[type=text]:focus {
    outline: 0;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.theme-dark input[type=text]:focus {
    border-color: var(--dark-text);
    box-shadow: 0 0 0 3px rgba(248, 248, 248, 0.25);
}

.scroll-to-top-button {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-blue);
    color: #fff;
    border: 0;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.scroll-to-top-button.hidden {
    opacity: 0;
    visibility: hidden;
}

.scroll-to-top-button:hover {
    background-color: rgba(13, 110, 253, 0.8);
}

.scroll-to-top-button:active {
    transform: translateX(-50%) translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Settings Accordion */
.settings-accordion {
    margin: 0 1rem 1.5rem;
}

.settings-accordion.nested {
    margin-top: 0.25rem;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0;
}

.settings-accordion-toggle {
    width: 100%;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: left;
    color: var(--light-text);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
    padding: 1rem;
    background-color: var(--light-card-bg);
    border: 1px solid var(--border-light);
}

.settings-accordion.nested .settings-accordion-toggle {
    font-size: 1rem;
    padding: 0.5rem;
}

.settings-accordion-toggle:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.theme-dark .settings-accordion-toggle:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.settings-accordion-toggle::after {
    content: 'Open';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    transition: color 0.3s ease, content 0.3s ease;
    color: #28a745;
    font-weight: 600;
    font-size: 1rem;
}

.settings-accordion.nested .settings-accordion-toggle::after {
    font-size: 0.9rem;
    right: 0.75rem;
}

.settings-accordion-toggle.active::after {
    content: 'Close';
    color: var(--accent-red);
}

.settings-accordion-panel {
    display: none;
    border-top: 0;
    border-radius: 0 0 0.5rem 0.5rem;
    padding: 0.5rem;
    background-color: var(--light-card-bg);
    border: 1px solid var(--border-light);
    border-top: 0;
}

.settings-accordion-panel.show {
    display: block;
}

.theme-dark .settings-accordion-panel {
    background-color: var(--dark-card-bg);
    border-color: var(--border-dark);
}

.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.theme-dark .settings-section-title {
    border-bottom-color: var(--border-dark);
}

/* ==========================================================================
   Typography Extras & Other Elements
   ========================================================================== */
.acronym-highlight {
    font-weight: 700;
}

.homepage-description {
    font-size: clamp(1rem, 3vw, 1.25rem);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    margin-bottom: 1.5rem;
}

.homepage-info-text {
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.acronyms-controls-group {
    display: flex;
    align-items: center;
    text-align: center;
    flex-wrap: nowrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--light-card-bg);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.theme-dark .acronyms-controls-group {
    background-color: var(--dark-card-bg);
}

/* Live Time UI */
.live-time-container {
    color: #fff;
    text-align: center;
    padding: 0.2rem 1rem;
    font-size: clamp(0.7rem, 2.5vw, 0.85rem);
    font-family: sans-serif;
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    flex-grow: 1;
}

/* Lightbox UI */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.3s;
}

.lightbox-overlay.active {
    visibility: visible;
    opacity: 1;
}

.lightbox-content {
    background-color: var(--light-card-bg);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    max-height: 90%;
    overflow-y: auto;
    scrollbar-width: none;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.lightbox-overlay.active .lightbox-content {
    transform: scale(1);
}

.theme-dark .lightbox-content {
    background-color: var(--dark-card-bg);
}

.lightbox-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: 0 0;
    border: 0;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--light-text);
    padding: 0.5rem;
    line-height: 1;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.lightbox-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.theme-dark .lightbox-close {
    color: var(--dark-text);
}

.theme-dark .lightbox-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.lightbox-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-blue);
}

.lightbox-event-list {
    margin-bottom: 1.5rem;
}

.lightbox-event-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.lightbox-event-item:last-child {
    margin-bottom: 0;
}

.lightbox-event-icon {
    width: 2.5em;
    height: 2.5em;
    flex-shrink: 0;
    object-fit: contain;
}

.lightbox-event-details h4 {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
}

.lightbox-event-details p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Logos & Footer */
.logo-display-area {
    margin-top: 3rem;
    text-align: center;
}

.mcore-logo-large {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 0.75rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.footer {
    background-color: var(--primary-blue);
    color: #fff;
    padding: 1.5rem 0.5rem;
    text-align: center;
    font-size: clamp(0.65rem, 2.5vw, 0.9rem);
    margin-top: auto;
    position: relative;
}

.footer p {
    margin: 0.35rem 0;
    line-height: 1.55;
}
.footer-line-actions,
.footer-line-meta {
    /* Allow the line to wrap on narrow screens instead of being truncated,
       but keep individual link+separator pairs together by preventing breaks
       inside the inline links themselves. */
    word-spacing: 0.05em;
}
.footer-line-actions .footer-link,
.footer-line-meta .footer-link {
    display: inline-block;
    white-space: nowrap;
}

.footer-link {
    color: #fff;
    text-decoration: none;
    margin: 0 0.5rem;
}

.footer-link:hover {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: underline;
}

.red-heart {
    color: var(--accent-red);
}

.footer-accent-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--accent-red);
}

/* ==========================================================================
   Media Queries
   ========================================================================== */
@media (max-width: 480px) {
    .user-control-nav-box .nav-button .full-text {
        display: none;
    }
    .user-control-nav-box .nav-button .short-text {
        display: inline;
    }
}

@media (max-width: 767px) {
    .nav-link {
        flex-grow: 1;
        padding: 0.75rem 0.5rem;
    }
    .nav-links-group {
        gap: 0.25rem;
    }
}

@media (min-width: 768px) {
    .nav-container {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: center;
        gap: 1rem;
    }
    .home-link {
        margin-right: 1rem;
        order: 2;
        margin-left: 0;
    }
    #theme-toggle {
        order: 1;
        margin-right: 0;
    }
    .install-app-button {
        order: 4;
        margin-left: 0;
        margin-right: 0;
    }
    .install-app-button .install-app-text {
        display: inline;
    }
    .install-app-button::before {
        content: "";
    }
    .nav-links-group {
        order: 3;
        width: auto;
        justify-content: flex-end;
        margin-top: 0;
        margin-left: auto;
        flex-grow: 0;
    }
    .install-app-button.hidden + .nav-links-group {
        margin-left: auto;
    }
    .page-content-wrapper {
        padding: 1.5rem 2rem;
    }
    .page-title {
        font-size: 2.5rem;
    }
    .homepage-description {
        font-size: 1.5rem;
    }
    .mcore-logo-large {
        max-width: 300px;
    }
    .carrier-buttons-grid {
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    .carrier-color-button {
        max-width: calc((100% / 7) - 0.75rem);
    }
    .acronyms-controls-group {
        flex-wrap: nowrap;
        justify-content: center;
    }
    .acronyms-controls-group .acronym-search-wrapper {
        justify-content: center;
    }
    input[type=text] {
        max-width: 400px;
    }
}

@media (min-width: 1024px) {
    .header nav.nav-container {
        padding: 0 2rem;
    }
    .main-content {
        padding: 2rem 0;
    }
    .page-title {
        font-size: 3rem;
    }
    .homepage-description {
        font-size: 1.75rem;
    }
    .carrier-buttons-grid {
        padding: 1.5rem 3rem;
    }
}
/* ==========================================================================
   Resources nav-link badge — aggregate count across every registered tool
   that has a "needs attention" badge provider. Today: Route Forward Manager.
   Tomorrow: any tool that calls registerToolBadge() in app.js.
   Red = at least one urgent item (expired / ≤7 days). Amber = warn-only.
   ========================================================================== */
.resources-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    border-radius: 9px;
    background: #6b7280;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.resources-nav-badge.hidden { display: none; }
.resources-nav-badge-warn { background: #f59e0b; color: #1f2937; }
.resources-nav-badge-urgent {
    background: #dc2626;
    color: #fff;
    animation: tool-badge-pulse 2.4s ease-in-out infinite;
}
@keyframes tool-badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55); }
    50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .resources-nav-badge-urgent,
    .featured-tool-badge-urgent { animation: none; }
}

