/**
 * Product Listing Styles - Core/Shared
 * Uses branding.css variables for consistent styling
 * Mobile and desktop: see listing-mobile.css and listing-desktop.css
 */

/* =================================
   Listing Grid Container
   ================================= */
.products.wrapper.list {
    margin: 0;
    padding: 1rem 0;
}

.products.list.items.product-items {
    list-style: none;
    padding: 0;
    margin: 0;
    max-width: var(--content-max-width, 1200px);
    margin: 20px auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

/* =================================
   Product Card (Listing Card)
   ================================= */
.product-item-info.card {
    background-color: var(--k-0);
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* =================================
   Product Image Section
   ================================= */
/* Container link */
a.product-item-photo {
    position: relative;
    width: 100%;
    display: block;
    overflow: hidden;
}

/* Override Magento's inline styles - simpler approach since view.xml is 4:3 */
a.product-item-photo > span[class*="product-image-container"] {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 75% !important; /* 4:3 aspect ratio = 3/4 = 75% */
    overflow: hidden !important;
}

a.product-item-photo > span[class*="product-image-container"] > span.product-image-wrapper {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
}

a.product-item-photo > span[class*="product-image-container"] > span.product-image-wrapper > img.product-image-photo {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
}

/* =================================
   Property Badges (Status & Type)
   ================================= */
.property-badge {
    position: absolute;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #FFFFFF;
    background-color: var(--era-navy);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    font-family: var(--font-secondary);
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Status Badge - Positioned Top Left */
.property-badge.status-badge {
    top: 10px;
    left: 10px;
}

/* Type Badge - Positioned Top Right */
.property-badge.type-badge {
    top: 10px;
    right: 10px;
}

/* =================================
   Property Status Badge Colors
   ================================= */
.status-badge.status-active {
    background-color: #28a745;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.status-badge.status-contingent {
    background-color: #ffc107;
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #212529;
}

.status-badge.status-pending {
    background-color: #17a2b8;
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.status-badge.status-sold {
    background-color: #8A1538;
    background: linear-gradient(135deg, #8A1538 0%, #6d1129 100%);
}

.status-badge.status-withdrawn {
    background-color: #6c757d;
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}

.status-badge.status-deleted {
    background-color: #495057;
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
}

.status-badge.status-expired {
    background-color: #adb5bd;
    background: linear-gradient(135deg, #adb5bd 0%, #868e96 100%);
}

.status-badge.status-canceled {
    background-color: #dc3545;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

/* =================================
   Property Type Badge Colors
   ================================= */
.type-badge.type-residential {
    background-color: #0d6efd;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
}

.type-badge.type-multifamily {
    background-color: #6f42c1;
    background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%);
}

.type-badge.type-land {
    background-color: #198754;
    background: linear-gradient(135deg, #198754 0%, #146c43 100%);
}

.type-badge.type-farm {
    background-color: #8B4513;
    background: linear-gradient(135deg, #8B4513 0%, #6d3510 100%);
}

.type-badge.type-commercial {
    background-color: #1B365D;
    background: linear-gradient(135deg, #1B365D 0%, #152949 100%);
}

.type-badge.type-condo {
    background-color: #20c997;
    background: linear-gradient(135deg, #20c997 0%, #17a085 100%);
}

.type-badge.type-townhouse {
    background-color: #fd7e14;
    background: linear-gradient(135deg, #fd7e14 0%, #dc6502 100%);
}

/* =================================
   Legacy Badge Support (Featured, New)
   ================================= */
.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 9px;
    border-radius: 3px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #FFFFFF;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    z-index: 2;
    font-family: var(--font-primary);
    line-height: 1;
}

.product-badge.featured {
    background-color: #E4002B;
}

.product-badge.new {
    background-color: #FF671F;
}

.product-badge.sold {
    background-color: #8A1538;
}

/* =================================
   Product Price Bar (Below Image)
   ================================= */
.listing-price-bar {
    background-color: var(--era-navy);
    padding: 5px;
    text-align: center;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70px;
    position: relative;
}

.listing-price-bar .price-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    position: relative;
}

.listing-price-bar .price {
    font-size: 2rem;
    color: var(--k-0);
    font-weight: 700;
    font-family: var(--font-primary);
    line-height: 1.2;
}

/* Old price - positioned top-left */
.listing-price-bar .old-price {
    display: block;
    position: absolute;
    top: -10px;
    left: 10px;
}

.listing-price-bar .old-price .price {
    font-size: 0.75rem;
    color: #FFFFFF;
    text-decoration: line-through;
    font-weight: 400;
    line-height: 1;
}

/* Special price - stays centered like regular price */
.listing-price-bar .special-price {
    display: block;
}

.listing-price-bar .special-price .price {
    font-size: 2rem;
    color: #FFFFFF;
    font-weight: 700;
    line-height: 1.2;
}

.listing-price-bar .price-suffix {
    font-size: 0.875rem;
    color: var(--k-0);
    font-weight: 600;
    margin-left: 2px;
}

/* Price Change Badge - positioned over image (bottom left) */
.price-change-badge-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #FFFFFF;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 3;
    font-family: var(--font-secondary);
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 4px;
}

.price-change-badge-overlay.price-down {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.price-change-badge-overlay.price-up {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.price-change-badge-overlay .arrow {
    font-size: 1rem;
    font-weight: 700;
}

/* =================================
   Product Details Section
   ================================= */
.product-item-details.card-body {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-item-name {
    margin-top: 0;
    margin-bottom: 6px;
    font-size: 1.05rem;
    font-family: var(--font-primary);
    font-weight: 600;
    line-height: 1.3;
}

.product-item-link {
    color: #1B365D;
    text-decoration: none;
}

.product-item-link:hover {
    color: var(--era-red);
}

/* Product Address */
.product-address {
    margin: 0 0 8px 0;
    font-size: 0.8125rem;
    color: #6C757D;
    line-height: 1.4;
}

/* =================================
   Product Features List
   ================================= */
.product-features {
    display: flex;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
    flex-wrap: wrap;
}

.product-features li {
    display: flex;
    align-items: center;
    font-size: 0.8125rem;
    color: #6C757D;
    font-weight: 400;
}

/* Icon Styling */
.product-features i {
    color: #41B6E6;
    margin-right: 3px;
    font-size: 0.875rem;
}

.product-features i.bi {
    font-family: "bootstrap-icons" !important;
    font-style: normal;
    font-weight: normal !important;
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
}

/* Feature value (number) */
.feature-value {
    font-weight: 500;
    color: #2C3E50;
    margin-right: 1px;
}

/* Feature Label Styling */
.feature-label {
    font-family: var(--font-secondary);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #6C757D;
    font-weight: 400;
}

/* =================================
   Product Description
   ================================= */
.product-item-description {
    flex-grow: 1;
    margin: 0 0 15px 0;
    font-size: 0.8125rem;
    color: #6C757D;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =================================
   Price Box (in details section, fallback)
   ================================= */
.product-item-details .price-box {
    font-family: var(--font-primary);
    font-weight: 700;
    color: var(--era-navy);
    margin-bottom: 10px;
}

.product-item-details .price-box .price {
    font-size: 1.25rem;
    color: var(--era-red);
}

.product-item-details .price-box .old-price .price {
    font-size: 1rem;
    color: var(--k-70);
    text-decoration: line-through;
}

.product-item-details .price-box .special-price .price {
    color: var(--era-dark-red);
}

/* =================================
   Actions & Buttons
   ================================= */
.product-item-actions {
    margin-top: auto;
}

.product-item-actions .tocart,
.product-item-actions .action.primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #E4002B;
    --bs-btn-border-color: #E4002B;
    --bs-btn-hover-bg: #C80026;
    --bs-btn-hover-border-color: #C80026;
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: none;
    border-radius: 4px;
    color: var(--bs-btn-color);
    background-color: var(--bs-btn-bg);
    border-color: var(--bs-btn-border-color);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-family: var(--font-secondary);
    width: 100%;
}

.product-item-actions .tocart:hover,
.product-item-actions .action.primary:hover {
    color: var(--bs-btn-color);
    background-color: var(--bs-btn-hover-bg);
    border-color: var(--bs-btn-hover-border-color);
}

/* Stock status */
.stock {
    padding: 0.5rem;
    text-align: center;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.stock.available {
    background: var(--era-light-blue);
    color: var(--k-0);
}

.stock.unavailable {
    background: var(--k-30);
    color: var(--k-70);
}

/* Disabled button state */
.product-item-actions .tocart.disabled,
.product-item-actions .action.primary.disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.product-item-actions .tocart.disabled:hover,
.product-item-actions .action.primary.disabled:hover {
    background-color: var(--bs-btn-bg);
    border-color: var(--bs-btn-border-color);
}

/* =================================
   Toolbar (Sorting, Pagination)
   ================================= */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--k-10);
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-sorter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toolbar-sorter label {
    font-weight: 600;
    margin: 0;
    color: var(--k-90);
}

.toolbar-sorter select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--k-30);
    border-radius: 0.25rem;
    font-size: 0.875rem;
    background: var(--k-0);
}

.toolbar-amount {
    font-size: 0.875rem;
    color: var(--k-70);
}

/* Pagination */
.pages {
    text-align: center;
    margin-top: 2rem;
}

.pages .items {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.pages .item {
    display: inline-block;
}

.pages .item a,
.pages .item strong {
    display: block;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--k-30);
    border-radius: 0.25rem;
    text-decoration: none;
    color: var(--k-90);
    transition: all 0.2s ease;
}

.pages .item a:hover {
    background: var(--era-red);
    color: var(--k-0);
    border-color: var(--era-red);
}

.pages .item.current strong {
    background: var(--era-navy);
    color: var(--k-0);
    border-color: var(--era-navy);
}

/* =================================
   Empty Results
   ================================= */
.message.info.empty {
    padding: 2rem;
    background: var(--k-10);
    border-left: 4px solid var(--era-light-blue);
    border-radius: 0.25rem;
    text-align: center;
    font-size: 1.125rem;
    color: var(--k-70);
}
