/* =============================================================
 *  PYG Live Search — Modal & Results
 * ============================================================= */

/* ---------------------------------------------------------------
 *  CSS Variables
 * ------------------------------------------------------------- */

:root {
    --pyg-white: #fff;
    --pyg-gray-50: #F8F9FA;
    --pyg-gray-100: #E0E0E0;
    --pyg-gray-600: #757575;
    --pyg-text: #333;
    --pyg-navy: #1C1C1C;
    --pyg-green: #007838;
    --pyg-green-dark: #006030;
    --pyg-danger: #DC3545;
}

/* ---------------------------------------------------------------
 *  Trigger Button (header icon)
 * ------------------------------------------------------------- */

.pyg-search-trigger {
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    cursor: pointer;
    color: #F8F9FA !important;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s;
}

.pyg-search-trigger:hover,
.pyg-search-trigger:focus,
.pyg-search-trigger:active {
    opacity: 0.7;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ---------------------------------------------------------------
 *  Modal Wrapper & Backdrop
 * ------------------------------------------------------------- */

.pyg-search-modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.pyg-search-modal-wrapper.is-open {
    opacity: 1;
    visibility: visible;
}

.pyg-search-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
}

body.pyg-search-open {
    overflow: hidden;
}

/* ---------------------------------------------------------------
 *  Modal Container
 * ------------------------------------------------------------- */

.pyg-search-modal {
    position: relative;
    background: var(--pyg-white, #fff);
    width: 100%;
    max-width: 640px;
    margin-top: 50px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
    transform: translateY(-16px) scale(0.97);
    transition: transform 0.25s ease;
    overflow: hidden;
    font-family: 'Poppins', sans-serif;
}

.pyg-search-modal-wrapper.is-open .pyg-search-modal {
    transform: translateY(0) scale(1);
}

/* ---------------------------------------------------------------
 *  Close Button
 * ------------------------------------------------------------- */

.pyg-search-close {
    position: absolute;
    top: 4px;
    right: 16px;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-size: 1.75rem !important;
    line-height: 1;
    cursor: pointer;
    color: var(--pyg-gray-600, #757575) !important;
    padding: 0;
    z-index: 1;
    transition: color 0.15s;
}

.pyg-search-close:hover,
.pyg-search-close:focus,
.pyg-search-close:active {
    color: var(--pyg-danger, #DC3545) !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ---------------------------------------------------------------
 *  Search Header (hint + input + button)
 * ------------------------------------------------------------- */

.pyg-search-header {
    padding: 24px 24px 16px;
}

.pyg-search-hint {
    display: block;
    font-size: 0.8125rem;
    color: var(--pyg-gray-600, #757575);
    margin-bottom: 8px;
    font-family: 'Poppins', sans-serif;
}

.pyg-search-form {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pyg-search-input {
    flex: 1;
    border: 1px solid #dadbdd !important;
    border-radius: 10px !important;
    background: #F8F9FA !important;
    font-size: 1.2rem;
    color: var(--pyg-text, #333) !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 10px 14px !important;
    font-family: 'Poppins', sans-serif;
}

.pyg-search-input::placeholder {
    color: var(--pyg-gray-600, #757575);
    font-weight: 400;
}

.pyg-search-submit {
    background: var(--pyg-green, #007838) !important;
    color: var(--pyg-white, #fff) !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 10px !important;
    font-size: 0.9375rem;
    font-weight: 700 !important;
    font-family: 'Poppins', sans-serif;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: background 0.15s !important;
}

.pyg-search-submit:hover {
    background: var(--pyg-green-dark, #006030) !important;
}

/* ---------------------------------------------------------------
 *  Search Body (status + results list)
 * ------------------------------------------------------------- */

.pyg-search-body {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid var(--pyg-gray-100, #E0E0E0);
}

.pyg-search-status {
    padding: 16px 24px;
    font-size: 0.875rem;
    color: var(--pyg-gray-600, #757575);
    font-family: 'Poppins', sans-serif;
    text-align: center;
}

.pyg-search-status:empty {
    display: none;
}

.pyg-search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 480px;
    overflow-y: auto;
}

/* ---------------------------------------------------------------
 *  Result Item
 * ------------------------------------------------------------- */

.pyg-search-result-item {
    border-bottom: 1px solid var(--pyg-gray-100, #E0E0E0);
}

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

.pyg-search-result-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 24px;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}

.pyg-search-result-link:hover {
    background: var(--pyg-gray-50, #F8F9FA);
}

.pyg-search-result-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: var(--pyg-gray-50, #F8F9FA);
}

.pyg-search-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pyg-search-result-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--pyg-navy, #1C1C1C);
    font-family: 'Poppins', sans-serif;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.3;
}

.pyg-search-result-price {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--pyg-navy, #1C1C1C);
    font-family: 'Poppins', sans-serif;
    line-height: 1.4;
}

.pyg-search-result-price del {
    color: var(--pyg-gray-600, #757575);
    font-weight: 400;
    font-size: 0.8rem;
}

.pyg-search-no-price {
    color: var(--pyg-gray-600, #757575);
}

/* ---------------------------------------------------------------
 *  Footer (count + show all)
 * ------------------------------------------------------------- */

.pyg-search-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-top: 1px solid var(--pyg-gray-100, #E0E0E0);
    font-family: 'Poppins', sans-serif;
}

.pyg-search-count {
    font-size: 0.8125rem;
    color: var(--pyg-gray-600, #757575);
}

.pyg-search-show-all {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--pyg-green, #007838);
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid var(--pyg-green, #007838);
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.pyg-search-show-all:hover {
    background: var(--pyg-green, #007838);
    color: var(--pyg-white, #fff);
}

/* ---------------------------------------------------------------
 *  Responsive
 * ------------------------------------------------------------- */

/* =============================================================
 *  Inline Search — [buscador_pyg]
 * ============================================================= */

.pyg-inline-search {
    position: relative;
    width: 100%;
    max-width: 480px;
    font-family: 'Poppins', sans-serif;
}

/* --- Input field with icon --- */

.pyg-inline-search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.pyg-inline-input {
    width: 100%;
    border: 1px solid #dadbdd !important;
    border-radius: 10px !important;
    background: var(--pyg-white, #fff) !important;
    font-size: 0.9375rem;
    color: var(--pyg-text, #333) !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 10px 40px 10px 14px !important;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.15s;
}

.pyg-inline-input:focus {
    border-color: var(--pyg-green, #007838) !important;
}

.pyg-inline-input::placeholder {
    color: var(--pyg-gray-600, #757575);
    font-weight: 400;
}

.pyg-inline-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pyg-gray-600, #757575);
    pointer-events: none;
}

/* --- Dropdown --- */

.pyg-inline-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99998;
    margin-top: 4px;
    background: var(--pyg-white, #fff);
    border: 1px solid var(--pyg-gray-100, #E0E0E0);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.pyg-inline-status {
    padding: 12px 16px;
    font-size: 0.8125rem;
    color: var(--pyg-gray-600, #757575);
    text-align: center;
}

.pyg-inline-status:empty {
    display: none;
}

.pyg-inline-results {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 360px;
    overflow-y: auto;
}

.pyg-inline-results .pyg-search-result-link {
    padding: 10px 16px;
    gap: 10px;
}

.pyg-inline-results .pyg-search-result-img {
    width: 40px;
    height: 40px;
}

.pyg-inline-results .pyg-search-result-name {
    font-size: 0.85rem;
}

.pyg-inline-results .pyg-search-result-price {
    font-size: 0.85rem;
}

.pyg-inline-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-top: 1px solid var(--pyg-gray-100, #E0E0E0);
}

.pyg-inline-count {
    font-size: 0.75rem;
    color: var(--pyg-gray-600, #757575);
}

.pyg-inline-show-all {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pyg-green, #007838);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--pyg-green, #007838);
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.pyg-inline-show-all:hover {
    background: var(--pyg-green, #007838);
    color: var(--pyg-white, #fff);
}

/* ---------------------------------------------------------------
 *  Responsive
 * ------------------------------------------------------------- */

@media (max-width: 768px) {
    .pyg-search-modal-wrapper {
        padding: 12px;
    }

    .pyg-search-modal {
        margin-top: 16px;
        max-height: calc(100vh - 40px);
        border-radius: 12px;
    }

    .pyg-search-header {
        padding: 20px 16px 12px;
    }

    .pyg-search-form {
        flex-direction: column;
        gap: 10px;
    }

    .pyg-search-input {
        font-size: 1rem;
        text-align: center;
    }

    .pyg-search-submit {
        width: 100%;
        text-align: center;
    }

    .pyg-search-result-link {
        padding: 10px 16px;
        gap: 10px;
    }

    .pyg-search-result-img {
        width: 40px;
        height: 40px;
    }

    .pyg-search-result-name {
        font-size: 0.85rem;
    }

    .pyg-search-footer {
        padding: 10px 16px;
    }

    .pyg-search-results-list {
        max-height: 50vh;
    }
}
