
/* ES My Account Products */

/* ---------- View order: product image/name/qty ---------- */

.woocommerce-account .woocommerce-table--order-details td.woocommerce-table__product-name {
    position: relative;
    vertical-align: middle;
}

.woocommerce-account .es-map-order-product-main {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    min-width: 0 !important;
    width: 100% !important;
}

.woocommerce-account .es-map-order-product-thumb {
    display: block !important;
    flex: 0 0 88px !important;
    width: 88px !important;
    height: 88px !important;
    line-height: 0 !important;
}

.woocommerce-account .es-map-order-product-image {
    display: block !important;
    width: 88px !important;
    height: 88px !important;
    max-width: 88px !important;
    object-fit: contain !important;
    margin: 0 !important;
}

.woocommerce-account .es-map-order-product-text {
    display: block !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
    writing-mode: horizontal-tb !important;
}

/* Quantity is moved by JS into the title area, so it behaves consistently in Porto. */
.woocommerce-account .es-map-inline-qty {
    display: inline-block !important;
    margin-left: 10px !important;
    white-space: nowrap !important;
    font-weight: 600 !important;
}

/* Desktop: keep product title + quantity on one line area where possible. */
@media (min-width: 768px) {
    .woocommerce-account .es-map-order-product-text {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        flex-wrap: wrap !important;
    }

    .woocommerce-account .woocommerce-table--order-details td.woocommerce-table__product-name {
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }
}

/* Mobile: undo Porto table compression that can make text one-letter wide. */
@media (max-width: 767px) {
    .woocommerce-account .woocommerce-table--order-details,
    .woocommerce-account .woocommerce-table--order-details tbody,
    .woocommerce-account .woocommerce-table--order-details tr,
    .woocommerce-account .woocommerce-table--order-details td {
        box-sizing: border-box !important;
    }

    .woocommerce-account .woocommerce-table--order-details td.woocommerce-table__product-name {
        width: 100% !important;
        max-width: 100% !important;
        text-align: left !important;
        padding: 14px 10px !important;
    }

    .woocommerce-account .woocommerce-table--order-details td.woocommerce-table__product-name::before {
        float: none !important;
        width: auto !important;
        max-width: none !important;
    }

    .woocommerce-account .es-map-order-product-main {
        display: grid !important;
        grid-template-columns: 74px minmax(0, 1fr) !important;
        gap: 12px !important;
        align-items: center !important;
        width: 100% !important;
    }

    .woocommerce-account .es-map-order-product-thumb,
    .woocommerce-account .es-map-order-product-image {
        width: 74px !important;
        height: 74px !important;
        max-width: 74px !important;
    }

    .woocommerce-account .es-map-order-product-thumb {
        grid-column: 1 !important;
    }

    .woocommerce-account .es-map-order-product-text {
        grid-column: 2 !important;
        min-width: 0 !important;
        width: 100% !important;
        font-size: 14px !important;
        line-height: 1.4 !important;
    }

    .woocommerce-account .es-map-inline-qty {
        margin-left: 6px !important;
    }

    .woocommerce-account .woocommerce-table--order-details td.woocommerce-table__product-name dl.variation,
    .woocommerce-account .woocommerce-table--order-details td.woocommerce-table__product-name .wc-item-meta {
        margin-left: 86px !important;
        width: auto !important;
    }
}

/* ---------- Orders search ---------- */

.es-map-search {
    position: relative;
    max-width: 760px;
    margin: 0 0 24px;
    z-index: 50;
}

.es-map-search-field {
    position: relative;
}

.es-map-search-input {
    width: 100% !important;
    height: 48px !important;
    padding: 0 46px !important;
    border: 1px solid #d8d8d8 !important;
    border-radius: 6px !important;
    background: #fff !important;
    box-shadow: none !important;
}

.es-map-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    color: #777;
    pointer-events: none;
}

.es-map-search-loader {
    display: none;
    position: absolute;
    right: 16px;
    top: 50%;
    width: 17px;
    height: 17px;
    margin-top: -9px;
    border: 2px solid #ddd;
    border-top-color: #333;
    border-radius: 50%;
    animation: es-map-spin .7s linear infinite;
}

.es-map-search-loader.is-active {
    display: block;
}

@keyframes es-map-spin {
    to { transform: rotate(360deg); }
}

.es-map-search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 480px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 12px 30px rgba(0,0,0,.12);
}

.es-map-search-results.is-open {
    display: block;
}

.es-map-result {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 12px !important;
    color: #222 !important;
    text-decoration: none !important;
    border-bottom: 1px solid #eee;
    background: #fff;
}

.es-map-result:last-child {
    border-bottom: 0;
}

.es-map-result:hover {
    background: #f7f7f7;
}

.es-map-result img {
    width: 58px !important;
    height: 58px !important;
    max-width: 58px !important;
    object-fit: contain !important;
    flex: 0 0 58px !important;
}

.es-map-result-info {
    min-width: 0;
    flex: 1;
}

.es-map-result-name {
    display: block;
    font-weight: 600;
    line-height: 1.35;
}

.es-map-result-meta {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #777;
}

.es-map-empty {
    padding: 16px;
    text-align: center;
    color: #777;
}

@media (max-width: 575px) {
    .es-map-search {
        max-width: 100%;
    }

    .es-map-result img {
        width: 52px !important;
        height: 52px !important;
        max-width: 52px !important;
        flex-basis: 52px !important;
    }
}
