/* Search Results Styles - Orange Theme */

/* Search Results Header */
.search-results-header {
    background-color: #2c3e50;
    padding: 1.5rem;
    margin-bottom: 0;
    border-radius: 8px 8px 0 0;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

.search-query-display {
    color: #ffffff;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.query-label {
    font-weight: 400;
}

.query-value {
    font-weight: 700;
}

/* Brand Filter - Simple Text Buttons */
.brand-filter-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-label {
    color: #ffffff;
    font-weight: 500;
    white-space: nowrap;
}

.brand-buttons {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    line-height: 1.4;
}

.brand-btn {
    background: none;
    border: none;
    color: #d0d0d0;
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    transition: all 0.15s;
    border-bottom: 2px solid transparent;
}

.brand-btn:hover {
    color: #ffffff;
}

.brand-btn.active {
    color: #ffffff;
    font-weight: 600;
    border-bottom-color: #FF7F2A;
}

.brand-separator {
    color: #666;
    font-size: 0.9rem;
    padding: 0 0.25rem;
}

/* Secondary Filter Bar */
.filter-bar {
    background-color: #e8e8e8;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-radius: 0 0 8px 8px;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

.filter-bar-left {
    font-size: 0.9rem;
    color: #333;
}

.search-again-link {
    color: #FF7F2A;
    font-weight: 600;
    text-decoration: none;
}

.search-again-link:hover {
    text-decoration: underline;
}

.filter-bar-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.sort-link {
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

.sort-link:hover, .sort-link.active {
    color: #FF7F2A;
    font-weight: 600;
}

/* Own stock filter button */
.userstock-filter-btn {
    background: transparent;
    border: 1px solid #dee2e6;
    color: #000000;
    font-size: 0.9rem;
    font-weight: normal;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.userstock-filter-btn:hover {
    border-color: #adb5bd;
}

/* Checkmark hidden by default */
.userstock-filter-btn .checkmark {
    display: none;
    color: #28a745;
    margin-right: 0.3rem;
}

/* Show checkmark and highlight when active */
.userstock-filter-btn.active {
    font-weight: bold;
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.05);
}

.userstock-filter-btn.active .checkmark {
    display: inline;
}

/* Product Grid - 2 Columns */
.product-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 600px));
    gap: 1.5rem;
    margin-bottom: 2rem;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
}

/* Horizontal Product Card */
.product-card-horizontal {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    transition: box-shadow 0.2s;
    height: 320px; /* Fixed height for uniform cards */
    max-width: 100%; /* Prevent cards from exceeding grid column width */
    width: 100%;
}

.product-card-horizontal:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Product Image Section (Left) */
.product-image-section {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #ffffff; /* Changed from #f9f9f9 to white */
    padding: 0.25rem; /* Minimal padding */
    border-radius: 8px;
}

.image-link {
    display: block;
    flex: 1;
    display: flex;
    flex-direction: column;
    text-decoration: none;
}

.image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.image-container img {
    max-width: 100%;
    max-height: 230px;
    object-fit: contain;
}

/* Price Display in Left Column */
.price-display-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.price-display-left .current-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: #000;
}

.price-display-left .old-price {
    font-size: 1rem;
    color: #999;
    text-decoration: line-through;
}

.price-display-left .sale-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: #FF7F2A;
}

/* Ribbon Wrapper and Badge */
.ribbon-wrapper {
    width: 200px;
    height: 200px;
    overflow: hidden;
    position: absolute;
    top: -12px;
    left: -12px;
    z-index: 10;
}

.badge {
    font: bold 15px sans-serif;
    text-align: center;
    transform: rotate(-45deg);
    position: relative;
    padding: 7px 0;
    top: 32px;
    left: -68px;
    width: 250px;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.badge-sale {
    background-color: #f87b1e;
}

.badge-recommended {
    background-color: #1e6bf8;
}

/* Campaign Icons (top-right corner) */
.campaign-icon-wrapper {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 15;
    cursor: pointer;
}

.campaign-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: transform 0.2s ease;
}

.campaign-icon-wrapper:hover .campaign-icon {
    transform: scale(1.1);
}

/* Campaign Tooltip */
.campaign-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: #333;
    color: #fff;
    padding: 12px 32px 12px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.4;
    width: 220px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.campaign-tooltip::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 12px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #333;
}

/* Show tooltip on click/tap via .tooltip-active */
.campaign-icon-wrapper.tooltip-active .campaign-tooltip {
    display: block;
}

.campaign-tooltip-close {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 1.4rem;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 6px 10px;
}

.campaign-tooltip-close:hover {
    color: #fff;
}

/* Product Info Section (Right) */
.product-info-section {
    flex: 1;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0; /* Allow flex item to shrink below content size */
    /* No overflow: hidden here - tooltip needs to escape */
}

.product-title-card {
    margin: 0;
    padding: 0.5rem 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #000;
    height: 3.4rem; /* Fixed height for exactly 2 lines (1.05rem * 1.6 line-height * 2 lines + padding) */
    overflow: hidden;
}

.product-title-card a {
    color: #000;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.product-title-card a:hover {
    color: #FF7F2A;
}

/* Tire Type and Stock Row (Combined on same line) */
.tire-type-stock-row {
    background-size: cover;
    background-position: center;
    padding: 0.3rem 0.4rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    gap: 0.25rem;
    min-width: 0; /* Prevent overflow */
    /* No overflow: hidden here - tooltip needs to escape */
}

.tire-type-section {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 1;
    min-width: 0;
}

.tire-type-label {
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tire-type-value {
    color: #000;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Lamell icon in tire type */
.lamell-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: middle;
}

.stock-section {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    margin-left: auto;
}

.stock-info-card {
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.stock-available {
    color: #139128;
    font-weight: 600;
}

.stock-orderable {
    color: #FF9500;
    font-weight: 600;
}

.stock-unavailable {
    color: #999999;
    font-weight: 600;
}

.info-icon {
    background: #FF7F2A;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: 2px solid transparent;
}

.info-icon:hover {
    background: #FF9B47;
    transform: scale(1.1);
    border-color: #FF7F2A;
}

.info-icon:active {
    transform: scale(0.95);
}

/* Tooltip styling */
.stock-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1.4;
    width: 250px;
    max-width: 80vw;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    font-weight: normal;
}

.stock-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 12px;
    border: 6px solid transparent;
    border-top-color: #333;
}

.stock-tooltip.show {
    display: block;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tire Indicators - Two Lines */
.tire-indicators {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.indicators-label {
    color: #666;
    font-weight: 600;
    font-size: 0.85rem;
}

.indicators-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 3rem;
}

.indicator-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.indicator-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.indicator-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.indicator-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #000;
}

/* Detailed Specifications */
.tire-specs-detailed {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.spec-row {
    display: grid;
    grid-template-columns: 20px 180px auto;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.spec-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.spec-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.spec-label {
    color: #666;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spec-value {
    color: #000;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

/* Add to Cart Actions */
.product-actions-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
    padding-top: 0.75rem;
}

/* Quantity Controls */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.qty-btn {
    background: #f5f5f5;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: #333;
    transition: background 0.2s;
}

.qty-btn:hover {
    background: #e0e0e0;
}

.qty-input {
    width: 50px;
    height: 32px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
}

.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Add to Cart Button */
.btn-add-to-cart {
    background: linear-gradient(135deg, #FF7F2A 0%, #FF6B1A 100%);
    color: white;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    text-transform: uppercase;
}

.btn-add-to-cart:hover {
    background: linear-gradient(135deg, #FF6B1A 0%, #FF5A0A 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 127, 42, 0.3);
}

/* Load More Button */
.load-more-wrapper {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.btn-load-more {
    background: linear-gradient(135deg, #FF7F2A 0%, #FF6B1A 100%);
    color: white;
    padding: 0.75rem 3rem;
    border: none;
    border-radius: 4px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-load-more:hover {
    background: linear-gradient(135deg, #FF6B1A 0%, #FF5A0A 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 127, 42, 0.3);
}

.btn-load-more.htmx-request {
    opacity: 0.6;
    cursor: wait;
}

.btn-load-more.htmx-request::after {
    content: '...';
    margin-left: 0.5rem;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.no-results p {
    margin-bottom: 0.5rem;
}

.no-results-hint {
    font-size: 0.9rem;
    color: #999;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .product-grid-2col {
        grid-template-columns: 1fr;
    }

    /* Position tooltip to the right when in single-column layout */
    .campaign-tooltip {
        right: auto;
        left: 0;
    }

    /* Move the arrow to the left side */
    .campaign-tooltip::before {
        right: auto;
        left: 12px;
    }
}

@media (max-width: 768px) {
    .search-results-header {
        padding: 1rem;
    }

    .brand-filter-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .brand-buttons {
        width: 100%;
    }

    .filter-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .filter-bar-right {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    /* Keep horizontal layout but with smaller image */
    .product-card-horizontal {
        flex-direction: row;
        height: auto;
        min-height: 200px;
    }

    .product-image-section {
        width: 140px;
        flex-shrink: 0;
        padding: 0.5rem;
    }

    .product-image-section .image-container {
        flex: 1;
    }

    .product-image-section .image-container img {
        max-height: 120px;
    }

    /* Scale down ribbons on tablet */
    .product-image-section .ribbon-wrapper {
        width: 140px;
        height: 140px;
        top: -8px;
        left: -8px;
    }

    .product-image-section .badge {
        font-size: 11px;
        padding: 5px 0;
        top: 22px;
        left: -48px;
        width: 175px;
    }

    .product-image-section .price-display-left {
        padding: 0.25rem 0;
    }

    .product-image-section .price-display-left .current-price,
    .product-image-section .price-display-left .sale-price {
        font-size: 1.25rem;
    }

    .product-image-section .price-display-left .old-price {
        font-size: 0.8rem;
    }

    .product-info-section {
        padding: 0.5rem;
        gap: 0.35rem;
    }

    .product-title-card {
        font-size: 0.95rem;
        height: auto;
        padding: 0.25rem 0;
    }

    .product-title-card a {
        -webkit-line-clamp: 2;
    }

    .tire-type-stock-row {
        font-size: 0.75rem;
    }

    .tire-indicators .indicators-row {
        /* Keep space-between on tablet, just reduce icon/value sizes */
    }

    .tire-indicators .indicator-icon {
        width: 24px;
        height: 24px;
    }

    .tire-indicators .indicator-value {
        font-size: 0.85rem;
    }

    .tire-specs-detailed {
        display: none;
    }

    .product-actions-card {
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding-top: 0.5rem;
    }

    .qty-btn {
        width: 28px;
        height: 28px;
    }

    .qty-input {
        width: 40px;
        height: 28px;
        font-size: 0.85rem;
    }

    .btn-add-to-cart {
        flex: 1;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Scale down campaign icons on tablet */
    .campaign-icon-wrapper {
        top: 4px;
        right: 4px;
    }

    .campaign-icon {
        width: 50px;
        height: 50px;
    }

    /* Position tooltip to the right on tablet so it doesn't go off-screen */
    .campaign-tooltip {
        right: auto;
        left: 0;
        min-width: 180px;
        font-size: 0.8rem;
        padding: 0.5rem;
    }

    /* Move the arrow to the left side */
    .campaign-tooltip::before {
        right: auto;
        left: 12px;
    }
}

/* Small mobile: show small image on left, compact layout */
@media (max-width: 500px) {
    .product-grid-2col {
        gap: 0.75rem;
        padding: 0 0.5rem;
    }

    /* Keep horizontal layout with image on left */
    .product-card-horizontal {
        flex-direction: row;
        height: auto;
        min-height: 180px;
    }

    /* Show image section - smaller */
    .product-image-section {
        display: flex;
        width: 100px;
        flex-shrink: 0;
        padding: 0.25rem;
    }

    .product-image-section .image-container img {
        max-height: 90px;
    }

    .product-image-section .price-display-left {
        padding: 0.15rem 0;
    }

    .product-image-section .price-display-left .current-price,
    .product-image-section .price-display-left .sale-price {
        font-size: 1rem;
    }

    .product-image-section .price-display-left .old-price {
        font-size: 0.7rem;
    }

    /* Scale down ribbons on very small screens */
    .product-image-section .ribbon-wrapper {
        width: 100px;
        height: 100px;
        top: -6px;
        left: -6px;
    }

    .product-image-section .badge {
        font-size: 9px;
        padding: 4px 0;
        top: 16px;
        left: -34px;
        width: 125px;
    }

    /* Info section */
    .product-info-section {
        padding: 0.35rem;
        gap: 0.2rem;
        display: flex;
        flex-direction: column;
    }

    /* Title - allow 3 lines */
    .product-title-card {
        font-size: 0.85rem;
        height: auto;
        min-height: 3.3rem; /* Space for ~3 lines */
        margin-bottom: 0;
        padding: 0;
        order: 1;
    }

    .product-title-card a {
        -webkit-line-clamp: 3;
        line-height: 1.3;
    }

    /* Hide mobile price row since image section shows price */
    .mobile-price-row {
        display: none !important;
    }

    /* Tire type and stock - STACKED vertically */
    .tire-type-stock-row {
        padding: 0.2rem 0.3rem;
        font-size: 0.7rem;
        order: 3;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
    }

    .tire-type-section {
        width: 100%;
    }

    .tire-type-value {
        font-size: 0.7rem;
    }

    .lamell-icon {
        width: 14px;
        height: 14px;
    }

    .stock-section {
        width: 100%;
        margin-left: 0;
    }

    .stock-info-card {
        font-size: 0.65rem;
    }

    .info-icon {
        width: 14px;
        height: 14px;
        font-size: 0.55rem;
    }

    /* Show tire indicators on mobile - compact single row */
    .tire-indicators {
        display: block;
        order: 4;
        padding: 0.15rem 0;
    }

    .tire-indicators .indicators-label {
        display: none;
    }

    .tire-indicators .indicators-row {
        gap: 0.5rem;
        justify-content: flex-start;
    }

    .tire-indicators .indicator-item {
        gap: 0.15rem;
    }

    .tire-indicators .indicator-icon {
        width: 18px;
        height: 18px;
    }

    .tire-indicators .indicator-value {
        font-size: 0.75rem;
    }

    /* Hide detailed specs */
    .tire-specs-detailed {
        display: none;
    }

    /* Actions: side by side */
    .product-actions-card {
        gap: 0.35rem;
        padding-top: 0.25rem;
        flex-wrap: nowrap;
        margin-top: auto;
        order: 5;
    }

    .quantity-controls {
        flex-shrink: 0;
    }

    .qty-btn {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }

    .qty-input {
        width: 32px;
        height: 24px;
        font-size: 0.8rem;
    }

    .btn-add-to-cart {
        padding: 0.4rem 0.5rem;
        font-size: 0.7rem;
        flex: 1;
        min-width: 0;
    }

    /* Filter bar compact */
    .filter-bar {
        padding: 0.5rem 0.75rem;
    }

    .filter-bar-left {
        font-size: 0.8rem;
    }

    .sort-controls {
        font-size: 0.8rem;
    }

    .userstock-filter-btn {
        font-size: 0.8rem;
        padding: 0.35rem 0.5rem;
    }

    /* Search header compact */
    .search-results-header {
        padding: 0.75rem;
    }

    .search-query-display {
        font-size: 0.95rem;
    }

    .brand-btn {
        font-size: 0.8rem;
        padding: 0.15rem 0.35rem;
    }

    /* Scale down campaign icons on small mobile */
    .campaign-icon-wrapper {
        top: 2px;
        right: 2px;
    }

    .campaign-icon {
        width: 36px;
        height: 36px;
    }

    /* Position tooltip to the right on mobile so it doesn't go off-screen */
    .campaign-tooltip {
        right: auto;
        left: 0;
        min-width: 150px;
        font-size: 0.75rem;
        padding: 0.4rem;
    }

    /* Move the arrow to the left side */
    .campaign-tooltip::before {
        right: auto;
        left: 12px;
    }
}

/* Mobile price display - hidden on smallest screens since image section shows price */
.mobile-price-row {
    display: none;
}
