/**
 * mod_eshop_search_custom – assets/css/style.css  v1.0.1
 *
 * FIX: changed inline-flex → flex (block) so the wrapper fills its module
 *      container both for <div> (default layout) and <form> (page layout).
 *
 * Colour overrides for your template (add to your template CSS):
 *   #mod-escm-XX .escm-btn { background:#9b1c1c; border-color:#9b1c1c; color:#fff; }
 */

/* =========================================================
   OUTER WRAPPER  –  fills the module container automatically
   ========================================================= */
.eshop-search-custom,
form.eshop-search-custom {
    position: relative;
    display: flex;           /* block-flex: fills container width */
    flex-direction: column;  /* stack: inner row on top, result list below */
    width: 100%;             /* fill the moduletable cell by default */
    max-width: 100%;
    box-sizing: border-box;
}

/* When the admin sets an explicit width (set via inline style on the element),
   that inline style wins over this rule – no need for !important tricks. */

/* =========================================================
   INNER ROW  –  input + button side-by-side
   ========================================================= */
.eshop-search-custom .escm-inner,
form.eshop-search-custom .escm-inner {
    display: flex;
    align-items: stretch;
    width: 100%;
    flex-wrap: nowrap;
}

/* =========================================================
   TEXT INPUT
   ========================================================= */
.eshop-search-custom .escm-input,
form.eshop-search-custom .escm-input {
    flex: 1 1 auto;
    min-width: 0;          /* prevents flex overflow on small screens */
    padding: 0 12px;
    border: 1px solid #cccccc;
    background: #ffffff;
    color: #333333;
    font-size: 14px;
    line-height: 1;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    /* height & border-radius are set per-instance by inline style in the template */
}

.eshop-search-custom .escm-input:focus,
form.eshop-search-custom .escm-input:focus {
    border-color: #888888;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 1;
}

/* AJAX loading spinner */
.eshop-search-custom .escm-input.eshop-loadding {
    background-image: url('../images/loader.gif');
    background-repeat: no-repeat;
    background-position: right 8px center;
}

/* =========================================================
   SEARCH BUTTON
   ========================================================= */
.eshop-search-custom .escm-btn,
form.eshop-search-custom .escm-btn {
    flex: 0 0 auto;
    padding: 0 16px;
    border: 1px solid #cccccc;
    background-color: #f4f4f4;
    color: #444444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    font-size: 14px;
    line-height: 1;
    box-sizing: border-box;
    transition: background-color 0.15s, color 0.15s;
    -webkit-appearance: none;
    /* height & border-radius set per-instance by inline style in the template */
}

.eshop-search-custom .escm-btn:hover,
form.eshop-search-custom .escm-btn:hover {
    background-color: #e0e0e0;
}

.eshop-search-custom .escm-btn:active,
form.eshop-search-custom .escm-btn:active {
    background-color: #cecece;
}

.eshop-search-custom .escm-btn-text,
form.eshop-search-custom .escm-btn-text {
    display: inline;
}

/* =========================================================
   CUSTOM IMAGE ICON inside the button
   ========================================================= */
.eshop-search-custom .escm-icon-img,
form.eshop-search-custom .escm-icon-img {
    display: block;
    width: auto;
    /* max-height set per-instance by inline <style> block in template */
}

/* =========================================================
   LIVE-SEARCH RESULT DROPDOWN  (default layout only)
   ========================================================= */
.eshop-search-custom .escm-result-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #ffffff;
    border: 1px solid #c6c6c6;
    border-top: none;
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
    box-sizing: border-box;
}

.eshop-search-custom .escm-result-list li {
    border-top: 1px solid #e8e8e8;
    cursor: pointer;
    overflow: hidden;
    line-height: 1.4;
    padding: 4px 0;
}

.eshop-search-custom .escm-result-list li:first-child {
    border-top: none;
}

.eshop-search-custom .escm-result-list li:hover {
    background-color: #eff8fa;
}

/* Product info block (HTML rendered by EShop AJAX response) */
.eshop-search-custom .escm-result-list li > div {
    float: right;
    width: 70%;
    text-align: left;
    padding: 6px 8px;
}

.eshop-search-custom .escm-result-list img {
    border: 1px solid #c5c5c5;
    margin: 10px 10px 10px 0;
    padding: 3px;
    float: left;
}

.eshop-search-custom .escm-result-list::after {
    content: '';
    display: table;
    clear: both;
}
