/**
 * SGI Search Plugin Styles
 */

/* Search Form Styles */
.sgi-search-form {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.sgi-search-form .search-container {
    position: relative;
}

.sgi-search-form .search-input {
    width: 100%;
    padding: 12px 48px 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.sgi-search-form .search-input:focus {
    border-color: #d42005;
    box-shadow: 0 0 0 3px rgba(212, 32, 5, 0.1);
    background: white;
}

.sgi-search-form .search-input::placeholder {
    color: #9ca3af;
}

/* Search Results Dropdown */
.sgi-search-form .search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

.sgi-search-form .search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.sgi-search-form .search-result-item:last-child {
    border-bottom: none;
}

.sgi-search-form .search-result-item:hover,
.sgi-search-form .search-result-item.selected {
    background-color: #f9fafb;
}

.sgi-search-form .search-result-item img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 12px;
}

.sgi-search-form .search-result-content {
    flex: 1;
    min-width: 0;
}

.sgi-search-form .search-result-title {
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sgi-search-form .search-result-price {
    color: #d42005;
    font-weight: 600;
    font-size: 14px;
}

.sgi-search-form .search-result-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.sgi-search-form .search-result-stock.in-stock {
    color: #059669;
}

.sgi-search-form .search-result-stock.out-of-stock {
    color: #dc2626;
}

.sgi-search-form .search-result-type {
    margin-left: auto;
    color: #9ca3af;
}

.sgi-search-form .search-no-results {
    padding: 24px;
    text-align: center;
    color: #6b7280;
}

.sgi-search-form .search-view-all {
    padding: 12px 16px;
    border-top: 1px solid #f3f4f6;
    background: #f9fafb;
    text-align: center;
}

.sgi-search-form .search-view-all a {
    color: #d42005;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

.sgi-search-form .search-view-all a:hover {
    color: #b81c04;
}

/* Loading Spinner */
.sgi-search-form .search-loading {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

/* Category Badge */
.sgi-search-form .category-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: rgba(212, 32, 5, 0.1);
    color: #d42005;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.sgi-search-form .category-badge i {
    margin-right: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sgi-search-form .search-input {
        padding: 10px 40px 10px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .sgi-search-form .search-result-item {
        padding: 10px 12px;
    }
    
    .sgi-search-form .search-result-item img {
        width: 40px;
        height: 40px;
        margin-right: 10px;
    }
    
    .sgi-search-form .search-results-dropdown {
        margin-top: 4px;
        border-radius: 8px;
    }
}

/* Animation Classes */
.sgi-fade-in {
    animation: sgiFadeIn 0.2s ease-out;
}

.sgi-fade-out {
    animation: sgiFadeOut 0.15s ease-in;
}

@keyframes sgiFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes sgiFadeOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
}

/* Focus States */
.sgi-search-form .search-input:focus + .search-icon {
    color: #d42005;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .sgi-search-form .search-input {
        border-width: 2px;
    }
    
    .sgi-search-form .search-result-item:hover {
        background-color: #e5e7eb;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .sgi-search-form .search-input,
    .sgi-search-form .search-result-item {
        transition: none;
    }
    
    .sgi-fade-in,
    .sgi-fade-out {
        animation: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .sgi-search-form .search-input {
        background: #374151;
        border-color: #4b5563;
        color: white;
    }
    
    .sgi-search-form .search-input::placeholder {
        color: #9ca3af;
    }
    
    .sgi-search-form .search-results-dropdown {
        background: #1f2937;
        border-color: #374151;
    }
    
    .sgi-search-form .search-result-item:hover {
        background-color: #374151;
    }
    
    .sgi-search-form .search-result-title {
        color: white;
    }
    
    .sgi-search-form .search-view-all {
        background: #374151;
        border-color: #4b5563;
    }
}

/* SCI PRODUSE MOBILE WIDGET STYLES */
.sci-produse-mobile,
.sci-cele-mai-vandute,
.sci-produse-cu-discount {
    width: 100%;
}

.sci-mobile-product-grid,
.sci-cele-mai-vandute .sci-mobile-product-grid,
.sci-produse-cu-discount .sci-mobile-product-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.sci-mobile-product-item,
.sci-cele-mai-vandute .sci-mobile-product-item,
.sci-produse-cu-discount .sci-mobile-product-item {
    width: 100% !important;
    margin-bottom: 0 !important;
    box-sizing: border-box !important;
}

.sci-mobile-product-item .enhanced-product-card,
.sci-mobile-product-item .fallback-product-card,
.sci-cele-mai-vandute .sci-mobile-product-item .enhanced-product-card,
.sci-cele-mai-vandute .sci-mobile-product-item .fallback-product-card,
.sci-produse-cu-discount .sci-mobile-product-item .enhanced-product-card,
.sci-produse-cu-discount .sci-mobile-product-item .fallback-product-card {
    width: 100% !important;
    margin: 0 !important;
}

/* Mobile-specific styling for 2 cards per row - FORCE FULL 50% WIDTH */
@media (max-width: 767px) {
    .enhanced-product-card .price-display {
    font-size: 14px !important;
    font-weight: 700;
    color: #d01e03;
    line-height: 1.2;
}
.product-title a {
    padding: 0 !important;
}

    .sci-mobile-product-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.25rem !important;
        padding: 0.25rem !important;
        width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    /* FORCE each product item to take FULL 50% width */
    .sci-mobile-product-item {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        flex: none !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* FORCE product cards to take FULL WIDTH - NO MARGINS OR CONSTRAINTS */
    .sci-mobile-product-item .product-card,
    .sci-mobile-product-item .enhanced-product-card,
    .sci-mobile-product-item .fallback-product-card,
    .sci-cele-mai-vandute .sci-mobile-product-item .product-card,
    .sci-cele-mai-vandute .sci-mobile-product-item .enhanced-product-card,
    .sci-cele-mai-vandute .sci-mobile-product-item .fallback-product-card,
    .sci-produse-cu-discount .sci-mobile-product-item .product-card,
    .sci-produse-cu-discount .sci-mobile-product-item .enhanced-product-card,
    .sci-produse-cu-discount .sci-mobile-product-item .fallback-product-card {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: 304px !important;
        min-height: 304px !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
        background: #ffffff !important;
        transition: all 0.3s ease !important;
        transform: none !important;
        margin: 0 !important;
        padding: 0.5rem !important;
        box-sizing: border-box !important;
        border: 1px solid #e5e7eb !important;
        flex: none !important;
    }

    /* Better readable font sizes for 2-per-row mobile layout */
    .sci-mobile-product-item .product-title,
    .sci-mobile-product-item .enhanced-product-card .product-title,
    .sci-mobile-product-item .fallback-product-card h3 {
        font-size: 11px !important;
        line-height: 1.3 !important;
        margin-bottom: 0.5rem !important;
        font-weight: 600 !important;
        padding: 0 !important;
    }

    .sci-mobile-product-item .product-price,
    .sci-mobile-product-item .enhanced-product-card .product-price,
    .sci-mobile-product-item .fallback-product-card .price {
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        color: #d42005 !important;
    }

    .sci-mobile-product-item .product-category,
    .sci-mobile-product-item .enhanced-product-card .product-category {
        font-size: 0.75rem !important;
        margin-bottom: 0.5rem !important;
        color: #6b7280 !important;
    }

    /* Optimize product images for 50/50 layout with better proportions */
    .sci-mobile-product-item .product-image img,
    .sci-mobile-product-item .enhanced-product-card .product-image img {
        height: 140px !important;
        object-fit: cover !important;
        width: 100% !important;
        border-radius: 8px !important;
        margin-bottom: 0.5rem !important;
    }

    .sci-mobile-product-item .product-image,
    .sci-mobile-product-item .enhanced-product-card .product-image {
        margin-bottom: 0.5rem !important;
    }

    /* OVERRIDE ANY CONTAINER CONSTRAINTS - FORCE FULL WIDTH */
    .sci-mobile-product-grid .sci-mobile-product-item,
    .sci-mobile-product-grid .sci-mobile-product-item > *,
    .sci-mobile-product-grid .sci-mobile-product-item .product-card,
    .sci-mobile-product-grid .sci-mobile-product-item .enhanced-product-card,
    .sci-mobile-product-grid .sci-mobile-product-item .fallback-product-card {
        max-width: none !important;
        min-width: 0 !important;
        width: 100% !important;
        flex-shrink: 0 !important;
        flex-grow: 1 !important;
        flex-basis: auto !important;
    }

    /* Remove any potential margin/padding constraints from parent containers */
    .sci-mobile-product-grid {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }

    /* Specific mobile adjustments as requested */
    .sci-mobile-product-item [x-data] .product-image {
        height: 160px !important;
    }

    .sci-mobile-product-item .product-image-container,
    .sci-mobile-product-item .product-image {
        height: 160px !important;
        border-radius: 18px 18px 0 0 !important;
    }

    /* Remove padding from product-image-link on mobile */
    .sci-mobile-product-item .product-image-link {
        padding: 0 !important;
    }

    .sci-mobile-product-item [x-data] .product-info {
        padding: 8px !important;
    }

    /* Hide category display on mobile */
    .sci-mobile-product-item .sci-alpine-product-card .category-display {
        display: none !important;
    }

    /* Mobile Alpine.js product card - Cumpara button full width */
    .sci-mobile-product-item [x-data] .add-to-cart-button,
    .sci-mobile-product-item .sci-alpine-product-card .add-to-cart-button {
        width: 100% !important;
        display: block !important;
        margin-top: 8px !important;
        padding: 8px 12px !important;
        text-align: center !important;
    }

    /* BIGGER price font on mobile Alpine.js cards - SAME LINE WITH BUTTON */
    .sci-mobile-product-item [x-data] .product-price,
    .sci-mobile-product-item .sci-alpine-product-card .product-price,
    .sci-mobile-product-item .enhanced-product-card .price-display {
        font-size: 14px !important;
        font-weight: 700 !important;
        color: #d01e03 !important;
        padding: 0 !important;
    }

    /* Mobile price-button row - SAME LINE */
    .sci-mobile-product-item .enhanced-product-card .price-button-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
    }

    /* Mobile buy button - ICON + SMALL TEXT, NORMAL ROUNDED CORNERS */
    .sci-mobile-product-item .enhanced-product-card .buy-button {
        width: auto !important;
        height: 36px !important;
        min-width: 60px !important;
        padding: 8px 12px !important;
        border-radius: 8px !important; /* NORMAL ROUNDED CORNERS, NOT CIRCULAR */
        font-size: 10px !important; /* SMALL TEXT SIZE */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        gap: 4px !important; /* Space between icon and text */
    }

    /* Show button text with small font and cart icon on mobile */
    .sci-mobile-product-item .enhanced-product-card .buy-button .button-text,
    .sci-mobile-product-item .enhanced-product-card .buy-button .btn-text {
        display: inline !important;
        font-size: 10px !important;
        font-weight: 600 !important;
        line-height: 1 !important;
    }

    /* HIDE LOADING ICON ON MOBILE */
    .sci-mobile-product-item .enhanced-product-card .buy-button .fa-spinner,
    .sci-mobile-product-item .enhanced-product-card .buy-button .btn-icon.fa-spinner {
        display: none !important;
    }

    .sci-mobile-product-item .enhanced-product-card .buy-button .button-icon,
    .sci-mobile-product-item .enhanced-product-card .buy-button .btn-icon {
        display: block !important;
        font-size: 14px !important;
        margin: 0 !important;
    }

    /* Hide loading icon specifically */
    .sci-mobile-product-item .enhanced-product-card .buy-button .button-icon.fa-spinner,
    .sci-mobile-product-item .enhanced-product-card .buy-button .btn-icon.fa-spinner {
        display: none !important;
    }

    /* BIGGER product images for 1-column layout */
    .sci-mobile-product-item .product-image-container,
    .sci-mobile-product-item .product-image {
        height: 215px !important;
        border-radius: 18px 18px 0 0 !important;
    }

    .sci-mobile-product-item .product-image-container img,
    .sci-mobile-product-item .product-image img {
        height: 215px !important;
        object-fit: cover !important;
        border-radius: 18px 18px 0 0 !important;
    }

    /* Content area optimized for bigger images with smaller text */
    .sci-mobile-product-item .product-info,
    .sci-mobile-product-item .product-content {
        padding: 1.2rem 1rem !important;
        min-height: 140px !important;
    }
.sci-carousel-description {
        text-align: justify;
    }
    /* Smaller text elements optimized for 2-column mobile layout */
    .sci-mobile-product-item .product-title,
    .sci-mobile-product-item h3 {
        font-size: 16px !important;
        line-height: 14px !important;
        margin-bottom: 0.6rem !important;
        font-weight: 700 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: visible;
        color: #1a1a1a !important;
    }

    .sci-mobile-product-item .product-price,
    .sci-mobile-product-item .price {
        font-size: 1.05rem !important;
        margin-bottom: 0.8rem !important;
        font-weight: 800 !important;
        color: #d42005 !important;
    }

    .sci-mobile-product-item .product-category,
    .sci-mobile-product-item .category {
        margin-bottom: 0.6rem !important;
    }

    .sci-mobile-product-item .category-name,
    .sci-mobile-product-item .category-link {
      font-size: 17px !important;
        font-weight: 400 !important;
        color: #666 !important;
        text-transform: uppercase;
    }

    .sci-mobile-product-item .category-name i,
    .sci-mobile-product-item .category-link i {
        font-size: 0.7rem !important;
        margin-right: 3px !important;
        color: #d42005 !important;
    }

    /* Optimized buttons for 2-column layout */
    .sci-mobile-product-item .btn,
    .sci-mobile-product-item .button,
    .sci-mobile-product-item .add-to-cart,
    .sci-mobile-product-item .view-product {
        padding: 0.8rem 1rem !important;
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        border-radius: 12px !important;
        min-height: 45px !important;
        width: 100% !important;
        display: block !important;
        text-align: center !important;
    }

    /* Optimized sale badges for 2-column layout */
    .sci-mobile-product-item .sale-badge,
    .sci-mobile-product-item .badge {
        font-size: 0.75rem !important;
        padding: 0.4rem 0.8rem !important;
        border-radius: 8px !important;
        top: 0.8rem !important;
        right: 0.8rem !important;
        font-weight: 700 !important;
    }

    /* REMOVED - Conflicting 1-column layout rules that override 2-column mobile layout */

    /* Additional mobile enhancements for 1-column layout with bigger images */
    .sci-mobile-product-item {
        margin-bottom: 1.5rem !important;
    }

    /* Ensure cards take full width within their grid cell */
    .sci-mobile-product-item > * {
        width: 100% !important;
        max-width: none !important;
    }

    /* Enhanced hover effects for 1-column layout */
    .sci-mobile-product-item .product-card:hover,
    .sci-mobile-product-item .enhanced-product-card:hover,
    .sci-mobile-product-item .fallback-product-card:hover,
    .sci-cele-mai-vandute .sci-mobile-product-item .product-card:hover,
    .sci-cele-mai-vandute .sci-mobile-product-item .enhanced-product-card:hover,
    .sci-cele-mai-vandute .sci-mobile-product-item .fallback-product-card:hover,
    .sci-produse-cu-discount .sci-mobile-product-item .product-card:hover,
    .sci-produse-cu-discount .sci-mobile-product-item .enhanced-product-card:hover,
    .sci-produse-cu-discount .sci-mobile-product-item .fallback-product-card:hover {
        transform: scale(1.06) !important;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2) !important;
    }

    /* Ensure text is readable in smaller cards */
    .sci-mobile-product-item .product-title,
    .sci-mobile-product-item h3 {
        line-height: 1.3 !important;
        word-wrap: break-word !important;
        hyphens: auto !important;
    }

    /* Optimized spacing for smaller text layout */
    .sci-mobile-product-item .product-category + .product-title,
    .sci-mobile-product-item .category + h3 {
        margin-top: 0.4rem !important;
    }

    .sci-mobile-product-item .product-title + .product-price,
    .sci-mobile-product-item h3 + .price {
        margin-top: 0.4rem !important;
    }

    .sci-mobile-product-item .product-price + .product-actions,
    .sci-mobile-product-item .price + .product-actions {
        margin-top: 0.6rem !important;
    }
}

/* Tablet: 3 products per row */
@media (min-width: 768px) and (max-width: 1023px) {
    .sci-mobile-product-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }
}

/* Desktop: 4 products per row */
@media (min-width: 1024px) {
    .sci-mobile-product-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1.25rem !important;
    }

    /* Reset mobile optimizations for larger screens */
    .sci-mobile-product-item .product-card,
    .sci-mobile-product-item .enhanced-product-card,
    .sci-mobile-product-item .fallback-product-card {
        transform: none !important;
        min-height: auto !important;
        padding: 1rem !important;
    }
}

/* SHIMMER LOADING EFFECT FOR ALL PRODUCT CARDS */
.sci-mobile-product-item,
.product-card,
.enhanced-product-card,
.fallback-product-card,
.sci-cele-mai-vandute .sci-mobile-product-item,
.sci-cele-mai-vandute .product-card,
.sci-cele-mai-vandute .enhanced-product-card,
.sci-cele-mai-vandute .fallback-product-card,
.sci-produse-cu-discount .sci-mobile-product-item,
.sci-produse-cu-discount .product-card,
.sci-produse-cu-discount .enhanced-product-card,
.sci-produse-cu-discount .fallback-product-card {
    position: relative;
    overflow: hidden;
}

.sci-mobile-product-item::before,
.product-card::before,
.enhanced-product-card::before,
.fallback-product-card::before,
.sci-cele-mai-vandute .sci-mobile-product-item::before,
.sci-cele-mai-vandute .product-card::before,
.sci-cele-mai-vandute .enhanced-product-card::before,
.sci-cele-mai-vandute .fallback-product-card::before,
.sci-produse-cu-discount .sci-mobile-product-item::before,
.sci-produse-cu-discount .product-card::before,
.sci-produse-cu-discount .enhanced-product-card::before,
.sci-produse-cu-discount .fallback-product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.6s ease;
    z-index: 1;
    pointer-events: none;
}

.sci-mobile-product-item:hover::before,
.product-card:hover::before,
.enhanced-product-card:hover::before,
.fallback-product-card:hover::before,
.sci-cele-mai-vandute .sci-mobile-product-item:hover::before,
.sci-cele-mai-vandute .product-card:hover::before,
.sci-cele-mai-vandute .enhanced-product-card:hover::before,
.sci-cele-mai-vandute .fallback-product-card:hover::before,
.sci-produse-cu-discount .sci-mobile-product-item:hover::before,
.sci-produse-cu-discount .product-card:hover::before,
.sci-produse-cu-discount .enhanced-product-card:hover::before,
.sci-produse-cu-discount .fallback-product-card:hover::before {
    left: 100%;
}

/* SHIMMER ON LOADING STATE */
.sci-mobile-product-item.loading::before,
.product-card.loading::before,
.enhanced-product-card.loading::before,
.fallback-product-card.loading::before {
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}
