/* Global styles for custom Elementor widgets */
.custom-ajax-search-wrapper {
    --primary-color: #007cba;
    --border-color: #ddd;
    --hover-color: #f8f8f8;
    --text-color: #333;
    --error-color: #d63638;
    --success-color: #00a32a;
}

/* Enhanced animations */
.custom-ajax-search-results {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.custom-ajax-search-results.show {
    opacity: 1;
    transform: translateY(0);
}

/* Focus accessibility improvements */
.custom-ajax-search-input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.search-result-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

/* Better keyboard navigation */
.search-result-item:focus-visible {
    background-color: var(--hover-color);
    outline: 2px solid var(--primary-color);
}

/* Loading animation improvements */
.custom-ajax-search-loader {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .custom-ajax-search-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px 35px 10px 12px;
    }
    
    .search-result-item {
        padding: 10px;
    }
    
    .search-result-image {
        width: 40px;
        height: 40px;
        margin-right: 10px;
    }
    
    .search-result-title {
        font-size: 13px;
    }
    
    .search-result-price {
        font-size: 12px;
    }
    
    .search-result-category {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .custom-ajax-search-input {
        padding: 8px 30px 8px 10px;
        font-size: 14px;
    }
    
    .search-result-item {
        padding: 8px;
    }
    
    .search-result-image {
        width: 35px;
        height: 35px;
        margin-right: 8px;
    }
    
    .custom-ajax-search-loader .spinner {
        width: 16px;
        height: 16px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .custom-ajax-search-wrapper {
        --border-color: #4a4a4a;
        --hover-color: #2a2a2a;
        --text-color: #e0e0e0;
        --primary-color: #5cb3d9;
    }
    
    .custom-ajax-search-input {
        background-color: #1a1a1a;
        color: #e0e0e0;
        border-color: var(--border-color);
    }
    
    .custom-ajax-search-results {
        background-color: #1a1a1a;
        color: #e0e0e0;
        border-color: var(--border-color);
    }
    
    .search-result-item {
        color: #e0e0e0;
    }
    
    .search-result-item:hover {
        background-color: var(--hover-color);
        color: #e0e0e0;
    }
    
    .search-result-price {
        color: var(--primary-color);
    }
    
    .search-result-category {
        color: #999;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .custom-ajax-search-wrapper {
        --primary-color: #000;
        --border-color: #000;
        --hover-color: #ffff00;
        --text-color: #000;
    }
    
    .custom-ajax-search-input {
        border-width: 2px;
        background-color: #fff;
        color: #000;
    }
    
    .search-result-item:hover {
        background-color: var(--hover-color);
        color: #000;
    }
}

/* Print styles */
@media print {
    .custom-ajax-search-wrapper {
        display: none;
    }
}

/* Performance optimizations */
.custom-ajax-search-results {
    will-change: opacity, transform;
}

.search-result-item {
    will-change: background-color;
}

/* Scroll behavior for long results lists */
.custom-ajax-search-results::-webkit-scrollbar {
    width: 8px;
}

.custom-ajax-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.custom-ajax-search-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.custom-ajax-search-results::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Enhanced error states */
.search-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.search-error::before {
    content: "⚠️";
    font-size: 16px;
}

/* Loading state improvements */
.custom-ajax-search-input.loading {
    background-image: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Better visual hierarchy */
.search-result-title {
    font-weight: 600;
    line-height: 1.3;
}

.search-result-price {
    font-weight: 700;
}

.search-result-category {
    opacity: 0.8;
    font-weight: 400;
}

/* Improved spacing and alignment */
.search-result-content > * + * {
    margin-top: 4px;
}

/* RTL support */
[dir="rtl"] .search-result-image {
    margin-right: 0;
    margin-left: 12px;
}

[dir="rtl"] .custom-ajax-search-loader {
    right: auto;
    left: 10px;
}

@media (max-width: 768px) {
    [dir="rtl"] .search-result-image {
        margin-left: 10px;
    }
}

@media (max-width: 480px) {
    [dir="rtl"] .search-result-image {
        margin-left: 8px;
    }
}

/* ============================================
   SHOP PAGE WIDGET STYLES
   ============================================ */

/* Shop wrapper and grid enhancements */
.ctech-shop-wrapper {
    --shop-primary: #007cba;
    --shop-secondary: #005a87;
    --shop-accent: #f8f9fa;
    --shop-border: #e0e0e0;
    --shop-text: #333;
    --shop-success: #00a32a;
    --shop-sale: #ff4444;
    font-family: inherit;
}

/* Enhanced grid system */
.shop-products-grid {
    display: grid;
    gap: clamp(15px, 3vw, 30px);
    margin-bottom: 2rem;
}

/* Improved product card design */
.ctech-shop-wrapper .product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid var(--shop-border);
    position: relative;
}

.ctech-shop-wrapper .product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, transparent 0%, rgba(255,255,255,0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.ctech-shop-wrapper .product-card:hover::before {
    opacity: 1;
}

.ctech-shop-wrapper .product-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    border-color: var(--shop-primary);
}

/* Enhanced image container */
.ctech-shop-wrapper .product-image-wrapper {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    aspect-ratio: 1;
}

.ctech-shop-wrapper .product-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ctech-shop-wrapper .product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Enhanced hover effects */
.hover-effect-zoom .product-card:hover .product-img {
    transform: scale(1.15);
    filter: brightness(1.1);
}

.hover-effect-zoom-out .product-card:hover .product-img {
    transform: scale(0.85);
    filter: brightness(0.9);
}

.hover-effect-slide-up .product-card:hover .product-img {
    transform: translateY(-15px) scale(1.05);
}

.hover-effect-fade .product-card:hover .product-img {
    opacity: 0.7;
    transform: scale(1.05);
}

/* Enhanced sale badge */
.ctech-shop-wrapper .sale-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, var(--shop-sale) 0%, #e63946 100%);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Enhanced product actions */
.ctech-shop-wrapper .product-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 3;
}

.ctech-shop-wrapper .product-card:hover .product-actions {
    opacity: 1;
    transform: translateX(0);
}

.ctech-shop-wrapper .quick-view-btn {
    background: rgba(255,255,255,0.95);
    border: none;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
}

.ctech-shop-wrapper .quick-view-btn:hover {
    background: var(--shop-primary);
    color: #fff;
    transform: scale(1.1);
}

/* Enhanced product info */
.ctech-shop-wrapper .product-info {
    padding: 24px 20px;
    text-align: center;
    background: #fff;
    position: relative;
}

.ctech-shop-wrapper .product-title {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    height: auto;
    min-height: 2.8em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ctech-shop-wrapper .product-title a {
    color: var(--shop-text);
    text-decoration: none;
    transition: all 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ctech-shop-wrapper .product-title a:hover {
    color: var(--shop-primary);
    text-decoration: none;
}

/* Enhanced rating display */
.ctech-shop-wrapper .product-rating {
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.ctech-shop-wrapper .product-rating .star-rating {
    font-size: 14px;
    color: #ffc107;
}

/* Enhanced excerpt */
.ctech-shop-wrapper .product-excerpt {
    margin: 12px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    max-height: 4.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Enhanced price display */
.ctech-shop-wrapper .product-price {
    margin: 16px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--shop-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ctech-shop-wrapper .product-price del {
    color: #999;
    font-weight: 400;
    font-size: 16px;
    text-decoration: line-through;
}

.ctech-shop-wrapper .product-price ins {
    text-decoration: none;
    color: var(--shop-sale);
}

/* Enhanced button design */
.ctech-shop-wrapper .add-to-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--shop-primary) 0%, var(--shop-secondary) 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
    position: relative;
    overflow: hidden;
}

.ctech-shop-wrapper .add-to-cart-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.ctech-shop-wrapper .add-to-cart-btn:hover::before {
    left: 100%;
}

.ctech-shop-wrapper .add-to-cart-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 124, 186, 0.4);
    background: linear-gradient(135deg, var(--shop-secondary) 0%, var(--shop-primary) 100%);
}

.ctech-shop-wrapper .add-to-cart-btn:active {
    transform: translateY(-1px);
}

/* Enhanced pagination */
.ctech-shop-wrapper .shop-pagination {
    margin-top: 50px;
    text-align: center;
}

.ctech-shop-wrapper .shop-pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-flex;
    gap: 8px;
    background: #fff;
    padding: 8px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.ctech-shop-wrapper .shop-pagination a,
.ctech-shop-wrapper .shop-pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    color: var(--shop-text);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.ctech-shop-wrapper .shop-pagination .current {
    background: var(--shop-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.ctech-shop-wrapper .shop-pagination a:hover {
    background: var(--shop-accent);
    color: var(--shop-primary);
    transform: translateY(-2px);
}

/* Responsive enhancements */
@media (max-width: 1024px) {
    .ctech-shop-wrapper .product-info {
        padding: 20px 16px;
    }
    
    .ctech-shop-wrapper .product-title {
        font-size: 15px;
        min-height: 2.6em;
    }
    
    .ctech-shop-wrapper .product-price {
        font-size: 18px;
    }
    
    .ctech-shop-wrapper .add-to-cart-btn {
        padding: 12px 24px;
        font-size: 13px;
    }
}

@media (max-width: 767px) {
    .ctech-shop-wrapper .product-info {
        padding: 16px 12px;
    }
    
    .ctech-shop-wrapper .product-title {
        font-size: 14px;
        min-height: 2.4em;
    }
    
    .ctech-shop-wrapper .product-price {
        font-size: 16px;
        margin: 12px 0;
    }
    
    .ctech-shop-wrapper .add-to-cart-btn {
        padding: 10px 20px;
        font-size: 12px;
        border-radius: 20px;
    }
    
    .ctech-shop-wrapper .sale-badge {
        top: 8px;
        left: 8px;
        padding: 4px 10px;
        font-size: 11px;
    }
    
    .ctech-shop-wrapper .product-actions {
        top: 8px;
        right: 8px;
    }
    
    .ctech-shop-wrapper .quick-view-btn {
        padding: 10px;
    }
    
    .ctech-shop-wrapper .shop-pagination a,
    .ctech-shop-wrapper .shop-pagination span {
        min-width: 40px;
        height: 40px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .ctech-shop-wrapper .product-card:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .ctech-shop-wrapper .product-excerpt {
        font-size: 13px;
        max-height: 3.9em;
        -webkit-line-clamp: 2;
    }
    
    .ctech-shop-wrapper .shop-pagination ul {
        gap: 4px;
        padding: 6px;
    }
    
    .ctech-shop-wrapper .shop-pagination a,
    .ctech-shop-wrapper .shop-pagination span {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

/* Dark mode support for shop */
@media (prefers-color-scheme: dark) {
    .ctech-shop-wrapper {
        --shop-text: #e0e0e0;
        --shop-border: #4a4a4a;
        --shop-accent: #2a2a2a;
    }
    
    .ctech-shop-wrapper .product-card {
        background: #1a1a1a;
        border-color: var(--shop-border);
    }
    
    .ctech-shop-wrapper .product-info {
        background: #1a1a1a;
    }
    
    .ctech-shop-wrapper .product-title a {
        color: var(--shop-text);
    }
    
    .ctech-shop-wrapper .product-excerpt {
        color: #999;
    }
    
    .ctech-shop-wrapper .shop-pagination ul {
        background: #1a1a1a;
    }
}

/* Print styles for shop */
@media print {
    .ctech-shop-wrapper .product-actions,
    .ctech-shop-wrapper .shop-pagination {
        display: none;
    }
    
    .ctech-shop-wrapper .product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Accessibility enhancements */
.ctech-shop-wrapper .product-card:focus-within {
    outline: 2px solid var(--shop-primary);
    outline-offset: 2px;
}

.ctech-shop-wrapper .add-to-cart-btn:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* RTL support for shop */
[dir="rtl"] .ctech-shop-wrapper .sale-badge {
    left: auto;
    right: 12px;
}

[dir="rtl"] .ctech-shop-wrapper .product-actions {
    right: auto;
    left: 12px;
}

@media (max-width: 767px) {
    [dir="rtl"] .ctech-shop-wrapper .sale-badge {
        right: 8px;
    }
    
    [dir="rtl"] .ctech-shop-wrapper .product-actions {
        left: 8px;
    }
}

/* Performance optimizations */
.ctech-shop-wrapper .product-card {
    will-change: transform, box-shadow;
}

.ctech-shop-wrapper .product-img {
    will-change: transform, filter;
}

.ctech-shop-wrapper .add-to-cart-btn {
    will-change: transform, box-shadow;
}

/* Grid container optimizations */
.shop-products-grid {
    contain: layout style;
}

/* Image loading optimization */
.ctech-shop-wrapper .product-img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}
