.amirpc-search{--blue:#135bd8;--purple:#4b24d0;position:relative;width:100%;max-width:900px;margin:0;font-family:inherit;z-index:20;direction:rtl;box-sizing:border-box}
.amirpc-search *{box-sizing:border-box}
.amirpc-search-form{height:52px;display:flex;align-items:center;background:#fff;border:1px solid #e5e5e5;border-radius:14px;box-shadow:0 4px 18px rgba(0,0,0,.07);overflow:hidden;width:100%;margin:0}
.amirpc-search-input{display:block;flex:1;min-width:0;width:100%;height:100%;border:0!important;outline:0!important;background:#fff!important;padding:0 18px;color:#222!important;font-size:15px;font-family:inherit;box-shadow:none!important;opacity:1!important;visibility:visible!important;direction:rtl}
.amirpc-search-input::placeholder{color:#b8b8b8!important;opacity:1!important}
.amirpc-search-button{width:58px;min-width:58px;height:100%;border:0;background:transparent;cursor:pointer;display:grid;place-items:center;flex:0 0 58px}
.amirpc-search-button svg{width:23px;height:23px;fill:none;stroke:var(--blue);stroke-width:2}
.amirpc-search-panel{position:absolute;top:calc(100% + 7px);right:0;left:0;background:#fff;border:1px solid #e8e8e8;border-radius:14px;box-shadow:0 18px 45px rgba(0,0,0,.18);overflow-y:auto;max-height:min(620px,calc(100vh - 170px));z-index:100001}
.amirpc-search-panel[hidden]{display:none!important}
.amirpc-search-loading{padding:22px;text-align:center;color:#777;display:none}
.amirpc-search-results{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:18px}
.amirpc-product{display:flex;align-items:center;gap:10px;padding:9px;border-radius:12px;text-decoration:none!important;color:inherit!important;min-width:0}
.amirpc-product:hover{background:#f6f8fc}
.amirpc-product-image{width:62px;height:62px;flex:0 0 62px;border-radius:10px;background:#f5f5f5;object-fit:contain}
.amirpc-product-info{min-width:0}
.amirpc-product-title{font-size:13px;line-height:1.65;font-weight:600;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.amirpc-product-price{display:block;margin-top:5px;color:var(--blue);font-size:12px;font-weight:700}
.amirpc-search-categories{display:grid;grid-template-columns:1fr 1fr;border-top:1px solid #eee}
.amirpc-search-category-box{padding:14px 18px}
.amirpc-search-category-box+.amirpc-search-category-box{border-right:1px solid #eee}
.amirpc-search-category-title,.amirpc-popular-title{font-size:13px;font-weight:700;margin-bottom:9px}
.amirpc-search-category-list,.amirpc-popular-list{display:flex;flex-wrap:wrap;gap:7px}
.amirpc-search-category-list a{background:#f7f8fb;color:#555!important;text-decoration:none!important;padding:7px 10px;border-radius:8px;font-size:12px}
.amirpc-search-all{display:block;margin:0 18px 16px;padding:12px;text-align:center;background:var(--purple);color:#fff!important;text-decoration:none!important;border-radius:10px;font-size:13px;font-weight:700}
.amirpc-search-popular{border-top:1px solid #eee;padding:14px 18px 18px}
.amirpc-popular-list button{border:1px solid #eee;background:#f8f8f8;color:#555;padding:8px 12px;border-radius:20px;cursor:pointer;font-family:inherit;font-size:12px}
.amirpc-empty{grid-column:1/-1;padding:25px;text-align:center;color:#777}
/* The fallback is only a source for pages that do not already contain the shortcode. */
#amirpc-live-search-fallback{display:none!important}
/* Search is deliberately below the category dropdown in the mobile stacking order. */
@media(max-width:800px){.amirpc-search-results{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){
 .amirpc-search{width:100%;max-width:100%;z-index:2}
 .amirpc-search-form{height:48px;border-radius:12px}
 .amirpc-search-input{height:48px!important;font-size:16px!important;padding:0 12px;line-height:normal!important;-webkit-appearance:none;appearance:none}
 .amirpc-search-panel{position:absolute;top:calc(100% + 5px);right:0;left:0;max-height:calc(100dvh - 190px);border-radius:12px;z-index:100001}
 .amirpc-search-results{grid-template-columns:1fr;padding:10px;gap:4px}
 .amirpc-search-categories{grid-template-columns:1fr}
 .amirpc-search-category-box+.amirpc-search-category-box{border-right:0;border-top:1px solid #eee}
}
/* Header placement restored from v1.1.5: category on the right, search immediately to its left. */
.amirpc-category-search-row{display:flex!important;flex-direction:row!important;direction:rtl!important;align-items:center;gap:14px;flex-wrap:nowrap}
.amirpc-category-search-row>.amirpc-search{order:1;flex:1 1 430px;min-width:220px;max-width:520px;margin:0}
.amirpc-category-search-row>.col-md-3,
.amirpc-category-search-row>.cats-list{order:0;flex:0 0 330px;max-width:330px}
.amirpc-category-search-row>.col-md-9{display:none!important}
@media(max-width:768px){
 .amirpc-category-search-row{display:flex!important;flex-direction:column!important;direction:rtl!important;align-items:stretch;gap:8px;position:relative;flex-wrap:nowrap}
 .amirpc-category-search-row>.amirpc-search{order:2;flex:0 0 auto;width:100%;max-width:100%;min-width:0;z-index:2}
 .amirpc-category-search-row>.col-md-3,
 .amirpc-category-search-row>.cats-list{order:1;flex:0 0 auto;width:100%;max-width:100%}
 .amirpc-category-search-row>.col-md-9{display:none!important}
}
/* v1.1.6: Desktop live-search results use the same readable single-row layout as mobile. */
@media (min-width: 769px) {
  .amirpc-search-panel .amirpc-search-results {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 2px !important;
    padding: 10px 14px !important;
  }
  .amirpc-search-panel .amirpc-product {
    display: flex !important;
    flex-direction: row !important;
    direction: rtl !important;
    align-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 10px 12px !important;
    gap: 14px !important;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 8px;
  }
  .amirpc-search-panel .amirpc-product:last-child { border-bottom: 0; }
  .amirpc-search-panel .amirpc-product-image {
    width: 64px !important;
    height: 64px !important;
    flex: 0 0 64px !important;
  }
  .amirpc-search-panel .amirpc-product-info {
    display: block !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    text-align: right !important;
  }
  .amirpc-search-panel .amirpc-product-title {
    display: block !important;
    overflow: visible !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: initial !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    line-height: 1.7 !important;
  }
  .amirpc-search-panel .amirpc-product-price {
    margin-top: 4px !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }
}
