/* ==========================================================================
   Used Equipment Search - Ring Power
   Matches the approved mockup design with yellow accents, sidebar filters,
   image carousels, and structured equipment cards.
   ========================================================================== */

/* ---------- Variables ---------- */
:root {
    --rp-yellow: #F2C714;
    --rp-yellow-hover: #dab30f;
    --rp-dark: #333333;
    --rp-gray: #666666;
    --rp-light-gray: #f5f5f5;
    --rp-border: #e0e0e0;
    --rp-card-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ---------- Search Bar ---------- */
.used-search-bar {
    background: var(--rp-light-gray);
    border: 1px solid var(--rp-border);
    border-radius: 4px;
    padding: 20px 24px;
    margin-bottom: 24px;
}

.used-search-bar .form-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--rp-gray);
    margin-bottom: 6px;
}

.used-search-bar .form-control,
.used-search-bar .form-select {
    border-radius: 2px;
    border-color: var(--rp-border);
    font-size: 14px;
    height: 40px;
}

.used-search-bar .btn-search {
    background: var(--rp-yellow);
    color: var(--rp-dark);
    border: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 14px;
    padding: 10px 32px;
    height: 40px;
    border-radius: 2px;
    transition: background 0.2s;
}

.used-search-bar .btn-search:hover {
    background: var(--rp-yellow-hover);
}

/* ---------- Layout: Sidebar + Grid ---------- */
.used-equipment-layout {
    display: flex;
    gap: 24px;
}

.used-equipment-sidebar {
    flex: 0 0 240px;
    min-width: 240px;
}

.used-equipment-main {
    flex: 1;
    min-width: 0;
}

@media (max-width: 991px) {
    .used-equipment-layout {
        flex-direction: column;
    }
    .used-equipment-sidebar {
        flex: none;
        min-width: 0;
    }
}

/* ---------- Sidebar Filters ---------- */
.used-filter-section {
    margin-bottom: 16px;
    border-bottom: 2px solid var(--rp-yellow);
    padding-bottom: 16px;
}

.used-filter-section:last-child {
    border-bottom: none;
}

.used-filter-section__title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--rp-dark);
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.used-filter-section__title::after {
    content: '\25BC';
    font-size: 10px;
    color: var(--rp-gray);
    transition: transform 0.2s;
}

.used-filter-section__title.collapsed::after {
    transform: rotate(-90deg);
}

.used-filter-section__body {
    max-height: 200px;
    overflow-y: auto;
}

.used-filter-section__body label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--rp-dark);
    padding: 3px 0;
    cursor: pointer;
}

.used-filter-section__body input[type="checkbox"] {
    accent-color: var(--rp-yellow);
}

.used-active-filters {
    background: var(--rp-dark);
    color: #fff;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.used-active-filters__clear {
    background: none;
    border: none;
    color: var(--rp-yellow);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    padding: 0;
}

.used-active-filters__clear:hover {
    text-decoration: underline;
}

/* Active filter chips */
.used-active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.used-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--rp-light-gray);
    border: 1px solid var(--rp-border);
    border-radius: 2px;
    padding: 4px 8px;
    font-size: 12px;
    color: var(--rp-dark);
}

.used-filter-chip__remove {
    background: none;
    border: none;
    color: var(--rp-gray);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.used-filter-chip__remove:hover {
    color: var(--rp-dark);
}

/* ---------- Results Header ---------- */
.used-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--rp-border);
}

.used-results-header__count {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--rp-gray);
}

.used-results-header__count strong {
    color: var(--rp-dark);
}

/* ---------- Equipment Card ---------- */
.used-card {
    border: 1px solid var(--rp-border);
    border-radius: 0;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.used-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* Card image area */
.used-card__image {
    position: relative;
    background: #ddd;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.used-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.used-card__gallery-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(51, 51, 51, 0.82);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 5px 8px;
    border-radius: 3px;
}

.used-card__gallery-badge .icon {
    font-size: 14px;
}

/* Card body */
.used-card__body {
    padding: 12px 16px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Price sits under the name. Side by side, a long model name and "CALL FOR
   PRICE" fought for the same line and both got clipped. */
.used-card__title-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 8px;
}

.used-card__name {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--rp-dark);
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(2 * 1.3em);
}

.used-card__price {
    font-size: 18px;
    font-weight: 700;
    color: var(--rp-dark);
    white-space: nowrap;
}

/* Meta info row */
.used-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    font-size: 12px;
    color: var(--rp-gray);
    margin-bottom: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--rp-border);
}

.used-card__meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.used-card__meta-item .icon {
    font-size: 14px;
    color: var(--rp-gray);
    opacity: 0.75;
    flex-shrink: 0;
}

/* Card footer */
.used-card__footer {
    padding: 12px 16px;
    border-top: 1px solid var(--rp-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.used-card__compare {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--rp-gray);
    cursor: pointer;
}

.used-card__compare input[type="checkbox"] {
    accent-color: var(--rp-yellow);
}

.used-card__view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--rp-yellow);
    color: var(--rp-dark);
    border: none;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 16px;
    text-decoration: none;
    transition: background 0.2s;
}

.used-card__view-btn:hover {
    background: var(--rp-yellow-hover);
    color: var(--rp-dark);
    text-decoration: none;
}

.used-card__view-btn svg {
    width: 14px;
    height: 14px;
}

/* ---------- Results Grid ---------- */
.used-results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 1199px) {
    .used-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .used-results-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Pagination ---------- */
.used-pagination {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.used-pagination .pagination {
    gap: 4px;
}

.used-pagination .page-link {
    border-radius: 0;
    color: var(--rp-dark);
    font-size: 14px;
    font-weight: 600;
    border-color: var(--rp-border);
}

.used-pagination .page-item.active .page-link {
    background: var(--rp-yellow);
    border-color: var(--rp-yellow);
    color: var(--rp-dark);
}

/* ---------- Loading state ---------- */
.used-loading {
    text-align: center;
    padding: 60px 20px;
}

.used-loading .spinner-border {
    color: var(--rp-yellow);
    width: 3rem;
    height: 3rem;
}

/* ---------- Compare: disabled checkbox state ---------- */
.used-card__compare.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ---------- Compare Tray (sticky bottom bar) ---------- */
.used-compare-tray {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: var(--rp-dark);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.2);
}

.used-compare-tray__items {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    flex: 1;
}

.used-compare-tray__item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 2px;
    padding: 6px 28px 6px 6px;
    flex: 0 0 auto;
    max-width: 220px;
}

.used-compare-tray__item img {
    width: 40px;
    height: 30px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

.used-compare-tray__name {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.used-compare-tray__remove {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.used-compare-tray__remove:hover {
    color: #fff;
}

.used-compare-tray__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.used-compare-tray__limit {
    font-size: 12px;
    color: var(--rp-yellow);
    white-space: nowrap;
}

.used-compare-tray__limit[hidden] {
    display: none;
}

.used-compare-tray__compare {
    background: var(--rp-yellow);
    color: var(--rp-dark);
    border: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 13px;
    padding: 8px 20px;
    border-radius: 2px;
}

.used-compare-tray__compare:hover {
    background: var(--rp-yellow-hover);
    color: var(--rp-dark);
}

.used-compare-tray__clear {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    padding: 0;
}

.used-compare-tray__clear:hover {
    color: #fff;
    text-decoration: underline;
}

/* ----------------------------------------------------------------------
   Self-contained overlay modal (detail + compare).
   Intentionally NOT using Bootstrap's `.modal`: uSkinned hijacks every
   `.modal` with its full-screen mega-menu treatment + injected corner
   close button (see layouts/header-small.css). These own classes opt out.
   z-index sits above the uSkinned sticky/mega header (which can reach 1054).
   ---------------------------------------------------------------------- */
.used-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.used-modal[hidden] {
    display: none;
}

.used-modal.is-open {
    opacity: 1;
}

.used-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.used-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    max-width: 500px;
    max-height: calc(100vh - 48px);
    transform: translateY(12px);
    transition: transform 0.2s ease;
}

.used-modal.is-open .used-modal__dialog {
    transform: translateY(0);
}

.used-modal__dialog--lg {
    max-width: 800px;
}

.used-modal__dialog--xl {
    max-width: 1140px;
}

.used-modal__content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: calc(100vh - 48px);
    background: #fff;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
}

.used-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--rp-border);
    flex-shrink: 0;
}

.used-modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--rp-dark);
}

.used-modal__close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--rp-gray);
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s;
}

.used-modal__close:hover {
    color: var(--rp-dark);
}

.used-modal__body {
    padding: 20px;
    overflow-y: auto;
}

body.used-modal-open {
    overflow: hidden;
}

@media (max-width: 575px) {
    .used-modal {
        padding: 0;
    }

    .used-modal__dialog,
    .used-modal__content {
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
    }
}

/* ---------- Compare Modal Table ---------- */
.used-compare-table-wrap {
    overflow-x: auto;
}

.used-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.used-compare-table th,
.used-compare-table td {
    border: 1px solid var(--rp-border);
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
    min-width: 140px;
}

.used-compare-table__label {
    background: var(--rp-light-gray);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.03em;
    color: var(--rp-gray);
    white-space: nowrap;
    min-width: 90px;
}

.used-compare__img {
    width: 100%;
    max-width: 180px;
    aspect-ratio: 4/3;
    object-fit: cover;
}

.used-compare__remove {
    background: none;
    border: none;
    color: var(--rp-gray);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.used-compare__remove:hover {
    color: #e74c3c;
}

.used-compare__view {
    color: var(--rp-dark);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
}

.used-compare__view:hover {
    color: var(--rp-yellow-hover);
}

/* Keep results clear of the fixed compare tray */
.used-equipment-search.has-compare-tray {
    padding-bottom: 96px;
}
