/**
 * Reusable Component Styles
 * Single source of truth for listing cards, action bar, contact pills, share, etc.
 */

/* ===== LISTING CARD (unified .listing-card) ===== */
.listing-card,
.listing-card.car-card,
.listing-card.neat-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    height: 100%;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.listing-card:hover,
.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.listing-card .card-img-top {
    aspect-ratio: 4/3;
    width: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.listing-card:hover .card-img-top {
    transform: scale(1.02);
}

.listing-card .card-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 0.25rem;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    color: #1e293b;
    height: 2.6em; /* Fixed height for 2 lines */
}

.listing-card .listing-price,
.listing-card .price {
    font-size: 14px !important;
    font-weight: 700;
    color: #059669;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 768px) {
    .listing-card .card-title {
        font-size: 16px;
    }
    .listing-card .listing-price,
    .listing-card .price {
        font-size: 18px !important;
    }
}

/* Share dropdown (listing sidebar): stay above flex neighbors for reliable taps on mobile */
.share-dropdown-wrapper {
    position: relative;
    z-index: 2;
}

/* Listing card - favorite button */
.listing-card .favorite-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 3;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.listing-card .favorite-btn:hover {
    color: #ef4444;
    background: white;
}

.listing-card .favorite-btn i.fas.fa-heart {
    color: #ef4444;
}

/* Full card: year badge is top-right; move heart below it so year stays readable */
.listing-card--fav-year .favorite-btn {
    top: 2.75rem;
}

/* Vehicle specs mini (homepage/full variant) */
.vehicle-specs-mini {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.vehicle-spec-item-mini {
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    white-space: nowrap;
    line-height: 1.2;
    background-color: #f1f5f9 !important;
    color: #475569 !important;
}

.vehicle-spec-item-mini i {
    font-size: 0.6rem;
    color: #64748b;
}

/* Neat specs (default/pinned variant) */
.neat-spec {
    font-size: 0.75rem;
    color: #64748b;
}

/* Condition Badge (Jiji style) */
.badge-condition {
    display: inline-block;
    padding: 4px 8px;
    background-color: #fff7ed; /* Light orange background */
    color: #c2410c; /* Dark orange text */
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    line-height: 1;
}

.badge-condition-outline {
    background-color: transparent;
    border: 1px solid #e2e8f0;
    color: #64748b;
}

/* Listing card compact (similar vehicles) */

.listing-card--compact .card-body {
    padding: 0.5rem;
}

@media (min-width: 768px) {
    .listing-card--compact .card-body { padding: 0.75rem; }
}
@media (min-width: 992px) {
    .listing-card--compact .card-body { padding: 1rem; }
}

/* Pinned badge overlay */
.pinned-badge-overlay .badge {
    font-size: 0.7rem;
    font-weight: 600;
}

/* ===== ACTION CONNECT BAR ===== */
.action-connect-bar {
    position: sticky;
    top: 70px;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 100px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin: 0 auto 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: fit-content;
    max-width: 95%;
    border: 1px solid #e2e8f0;
}

.action-connect-bar.has-prompt {
    justify-content: space-between;
    width: 100%;
    max-width: 700px;
    padding: 10px 20px;
}

@media (max-width: 767px) {
    .action-connect-bar {
        border-radius: 0;
        margin: 0 0 25px 0;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 10px 12px;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    .action-connect-bar .connect-prompt {
        display: none !important;
    }
    .action-connect-bar .action-buttons {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        width: 100%;
        min-width: 0;
    }
}

.connect-prompt {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.95rem;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

/* ===== CONTACT PILLS ===== */
.btn-contact-pill {
    border-radius: 100px;
    padding: 8px 20px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-size: 0.9rem;
    text-decoration: none !important;
}

.btn-contact-pill.btn-call {
    background: #000;
    color: #fff;
    border: none;
}

.btn-contact-pill.btn-call:hover {
    background: #333;
    color: #fff;
}

.btn-contact-pill.btn-whatsapp {
    background: #25D366;
    color: #fff;
    border: none;
}

.btn-contact-pill.btn-whatsapp:hover {
    background: #20bd5a;
    color: #fff;
}

@media (max-width: 767px) {
    .btn-contact-pill {
        padding: 8px 14px;
        font-size: 0.8rem;
        flex: 0 0 auto;
        min-width: 0;
        justify-content: center;
    }
}

/* ===== SHARE BUTTON ===== */
.btn-circle-action {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    background: #fff;
    transition: all 0.2s ease;
}

.btn-circle-action:hover {
    color: #2E6A2E;
    border-color: #2E6A2E;
    background: rgba(46, 106, 46, 0.05);
}

/* Share dropdown: ensure menu is visible on desktop (not clipped by sticky/overflow) */
.share-dropdown-wrapper .dropdown-menu {
    z-index: 1060;
}

/* ===== BENTO CARD ===== */
.bento-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Equal height only in grid contexts (e.g. listing card grids); dashboard form sections stay content-sized */
.row > [class*="col-"] > .bento-card {
    height: 100%;
}

/* On mobile, reset equal-height so cards don't get empty space below short content */
@media (max-width: 767px) {
    .row > [class*="col-"] > .bento-card {
        height: auto;
    }
}

/* ===== SELLER INFO / CONTACT SECTION ===== */
.contact-section {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 8px;
}

.icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2E6A2E 0%, #1e4a1e 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.contact-section h6 {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.user-avatar-large {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Pinned listings scroll wrapper */
.seller-hero-connect-wrapper {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

/* ===== MODERN FORM INPUTS ===== */
.form-control-modern {
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid #d1d5db;
    transition: all 0.2s ease;
    background-color: #f9fafb;
    width: 100%;
    color: #374151;
}

.form-control-modern:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background-color: white;
    outline: none;
}

.form-control-modern::placeholder {
    color: #9ca3af;
}

.form-control-modern:disabled {
    background-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* ===== BENTO SPECIFICATIONS GRID ===== */
.bento-spec-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.bento-spec-item {
    background: #f8fafc;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.bento-spec-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.bento-spec-item .spec-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 4px;
}

.bento-spec-item .spec-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 575px) {
    .bento-spec-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== PREMIUM PRICE CARD ===== */
.premium-price-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: visible;
}

.premium-price-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: 16px 16px 0 0;
    background: linear-gradient(90deg, #3b82f6, #059669);
}

/* ===== MOBILE STICKY FOOTER ===== */
.mobile-sticky-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1040;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.mobile-sticky-footer .footer-price {
    display: flex;
    flex-direction: column;
}

.mobile-sticky-footer .footer-price .label {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mobile-sticky-footer .footer-price .value {
    font-size: 1.25rem;
    font-weight: 800;
    color: #059669;
    line-height: 1.1;
}

.mobile-sticky-footer .footer-actions {
    display: flex;
    gap: 8px;
    min-width: 140px;
}

.mobile-sticky-footer .btn-call {
    background: #0f172a;
    color: white;
    border-radius: 8px;
    font-weight: 600;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    transition: background 0.2s;
}

.mobile-sticky-footer .btn-call:hover {
    background: #1e293b;
    color: white;
}

.mobile-sticky-footer .btn-whatsapp {
    background: #25D366;
    color: white;
    border-radius: 8px;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.2s;
}

.mobile-sticky-footer .btn-whatsapp:hover {
    background: #20bd5a;
    color: white;
}

@media (max-width: 767px) {
    /* Only pages with the listing sticky bar need bottom padding (see listing.php .mobile-sticky-footer) */
    body:has(.mobile-sticky-footer) {
        padding-bottom: 74px;
    }
}

/* ===== SAVE SEARCH BANNER ===== */
.save-search-banner {
    border-radius: 10px;
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    border: 1px solid #bfdbfe;
    overflow: hidden;
}

.save-search-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
}

.save-search-banner-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #334155;
    font-weight: 500;
    min-width: 0;
}

.save-search-banner-text i {
    font-size: 1.1rem;
    color: #3b82f6;
    flex-shrink: 0;
}

.save-search-banner-btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 6px 14px;
    white-space: nowrap;
    transition: background 0.2s;
}

.save-search-banner-btn:hover {
    background: #2563eb;
    color: #fff;
}

@media (max-width: 575px) {
    .save-search-banner-inner {
        flex-direction: column;
        text-align: center;
        padding: 10px 12px;
    }
    .save-search-banner-btn {
        width: 100%;
    }
}
