/**
 * @package     Joomla.Site
 * @subpackage  mod_parcel
 *
 * @copyright   (C) 2026 Parcel Delivery. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

/* Heading levels are chosen by the module's "Heading Level" parameter and are
   semantic regardless of the SEO toggle. Visual size is controlled here with
   utility classes so the outline stays correct for screen readers and crawlers
   while still looking right. */
.mod-parcel .parcel-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: .25rem;
}

h1.mod-parcel .parcel-title {
    font-size: 1.75rem;
}

h3.mod-parcel .parcel-title,
h4.mod-parcel .parcel-title {
    font-size: 1.35rem;
}

.mod-parcel .parcel-area-heading {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

.parcel-location-content {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.parcel-location-content p {
    font-size: .9rem;
    color: #495057;
    margin: 0;
    line-height: 1.6;
}

.parcel-tips-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: .9rem;
    color: #495057;
}

.parcel-tips-list li {
    margin-bottom: .5rem;
}

.mod-parcel .parcel-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: #212529;
}

.mod-parcel .parcel-job-title {
    font-size: .92rem;
    font-weight: 700;
    margin: 0;
}

/* Ensure div-based card titles maintain heading styling */
.mod-parcel div.parcel-job-title {
    font-size: .92rem;
    font-weight: 700;
    margin: 0;
}

.mod-parcel .parcel-job-heading {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: .25rem;
}

.mod-parcel .parcel-client-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 .5rem;
}

/* Listing shell */
.mod-parcel-listing,
.mod-parcel-detail {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
}

.mod-parcel-listing .parcel-subtitle {
    color: #5c6570;
    margin-bottom: 1rem;
    font-size: .9rem;
}

/* Quick filter chips are anchors, so they need an explicit reset. */
.parcel-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 0;
    list-style: none;
}

.parcel-chip {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: .82rem;
    font-weight: 500;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #495057;
    text-decoration: none;
    transition: background-color .15s, border-color .15s, color .15s;
}

.parcel-chip:hover,
.parcel-chip:focus-visible {
    background: #e9ecef;
    border-color: #6c757d;
    color: #212529;
}

.parcel-chip.active {
    background: #0a58ca;
    color: #fff;
    border-color: #0a58ca;
}

/* Filter bar */
.parcel-filter-bar {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    margin-bottom: 1rem;
}

.parcel-filter-bar .form-label {
    font-size: .8rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
}

.parcel-filter-actions {
    display: flex;
    gap: .5rem;
    margin-top: 1rem;
}

.parcel-result-count {
    font-size: .85rem;
    color: #5c6570;
    margin-bottom: .75rem;
}

/* Job cards */
.parcel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* The grid owns card sizing. Bootstrap's .col-* classes set a percentage
   width, which still applies to grid items and shrank every card to a
   fraction of its track; reset it so columns stay equal and fill the row. */
.parcel-grid > .parcel-grid-item,
.parcel-grid > li {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    flex: none;
}

.parcel-job-card {
    position: relative;
    height: 100%;
    border-left: 4px solid #6c757d;
    transition: transform .15s, box-shadow .15s;
    background: #fff;
}

.parcel-job-card:hover,
.parcel-job-card:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .08);
}

/* stretched-link makes the whole card clickable while keeping a single real
   anchor in the accessibility tree. */
.parcel-job-link.stretched-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.parcel-job-card.status-open,
.parcel-job-card.status-delivered,
.parcel-job-card.status-completed {
    border-left-color: #198754;
}

.parcel-job-card.status-bidding {
    border-left-color: #a16207;
}

.parcel-job-card.status-assigned {
    border-left-color: #0a7d8c;
}

.parcel-job-card.status-in_progress {
    border-left-color: #0a58ca;
}

.parcel-job-card.status-cancelled {
    border-left-color: #dc3545;
}

.parcel-route {
    font-size: .82rem;
    color: #6c757d;
    margin-bottom: .5rem;
}

.parcel-route-arrow {
    margin: 0 .35rem;
}

.parcel-address h2,
.parcel-address h3 {
    font-size: .75rem;
    font-weight: 600;
    color: #6c757d;
    margin: 0;
}

.parcel-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    padding: 0;
    margin: 0 0 .5rem;
    list-style: none;
    font-size: .78rem;
}

.parcel-facts {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .5rem;
}

.parcel-budget {
    font-weight: 700;
    color: #0a58ca;
}

.parcel-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: auto 0 0;
    padding-top: .5rem;
    border-top: 1px solid #f1f3f5;
    font-size: .8rem;
    color: #6c757d;
}

/* Empty state */
.parcel-empty {
    text-align: center;
    padding: 60px 20px;
}

.parcel-empty-icon {
    font-size: 3rem;
    color: #5c6570;
    margin-bottom: .75rem;
}

.parcel-empty-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.parcel-pagination {
    margin-top: 1.5rem;
}

/* Detail layout */
.mod-parcel-detail .card-header {
    background: #fff;
}

.parcel-back-link {
    display: inline-block;
    margin-bottom: .75rem;
    text-decoration: none;
}

.parcel-job-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin: .25rem 0 0;
    font-size: .85rem;
}

.parcel-addresses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.parcel-address dt {
    font-size: .75rem;
    font-weight: 600;
    color: #6c757d;
}

.parcel-address dd {
    font-weight: 600;
    margin: 0;
}

.parcel-contact {
    background: rgba(25, 135, 84, .08);
    border-radius: 8px;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
}

.parcel-contact-title {
    font-size: .85rem;
    font-weight: 700;
    margin-bottom: .35rem;
}

.parcel-contact-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: .85rem;
}

.parcel-facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: .75rem;
    margin: 0;
    text-align: center;
}

.parcel-facts-grid dd {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    order: -1;
}

.parcel-facts-grid dt {
    font-size: .72rem;
    font-weight: 400;
    color: #6c757d;
}

.parcel-timeline {
    list-style: none;
    padding: 0;
    margin: 0;
}

.parcel-timeline-step {
    display: flex;
    gap: .75rem;
    padding-bottom: .75rem;
}

.parcel-timeline-marker {
    color: #6c757d;
    line-height: 1.4;
}

.parcel-timeline-step.is-done .parcel-timeline-marker {
    color: #198754;
}

.parcel-timeline-label {
    font-size: .9rem;
    font-weight: 600;
    margin: 0;
}

.parcel-timeline-time {
    display: block;
    font-size: .75rem;
    color: #6c757d;
}

.parcel-map {
    height: 200px;
    border-radius: 6px;
    background: #e9ecef;
}

.parcel-budget-hint {
    background: rgba(13, 202, 240, .1);
    border-radius: 8px;
    padding: .5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.parcel-bid-form input:disabled,
.parcel-bid-form select:disabled,
.parcel-bid-form textarea:disabled {
    background: #f1f3f5;
}

/* Bid confirmation shown after a simulated submission. */
.parcel-bid-result {
    border: 1px solid #198754;
    border-left: 4px solid #198754;
    border-radius: .375rem;
    background: #f1fbf5;
    padding: 1rem;
}

.parcel-bid-result-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #146c43;
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.parcel-bid-summary {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .25rem .75rem;
    margin: 0 0 .5rem;
    font-size: .88rem;
}

.parcel-bid-summary dt {
    font-weight: 600;
    color: #495057;
}

.parcel-bid-summary dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.parcel-bids-count {
    text-align: center;
    font-size: .78rem;
    color: #6c757d;
    margin: .5rem 0 0;
}

.parcel-closed-icon {
    font-size: 2rem;
    color: #6c757d;
}

.parcel-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0a58ca;
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: .5rem;
}

.parcel-rating {
    color: #a16207;
    margin-bottom: .5rem;
}

.parcel-share.is-copied::after,
.parcel-bookmark.is-active {
    color: #198754;
}

/* ---------------------------------------------------------------------------
   Standalone front-page layout
   --------------------------------------------------------------------------- */

.mod-parcel-front {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
}

/* Full-bleed: escape the template's constrained content column.
   100vw includes the scrollbar width, so the negative margin is capped. */
.mod-parcel-fullwidth {
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding-left: clamp(12px, 4vw, 40px);
    padding-right: clamp(12px, 4vw, 40px);
    border-radius: 0;
}

/* Only apply the bleed inside the content wrapper, never in the admin or
   in a template that already renders full width. */
.com_content .mod-parcel-fullwidth,
.mod-parcel-fullwidth.mod-parcel-front {
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, .04);
}

.parcel-hero {
    padding-bottom: .5rem;
}

.parcel-intro {
    color: #495057;
    max-width: 70ch;
}

.parcel-stat-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .75rem;
    margin: 1rem 0 0;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.parcel-stat-strip dt {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
}

.parcel-stat-strip dd {
    margin: .15rem 0 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #212529;
}

/* Breadcrumbs */
.parcel-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    list-style: none;
    margin: 0 0 .75rem;
    padding: 0;
    font-size: .8rem;
}

.parcel-breadcrumb li + li::before {
    content: "/";
    margin-right: .35rem;
    color: #6c757d;
}

.parcel-breadcrumb a {
    color: #0a58ca;
    text-decoration: none;
}

.parcel-breadcrumb a:hover,
.parcel-breadcrumb a:focus-visible {
    text-decoration: underline;
}

.parcel-breadcrumb [aria-current="page"] {
    color: #5c6570;
}

/* Equity-flow links on detail pages */
.parcel-related-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.parcel-related-list a {
    display: inline-block;
    padding: .35rem .75rem;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    background: #f8f9fa;
    color: #0a58ca;
    font-size: .85rem;
    text-decoration: none;
}

.parcel-related-list a:hover,
.parcel-related-list a:focus-visible {
    background: #e7f1ff;
    border-color: #0a58ca;
}

/* ---------------------------------------------------------------------------
   Accessibility
   --------------------------------------------------------------------------- */

/* Bootstrap's .text-muted is #6c757d, which measures 4.45:1 against this
   module's off-white surface (#f8f9fa) - just under the 4.5:1 AA threshold for
   body text. Overridden inside module scope only; #5c6570 measures 5.61:1 on
   the same surface and 5.91:1 on white.
   Bootstrap applies !important, so this needs !important to win. */
.mod-parcel .text-muted {
    color: #5c6570 !important;
}

/* Visible focus for keyboard users on the module's own interactive elements.
   Bootstrap removes outlines in places; never do that without replacing them. */
.mod-parcel a:focus-visible,
.mod-parcel button:focus-visible,
.mod-parcel select:focus-visible,
.mod-parcel input:focus-visible,
.mod-parcel textarea:focus-visible {
    outline: 3px solid #0a58ca;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Respect reduced-motion and high-contrast preferences. */
@media (prefers-reduced-motion: reduce) {
    .mod-parcel .parcel-job-card,
    .parcel-chip,
    .parcel-job-link::after {
        transition: none;
    }

    .mod-parcel .parcel-job-card:hover,
    .mod-parcel .parcel-job-card:focus-within {
        transform: none;
    }
}

@media (prefers-contrast: more) {
    .mod-parcel-front {
        border-color: #495057;
    }

    .parcel-chip {
        border-width: 2px;
    }

    /* Flatten the low-contrast fills that only matter cosmetically. */
    .parcel-contact,
    .parcel-budget-hint {
        border: 1px solid currentColor;
    }
}