/**
 * TikiToPro Product Search Block - Styles
 * Diseño premium con glassmorphism y animaciones
 */

/* Container */
.tikitopro-product-search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Form wrapper */
.product-search-form {
    position: relative;
}

/* Search wrapper */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 50px;
    padding: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.search-wrapper:hover {
    border-color: #e1af1a;
    box-shadow: 0 10px 25px -5px rgba(225, 175, 26, 0.15);
}

.search-wrapper:focus-within {
    border-color: #e1af1a;
    box-shadow: 0 0 0 4px rgba(225, 175, 26, 0.15), 0 10px 25px -5px rgba(225, 175, 26, 0.2);
}

/* Search icon */
.search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: #9ca3af;
    flex-shrink: 0;
    transition: color 0.3s ease;
}

.search-wrapper:focus-within .search-icon {
    color: #e1af1a;
}

.search-icon i {
    font-size: 18px;
}

/* Search input */
.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 500;
    color: #1a1a1a;
    padding: 12px 0;
    outline: none;
    min-width: 0;
}

.search-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Clear button */
.search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    color: #6b7280;
    cursor: pointer;
    margin-right: 8px;
    transition: all 0.2s ease;
}

.search-clear:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Submit button */
.search-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: none;
    background: linear-gradient(135deg, #e1af1a 0%, #c99b15 100%);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.search-submit:hover {
    background: linear-gradient(135deg, #c99b15 0%, #b08a12 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(225, 175, 26, 0.3);
}

.search-submit i {
    font-size: 16px;
}

/* Category chips */
.search-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}

.category-chip {
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-chip:hover {
    border-color: #e1af1a;
    color: #e1af1a;
}

.category-chip.active {
    background: linear-gradient(135deg, #e1af1a 0%, #c99b15 100%);
    border-color: transparent;
    color: white;
}

/* Results dropdown */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Results list */
.search-results-list {
    padding: 8px;
}

/* Product result item */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.search-result-item:hover {
    background: #f8f9fa;
}

.search-result-item:active {
    transform: scale(0.98);
}

/* Product image */
.result-image {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f3f4f6;
}

.result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Product info */
.result-info {
    flex: 1;
    min-width: 0;
}

.result-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-price {
    font-size: 14px;
    font-weight: 700;
    color: #e1af1a;
}

.result-price del {
    color: #9ca3af;
    font-weight: 400;
    margin-right: 8px;
}

/* Sale badge */
.result-sale-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Out of stock */
.result-stock-badge {
    background: #6b7280;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Results footer */
.search-results-footer {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #e1af1a;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.view-all-link:hover {
    color: #c99b15;
}

.view-all-link i {
    transition: transform 0.2s ease;
}

.view-all-link:hover i {
    transform: translateX(4px);
}

/* No results */
.search-no-results {
    padding: 32px 16px;
    text-align: center;
    color: #6b7280;
}

.search-no-results i {
    font-size: 32px;
    color: #d1d5db;
    margin-bottom: 12px;
}

.search-no-results p {
    margin: 0;
    font-size: 14px;
}

/* Loading */
.search-loading {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    z-index: 1001;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: #e1af1a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Dark mode */
body.dark-mode .search-wrapper {
    background: #252525;
    border-color: #3a3a3a;
}

body.dark-mode .search-wrapper:hover,
body.dark-mode .search-wrapper:focus-within {
    border-color: #e1af1a;
}

body.dark-mode .search-input {
    color: #ffffff;
}

body.dark-mode .search-input::placeholder {
    color: #6b7280;
}

body.dark-mode .search-clear {
    background: #3a3a3a;
    color: #9ca3af;
}

body.dark-mode .search-clear:hover {
    background: #4a4a4a;
    color: #ffffff;
}

body.dark-mode .search-results-dropdown {
    background: #252525;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.4);
}

body.dark-mode .search-result-item:hover {
    background: #303030;
}

body.dark-mode .result-name {
    color: #ffffff;
}

body.dark-mode .search-results-footer {
    border-top-color: #3a3a3a;
}

body.dark-mode .category-chip {
    background: #252525;
    border-color: #3a3a3a;
    color: #d1d5db;
}

body.dark-mode .category-chip:hover {
    border-color: #e1af1a;
    color: #e1af1a;
}

body.dark-mode .search-loading {
    background: #252525;
}

body.dark-mode .loading-spinner {
    border-color: #3a3a3a;
    border-top-color: #e1af1a;
}

/* Responsive */
@media (max-width: 640px) {
    .tikitopro-product-search-container {
        max-width: 100%;
    }

    .search-wrapper {
        border-radius: 16px;
    }

    .search-categories {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .category-chip {
        flex-shrink: 0;
    }

    .search-results-dropdown {
        border-radius: 16px;
        max-height: 350px;
    }
}