/* Unified Search Modal Styles - COMPLETE VERSION WITH ENHANCED BUTTONS */

/* Search Modal - FIX positioning and overlay */
.wcc-search-modal {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.7) !important;
    z-index: 999999 !important;
    justify-content: center !important;
    align-items: center !important;
    backdrop-filter: blur(4px);
}

.wcc-search-modal.active {
    display: flex !important;
}

.wcc-search-modal-content {
    background: white !important;
    border-radius: 16px;
    width: 90%;
    max-width: 580px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    animation: searchModalSlideUp 0.3s ease-out;
    position: relative;
    margin: 20px;
}

@keyframes searchModalSlideUp {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header - Clean White */
.wcc-search-modal-header {
    padding: 20px 24px 16px;
    background: white !important;
    color: #333 !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
}

.wcc-search-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333 !important;
}

.wcc-search-modal-close {
    background: #f5f5f5;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
}

.wcc-search-modal-close:hover {
    background: #e5e5e5;
    color: #666;
}

/* Modal Body */
.wcc-search-modal-body {
    padding: 20px 24px 24px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
    background: white !important;
}

/* Search Form - Beautiful Input like in image */
.wcc-search-form {
    margin-bottom: 20px;
}

.wcc-search-input-group {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8f9ff;
    border: 2px solid #e8e9f3;
    border-radius: 12px;
    padding: 2px;
    transition: all 0.3s ease;
}

.wcc-search-input-group:focus-within {
    border-color: #e74c3c;
    background: white;
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.1);
}

.wcc-search-input {
    border: none !important;
    outline: none !important;
    padding: 12px 16px;
    font-size: 15px;
    flex: 1;
    background: transparent !important;
    color: #333;
    border-radius: 12px 0 0 12px;
    box-shadow: none !important;
}

.wcc-search-input::placeholder {
    color: #999;
    font-size: 14px;
}

.wcc-search-button {
    background: #e74c3c !important;
    border: none !important;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white !important;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.wcc-search-button:hover {
    background: #c0392b !important;
    transform: scale(1.05);
}

.wcc-search-button svg {
    width: 16px;
    height: 16px;
}

/* Search Results */
.wcc-search-results {
    min-height: 100px;
}

/* Search Results Header - Like in image */
.wcc-search-results-header {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #fff5f5;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
}

.wcc-search-results-header h4 {
    margin: 0;
    font-size: 15px;
    color: #e74c3c;
    font-weight: 600;
}

/* Loading State */
.wcc-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #666;
    background: white;
}

.wcc-search-loading .wcc-loading-spinner {
    margin-right: 12px;
    width: 24px;
    height: 24px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #e74c3c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.wcc-search-loading span {
    font-size: 15px;
}

/* Error State */
.wcc-search-error {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: white;
}

.wcc-search-error-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.wcc-search-error p {
    margin: 0;
    font-size: 15px;
}

/* Search Results List - FIXED Layout */
.wcc-search-results-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.wcc-search-result-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    background: white;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.wcc-search-result-item:last-child {
    border-bottom: none;
}

.wcc-search-result-item:hover {
    background: #fff8f8;
    color: #333;
    text-decoration: none;
}

.wcc-search-result-image-container {
    flex-shrink: 0;
    margin-right: 16px;
}

.wcc-search-result-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e8e9f3;
}

.wcc-search-result-image-placeholder {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e8e9f3;
}

.wcc-search-result-image-placeholder span {
    font-size: 24px;
    opacity: 0.5;
}

.wcc-search-result-info {
    flex: 1;
    min-width: 0;
}

.wcc-search-result-name {
    font-weight: 500;
    margin-bottom: 6px;
    color: #333;
    font-size: 15px;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.wcc-search-result-price {
    font-size: 16px;
    color: #e74c3c;
    font-weight: 700;
    margin-bottom: 8px;
}

/* Price styling like in image */
.wcc-search-result-price del {
    color: #999;
    font-weight: 400;
    font-size: 14px;
    margin-right: 8px;
}

.wcc-search-result-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.wcc-search-result-status,
.wcc-search-result-stock {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.wcc-search-result-status.in-cart {
    background: #d4edda;
    color: #155724;
}

.wcc-search-result-status.not-in-cart {
    background: #fff3cd;
    color: #856404;
}

.wcc-search-result-stock.in-stock {
    background: #d1ecf1;
    color: #0c5460;
}

.wcc-search-result-stock.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

/* Featured Product Badge - UPDATED */
.wcc-search-result-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 700;
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 3px rgba(243, 156, 18, 0.3);
}

/* Add to Cart Actions - ENHANCED BUTTON STYLE */
.wcc-search-result-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    margin-left: 16px;
    flex-shrink: 0;
}

.wcc-add-to-cart-btn {
    background: #e74c3c !important;
    color: white !important;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none !important;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 90px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    border: 2px solid #e74c3c;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wcc-add-to-cart-btn:hover {
    background: #c0392b !important;
    border-color: #c0392b;
    color: white !important;
    text-decoration: none !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.4);
}

.wcc-add-to-cart-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.wcc-add-to-cart-btn:disabled,
.wcc-add-to-cart-btn[disabled] {
    background: #95a5a6 !important;
    border-color: #95a5a6;
    color: white !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 1px 3px rgba(149, 165, 166, 0.3);
}

/* Success state - when added to cart */
.wcc-add-to-cart-btn.success {
    background: #27ae60 !important;
    border-color: #27ae60;
    color: white !important;
}

.wcc-add-to-cart-btn.success:hover {
    background: #229954 !important;
    border-color: #229954;
}

/* Loading state */
.wcc-add-to-cart-btn.loading {
    background: #f39c12 !important;
    border-color: #f39c12;
    color: white !important;
    cursor: wait;
}

.wcc-view-product-btn {
    color: #7f8c8d;
    text-decoration: none;
    font-size: 11px;
    transition: color 0.2s ease;
    font-weight: 500;
}

.wcc-view-product-btn:hover {
    color: #e74c3c;
    text-decoration: none;
}

/* Arrow - Updated position */
.wcc-search-result-arrow {
    flex-shrink: 0;
    margin-left: 8px;
    color: #ccc;
    transition: all 0.2s ease;
}

.wcc-search-result-item:hover .wcc-search-result-arrow {
    color: #e74c3c;
    transform: translateX(4px);
}

.wcc-search-result-arrow svg {
    width: 12px;
    height: 12px;
}

/* Scrollbar styling */
.wcc-search-modal-body::-webkit-scrollbar {
    width: 6px;
}

.wcc-search-modal-body::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 3px;
}

.wcc-search-modal-body::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 3px;
}

.wcc-search-modal-body::-webkit-scrollbar-thumb:hover {
    background: #ced4da;
}

/* Animation cho spin */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success Message Animation */
@keyframes slideInRight {
    from { 
        transform: translateX(100%); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

/* Responsive Design - Updated for enhanced button */
@media (max-width: 767px) {
    .wcc-search-modal-content {
        width: 95%;
        max-width: none;
        margin: 10px;
        max-height: 90vh;
    }
    
    .wcc-search-modal-header {
        padding: 16px 20px 12px;
    }
    
    .wcc-search-modal-body {
        padding: 16px 20px 20px;
        max-height: calc(90vh - 80px);
    }
    
    .wcc-search-result-item {
        padding: 14px 16px;
    }
    
    .wcc-search-result-image,
    .wcc-search-result-image-placeholder {
        width: 50px;
        height: 50px;
    }
    
    .wcc-search-result-image-container {
        margin-right: 12px;
    }
    
    .wcc-search-result-actions {
        margin-left: 8px;
        gap: 6px;
    }
    
    .wcc-add-to-cart-btn {
        font-size: 11px;
        padding: 6px 12px;
        min-width: 80px;
        font-weight: 600;
    }
    
    .wcc-search-result-arrow {
        display: none;
    }
    
    .wcc-search-input {
        font-size: 16px !important; /* Prevent zoom on iOS */
        padding: 10px 14px;
    }
    
    .wcc-search-button {
        width: 36px;
        height: 36px;
    }
    
    .wcc-search-result-name {
        font-size: 14px;
    }
    
    .wcc-search-result-price {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .wcc-add-to-cart-btn {
        font-size: 10px;
        padding: 5px 10px;
        min-width: 70px;
    }
    
    .wcc-search-result-actions {
        margin-left: 6px;
    }
}

/* Prevent body scroll when modal is open - IMPORTANT */
body.wcc-search-modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}

/* Override any theme CSS that might interfere */
.wcc-search-modal * {
    box-sizing: border-box;
}

.wcc-search-modal a {
    text-decoration: none;
}

.wcc-search-modal a:hover {
    text-decoration: none;
}