/* ===================================
   REAGENT BROWSER - Unified Component
   ===================================
   Reusable reagent list with tier filters, search, optional drag-and-drop
   slots, and rarity/boost color coding.  Used by the reagent bag,
   blacksmith, and jeweler panels.
   =================================== */

/* --- Container --- */
.rb-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* --- Header (filters + search) --- */
.rb-header {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.rb-filters {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.rb-filter-btn {
    padding: 3px 7px;
    border-radius: 6px;
    border: 1px solid #555;
    background: rgba(74, 55, 40, 0.4);
    color: #ccc;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.rb-filter-btn:hover {
    border-color: #888;
}

.rb-filter-btn.active {
    background: linear-gradient(135deg, #4a3728, #5a4738);
    border-color: #d4af37;
    color: #d4af37;
}

.rb-search {
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid #555;
    background: rgba(20, 16, 12, 0.6);
    color: #ddd;
    font-size: 12px;
    outline: none;
}

.rb-search:focus {
    border-color: #d4af37;
}

/* --- Slot Row --- */
.rb-slots {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.rb-slot {
    flex: 1 1 0;
    min-width: 0;
    background: rgba(20, 16, 12, 0.6);
    border: 1px dashed #555;
    border-radius: 8px;
    padding: 5px 6px;
    text-align: center;
    color: #888;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    transition: border-color 0.15s, box-shadow 0.15s;
    overflow: hidden;
}

.rb-slot.filled {
    border-style: solid;
    border-color: rgba(100, 80, 60, 0.8);
    color: #ddd;
}

.rb-slot.drop-target {
    border-color: #d4af37;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

.rb-slot-label {
    font-size: 10px;
    text-transform: uppercase;
    color: #aaa;
    letter-spacing: 0.5px;
}

.rb-slot-content {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    overflow: hidden;
}

.rb-slot-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    flex-shrink: 0;
}

.rb-slot-remove {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 13px;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s;
}

.rb-slot-remove:hover {
    color: #d4af37;
}

/* --- Scrollable List --- */
.rb-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 4px;
    touch-action: pan-y;
}

.rb-list::-webkit-scrollbar {
    width: 7px;
}

.rb-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.rb-list::-webkit-scrollbar-thumb {
    background: #8B4513;
    border-radius: 4px;
}

.rb-list::-webkit-scrollbar-thumb:hover {
    background: #A0522D;
}

/* --- Reagent Row --- */
.rb-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(100, 80, 60, 0.5);
    background: rgba(50, 40, 30, 0.55);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}

.rb-item:hover {
    border-color: #d4af37;
    background: rgba(60, 48, 35, 0.7);
}

.rb-item.selected {
    border-color: #d4af37;
    background: rgba(70, 55, 40, 0.8);
    box-shadow: inset 0 0 6px rgba(212, 175, 55, 0.15);
}

.rb-item.dragging {
    opacity: 0.5;
}

/* Icon */
.rb-item .rb-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
    flex-shrink: 0;
}

/* Info column */
.rb-item .rb-info {
    flex: 1;
    min-width: 0;
}

.rb-item .rb-name {
    font-size: 12px;
    color: #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rb-item .rb-meta {
    font-size: 10px;
    color: #aaa;
}

/* Boost text */
.rb-item .rb-boost {
    font-size: 10px;
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Empty state */
.rb-empty {
    color: #777;
    font-size: 12px;
    text-align: center;
    padding: 16px;
}

/* ===========================
   Rarity left-border + glow on rows
   =========================== */
.rb-item.rb-rarity-1 {
    box-shadow: inset 3px 0 0 #808080, 0 0 6px rgba(128, 128, 128, 0.15);
}
.rb-item.rb-rarity-1 .rb-icon { border-color: rgba(128, 128, 128, 0.5); }
.rb-item.rb-rarity-1 .rb-name { color: #ccc; }

.rb-item.rb-rarity-2 {
    box-shadow: inset 3px 0 0 #00FF00, 0 0 8px rgba(0, 255, 0, 0.15);
}
.rb-item.rb-rarity-2 .rb-icon { border-color: rgba(0, 255, 0, 0.5); }
.rb-item.rb-rarity-2 .rb-name { color: #66FF66; }

.rb-item.rb-rarity-3 {
    box-shadow: inset 3px 0 0 #0080FF, 0 0 10px rgba(0, 128, 255, 0.2);
}
.rb-item.rb-rarity-3 .rb-icon { border-color: rgba(0, 128, 255, 0.6); }
.rb-item.rb-rarity-3 .rb-name { color: #66B3FF; }

.rb-item.rb-rarity-4 {
    box-shadow: inset 3px 0 0 #8000FF, 0 0 12px rgba(128, 0, 255, 0.2);
}
.rb-item.rb-rarity-4 .rb-icon { border-color: rgba(128, 0, 255, 0.6); }
.rb-item.rb-rarity-4 .rb-name { color: #B366FF; }

.rb-item.rb-rarity-5 {
    box-shadow: inset 3px 0 0 #FFD700, 0 0 14px rgba(255, 215, 0, 0.25);
    animation: rb-legendary-pulse 2s ease-in-out infinite alternate;
}
.rb-item.rb-rarity-5 .rb-icon { border-color: rgba(255, 215, 0, 0.7); }
.rb-item.rb-rarity-5 .rb-name { color: #FFD700; font-weight: bold; }

/* Hover enhances glow */
.rb-item.rb-rarity-1:hover { box-shadow: inset 3px 0 0 #808080, 0 0 10px rgba(128, 128, 128, 0.3); }
.rb-item.rb-rarity-2:hover { box-shadow: inset 3px 0 0 #00FF00, 0 0 14px rgba(0, 255, 0, 0.3); }
.rb-item.rb-rarity-3:hover { box-shadow: inset 3px 0 0 #0080FF, 0 0 16px rgba(0, 128, 255, 0.35); }
.rb-item.rb-rarity-4:hover { box-shadow: inset 3px 0 0 #8000FF, 0 0 18px rgba(128, 0, 255, 0.35); }
.rb-item.rb-rarity-5:hover { box-shadow: inset 3px 0 0 #FFD700, 0 0 22px rgba(255, 215, 0, 0.45); }

@keyframes rb-legendary-pulse {
    0%   { box-shadow: inset 3px 0 0 #FFD700, 0 0 8px rgba(255, 215, 0, 0.2); }
    100% { box-shadow: inset 3px 0 0 #FFD700, 0 0 16px rgba(255, 215, 0, 0.45); }
}

/* Rarity-colored text in meta */
.rb-rarity-label-1 { color: #808080; }
.rb-rarity-label-2 { color: #00FF00; }
.rb-rarity-label-3 { color: #66B3FF; }
.rb-rarity-label-4 { color: #B366FF; }
.rb-rarity-label-5 { color: #FFD700; }

/* ===========================
   Boost-type color on boost text
   =========================== */
.rb-boost-luck            { color: #C77DFF; }
.rb-boost-overall_yield   { color: #32CD32; }
.rb-boost-strength        { color: #FF6347; }
.rb-boost-speed           { color: #00BFFF; }
.rb-boost-gold_yield      { color: #FFD700; }
.rb-boost-silver_yield    { color: #C0C0C0; }
.rb-boost-copper_yield    { color: #CD7F32; }

/* ===========================
   Slot text overflow handling
   =========================== */
.rb-slot-content span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
    font-size: 11px;
}
