/* Estilos para la barra de búsqueda del frontend */

/* Importar Google Font - Roboto */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

.pps-search-wrapper {
    max-width: 394px;
    margin: 20px auto;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

/* Estilos específicos para el search bar dentro de .producto */
.producto .pps-search-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    margin: 20px auto;
    z-index: 99;
}

.pps-search-form {
    margin-bottom: 20px;
}

.pps-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    padding: 4px 4px 4px 20px;
    overflow: visible;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.pps-search-input-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.pps-search-input {
    flex: 1;
    padding: 0 12px;
    border: none;
    font-size: 16px;
    outline: none;
    background: transparent;
    color: #333;
}

.pps-search-input::placeholder {
    color: #000000;
    font-weight: 400;
}

.pps-search-button {
    padding: 0;
    width: 40px;
    height: 40px;
    background: transparent;
    color: #000000;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 300;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.pps-search-button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #000000;
    transform: scale(1.1);
}

.pps-search-button:active {
    transform: scale(0.95);
}

.pps-search-button .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    line-height: 24px;
    font-weight: 300;
}

.pps-search-button .pps-search-text {
    display: none;
}

.pps-search-loading {
    position: absolute;
    right: 64px;
    top: 50%;
    transform: translateY(-50%);
}

.pps-search-loading .spinner {
    float: none;
    margin: 0;
}

/* Sugerencias de autocompletado */
.pps-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    padding: 8px 0;
}

.pps-suggestion-item {
    padding: 12px 24px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.pps-suggestion-item:last-child {
    border-bottom: none;
}

.pps-suggestion-item:first-child {
    border-radius: 16px 16px 0 0;
}

.pps-suggestion-item:last-child {
    border-radius: 0 0 16px 16px;
}

.pps-suggestion-item:hover {
    background: rgba(222, 56, 56, 0.1);
}

/* Resultados de búsqueda */
.pps-search-results {
    margin-top: 20px;
}

/* ====================================
   MODAL POPUP STYLES
   ==================================== */

.pps-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: pps-modal-fade-in 0.3s ease;
}

@keyframes pps-modal-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.pps-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.pps-modal-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 70vh;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: pps-modal-slide-up 0.3s ease;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

@keyframes pps-modal-slide-up {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pps-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.pps-modal-search-bar {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50px;
    padding: 8px 8px 8px 24px;
    transition: all 0.3s ease;
}

.pps-modal-search-bar:focus-within {
    border-color: #de3838;
    box-shadow: 0 0 0 3px rgba(222, 56, 56, 0.1);
}

.pps-modal-search-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    font-size: 16px;
    outline: none;
    background: transparent;
    color: #333;
}

.pps-modal-search-input::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

.pps-modal-search-button {
    padding: 0;
    width: 48px;
    height: 48px;
    background: transparent;
    color: #de3838;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.pps-modal-search-button:hover {
    background: rgba(222, 56, 56, 0.1);
    color: #c02020;
    transform: scale(1.1);
}

.pps-modal-search-button .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    line-height: 28px;
}

.pps-modal-close {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #666;
    flex-shrink: 0;
}

.pps-modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.pps-modal-close .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.pps-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Tabs dentro del modal */
.pps-modal-body .pps-tabs-wrapper {
    margin-top: 0;
}

.pps-modal-body .pps-tabs-header {
    position: sticky;
    top: -24px;
    background: #fff;
    z-index: 10;
    padding-top: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid #e9ecef;
}

/* Resultados dentro del modal */
.pps-modal-body .pps-result-item {
    border-radius: 12px;
    transition: all 0.2s ease;
}

.pps-modal-body .pps-result-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateX(4px);
}

/* Scrollbar personalizado para el modal */
.pps-modal-body::-webkit-scrollbar {
    width: 8px;
}

.pps-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.pps-modal-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.pps-modal-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive modal */
@media (max-width: 768px) {
    .pps-modal-container {
        max-width: 100%;
        max-height: 64vh;
        border-radius: 20px;
    }
      .pps-result-thumbnail img {
             object-fit: contain !important;
    }
    .pps-modal-header {
        padding: 16px;
    }
    
    .pps-modal-body {
        padding: 16px;
    }
    
    .pps-modal-body .pps-result-item {
        flex-direction: column;
    }
    
    .pps-modal-body .pps-result-thumbnail {
        width: 100%;
        height: 200px;
    }
}

/* ====================================
   END MODAL POPUP STYLES
   ==================================== */


/* Tabs */
.pps-tabs-wrapper {
    margin-top: 20px;
}

.pps-tabs-header {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
}

.pps-tab-button {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pps-tab-button:hover {
    color: #de3838;
    background: #f5f5f5;
}

.pps-tab-button.active {
    color: #de3838;
    border-bottom-color: #de3838;
}

.pps-tab-count {
    display: inline-block;
    padding: 2px 8px;
    background: #ffe5e5;
    color: #de3838;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.pps-tab-button.active .pps-tab-count {
    background: #de3838;
    color: white;
}

.pps-tabs-content {
    position: relative;
}

.pps-tab-panel {
    display: none;
}

.pps-tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pps-results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pps-result-item {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.pps-result-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.pps-result-thumbnail {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.pps-result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pps-result-content {
    flex: 1;
    min-width: 0;
}

.pps-result-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pps-result-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.pps-result-title a:hover {
    color: #de3838;
    text-decoration: underline;
}

.pps-result-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.pps-badge-product {
    background: #ffe5e5;
    color: #de3838;
}

.pps-badge-pdf {
    background: #fff3e0;
    color: #f57c00;
}

.pps-result-excerpt {
    margin: 10px 0;
    color: #555;
    line-height: 1.6;
}

.pps-result-excerpt mark {
    background: #ffeb3b;
    padding: 2px 4px;
    border-radius: 2px;
}

.pps-result-url {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
    word-break: break-all;
}

.pps-result-related {
    margin-top: 10px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
}

.pps-result-related a {
    color: #0073aa;
    text-decoration: none;
}

.pps-result-related a:hover {
    text-decoration: underline;
}

.pps-pdf-result .dashicons {
    color: #f57c00;
}

/* Mensaje sin resultados */
.pps-no-results {
    padding: 40px;
    text-align: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: #666;
    font-size: 16px;
}

/* Paginación */
.pps-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 30px 0 20px;
}

.pps-page-btn {
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.pps-page-btn:hover {
    background: #005177;
}

.pps-page-info {
    color: #666;
    font-size: 14px;
}

/* Contador de resultados */
.pps-results-count {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-top: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .pps-search-wrapper {
        padding: 0 15px;
    }
    
    /* Mobile styles para .producto */
    .producto .pps-search-wrapper {
        position: inherit !important;
        width: 100vw;
    }
    
    .pps-tabs-header {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .pps-tab-button {
        white-space: nowrap;
        font-size: 14px;
        padding: 10px 15px;
    }
    
    .pps-search-loading {
        right: 20px;
        top: 25px;
    }
    
    .pps-suggestions {
        right: 0;
    }
    
    .pps-result-item {
        flex-direction: column;
    }
    
    .pps-result-thumbnail {
        width: 100%;
        height: 200px;
    }
    
    .pps-result-title {
        font-size: 18px;
    }
    
    .pps-pagination {
        flex-direction: column;
        gap: 10px;
    }
    
    .pps-page-btn {
        width: 100%;
    }
}
