/*
 * The item strip on the bottom bar (js/MD/MD.InvStrip.js). Lives inside #passedInventoryItems in
 * templates/layout-*\/barAreaButtons.php, in place of the bar icons while the sidebar holds the
 * inventory. Same parchment and browns as the sidebar (css.sidebar.css).
 *
 * .htaccess caches text/css for a year: the <link> to this file carries ?v=filemtime().
 */

#passedInventoryItems.mdis-on {
    box-sizing: border-box;
    overflow: hidden;
    padding: 0;
}

.mdis {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    padding: 4px 10px 6px;
    font-family: 'Jost', Verdana, sans-serif;
    color: #4a3a24;
}

/* --- the head row: back link left, count and filter right ------------------------------ */
.mdis-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0 6px;
    border-bottom: 1px solid rgba(120, 95, 55, 0.25);
    margin-bottom: 4px;
}

.mdis-back {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 500;
    color: #7a6a4f;
    text-decoration: none;
    padding: 4px 6px 4px 2px;
    border-radius: 3px;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}
.mdis-back:hover {
    color: #3a2a18;
    background: rgba(120, 95, 55, 0.10);
    text-decoration: none;
}

.mdis-count {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    font-size: 10px;
    color: #a3937a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mdis-filterwrap {
    flex: 0 1 220px;
    min-width: 110px;
    position: relative;
    display: flex;
    align-items: center;
}

.mdis-filter {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 26px;
    box-sizing: border-box;
    padding: 0 22px 0 8px;
    font-family: 'Jost', Verdana, sans-serif;
    font-size: 12px;
    color: #3a2a18;
    background: #f7f3ea;
    border: 1px solid #c9b68a;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.mdis-filter:focus {
    border-color: #a8883c;
    box-shadow: 0 0 0 2px rgba(168, 136, 60, 0.15);
}
.mdis-filter::placeholder {
    color: #b5a588;
    font-style: italic;
}

/* only shown while there is something to clear */
.mdis-clear {
    display: none;
    position: absolute;
    right: 2px;
    top: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: #8a7758;
    font-size: 15px;
    line-height: 20px;
    cursor: pointer;
}
.mdis-clear:hover { color: #3a2a18; background: rgba(120, 95, 55, 0.10); }
#passedInventoryItems.has-filter .mdis-clear { display: block; }

/* --- the list: the one thing that scrolls --------------------------------------------- */
.mdis-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 3px;
    padding: 2px 2px 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(120, 95, 55, 0.45) transparent;
}
.mdis-list::-webkit-scrollbar { width: 7px; }
.mdis-list::-webkit-scrollbar-track { background: transparent; }
.mdis-list::-webkit-scrollbar-thumb { background: rgba(120, 95, 55, 0.45); border-radius: 4px; }
.mdis-list::-webkit-scrollbar-thumb:hover { background: rgba(120, 95, 55, 0.7); }

/* --- tiles ------------------------------------------------------------------------------ */
/* 44px is the touch floor; the drawing inside stays at the 40px the old strip drew it at. */
.mdis-tile {
    position: relative;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 2px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s, background 0.12s, border-color 0.12s;
}
.mdis-tile img {
    display: block;
    width: 40px;
    height: 40px;
    object-fit: contain;
    pointer-events: none;
}
.mdis-tile img.mdis-noart { opacity: 0.3; }
.mdis-tile:hover,
.mdis-tile:focus-visible {
    transform: scale(1.1);
    background: rgba(255, 246, 214, 0.9);
    border-color: #d9c48f;
    outline: none;
    z-index: 1;
}
.mdis-tile:active { transform: scale(1.02); }

/* recharging: still opens its modal, but reads as not ready from across the bar */
.mdis-tile.is-cool img { opacity: 0.45; filter: grayscale(0.6); }
.mdis-tile.is-cool:hover img { opacity: 0.7; }

/* usable now: the same green dot the sidebar tile wears */
.mdis-dot {
    position: absolute;
    right: 3px;
    top: 3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3f9b46;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
    pointer-events: none;
}

.mdis-empty {
    width: 100%;
    padding: 18px 6px;
    text-align: center;
    font-size: 12px;
    color: #a3937a;
    font-style: italic;
}
.mdis-empty b { color: #7a6a4f; font-weight: 600; font-style: normal; }

/* --- narrow (tablet) bar: the head wraps, the filter takes the whole second line ------ */
@media (max-width: 760px) {
    .mdis { padding: 4px 8px 6px; }
    .mdis-head { flex-wrap: wrap; gap: 4px 8px; }
    .mdis-count { flex: 1 1 auto; }
    .mdis-filterwrap { flex: 1 1 100%; order: 3; min-width: 0; }
}
