/* Weight and Volume Progress Bars */
.sidebar-progress-fill.weight {
    background: linear-gradient(90deg, #ff9800, #f57c00);
}

.sidebar-progress-fill.volume {
    background: linear-gradient(90deg, #9c27b0, #7b1fa2);
}

/* Inventory Tab - Full View */
.inventory-tab {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.inventory-tab h2 {
    color: #6bb9f0;
    margin-bottom: 1.5rem;
}

/* Modal Overlay */
.inventory-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

/* --- Redesigned Inventory Modal --- */
.inventory-modal-redesign {
    display: flex;
    flex-direction: column;
    height: 85vh;
    width: 95vw;
    max-width: 1400px;
    /* Match Workbench width */
    background: linear-gradient(135deg, #1e2a38 0%, #121820 100%);
    border: 1px solid #3a4b5c;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    color: #e0e6ed;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Top Bar */
.inventory-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid #3a4b5c;
    flex-shrink: 0;
}

.inventory-capacity-summary {
    display: flex;
    gap: 2rem;
    flex: 1;
}

.capacity-metric {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    max-width: 300px;
}

.metric-icon {
    font-size: 1.5rem;
}

.metric-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metric-text {
    font-size: 0.85rem;
    color: #a0aec0;
}

.metric-bar {
    height: 8px;
    background: #2d3748;
    border-radius: 4px;
    overflow: hidden;
}

.metric-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.metric-fill.weight {
    background: linear-gradient(90deg, #48bb78, #38a169);
}

.metric-fill.volume {
    background: linear-gradient(90deg, #4299e1, #3182ce);
}

.inventory-backpack-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.backpack-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.backpack-status.active {
    border: 1px solid #48bb78;
    color: #48bb78;
}

.backpack-status.inactive {
    border: 1px solid #e53e3e;
    color: #e53e3e;
}

.backpack-name {
    font-weight: 600;
    color: #fff;
}

.backpack-stats {
    font-size: 0.85rem;
    color: #a0aec0;
}

.close-btn {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #fff;
}

/* Main Layout */
.inventory-main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar Filters */
.inventory-sidebar-filters {
    width: 220px;
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid #3a4b5c;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #a0aec0;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.category-btn.active {
    background: rgba(66, 153, 225, 0.15);
    border-color: #4299e1;
    color: #63b3ed;
}

.cat-icon {
    font-size: 1.2rem;
    width: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cat-label {
    font-weight: 500;
}

/* Content Area */
.inventory-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow: hidden;
}

.inventory-search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #3a4b5c;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.inventory-search-bar input {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1rem;
    flex: 1;
    outline: none;
}

.inventory-items-grid {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 0.5rem;
}

/* Compact Item Card */
.inventory-item-card.compact {
    display: flex;
    flex-direction: row;
    background-color: rgba(26, 32, 44, 0.8);
    border: 1px solid #2d3748;
    border-radius: 0.5rem;
    padding: 0.75rem;
    gap: 1rem;
    align-items: stretch;
    transition: all 0.2s ease;
    margin-bottom: 0.75rem;
    /* Add separation between cards */
}

.inventory-item-card.compact:hover {
    border-color: #63b3ed;
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.item-image-section.small {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid #4a5568;
    margin: auto;
}

.item-img-thumb {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.item-icon-large {
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-icon-large.hidden {
    display: none;
}

.item-quantity-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #2d3748;
    border: 1px solid #4a5568;
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

.item-info-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
    /* Prevent flex overflow */
}

.item-header-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.item-emoji-inline {
    font-size: 1.2rem;
}

.item-name-compact {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-description-compact {
    margin: 0;
    font-size: 0.85rem;
    color: #a0aec0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-tier-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: #4a5568;
    color: #e2e8f0;
    font-weight: bold;
    margin-left: auto;
}

/* Tier Colors */
.text-tier-0 {
    color: #a0aec0;
}

/* Common - Gray */
.text-tier-1 {
    color: #ffffff;
}

/* Uncommon - White */
.text-tier-2 {
    color: #68d391;
}

/* Rare - Green */
.text-tier-3 {
    color: #63b3ed;
}

/* Epic - Blue */
.text-tier-4 {
    color: #9f7aea;
}

/* Legendary - Purple */
.text-tier-5 {
    color: #ed8936;
}

/* Mythic - Orange */

.item-icon-large.tier-0 {
    text-shadow: 0 0 10px rgba(160, 174, 192, 0.3);
}

.item-icon-large.tier-1 {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.item-icon-large.tier-2 {
    text-shadow: 0 0 10px rgba(104, 211, 145, 0.3);
}

.item-icon-large.tier-3 {
    text-shadow: 0 0 10px rgba(99, 179, 237, 0.3);
}

.item-icon-large.tier-4 {
    text-shadow: 0 0 10px rgba(159, 122, 234, 0.3);
}

.item-icon-large.tier-5 {
    text-shadow: 0 0 10px rgba(237, 137, 54, 0.3);
}


.item-stats-row {
    display: flex;
    align-items: stretch;
    /* Ensure separators stretch full height */
    gap: 1rem;
    margin-top: 0.25rem;
    flex-wrap: nowrap;
    /* Prevent wrapping to keep columns consistent */
}

.stat-group-fixed {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 140px;
    border-right: 1px solid #4a5568;
    padding-right: 1rem;
    justify-content: center;
    /* Center content vertically */
}

.stat-text {
    font-size: 0.8rem;
    color: #cbd5e0;
}

.stat-row-compact {
    display: grid;
    grid-template-columns: 20px 60px 1fr;
    align-items: center;
    font-size: 0.8rem;
    color: #cbd5e0;
    width: 100%;
}

.stat-row-compact .text-muted {
    color: #718096;
    font-size: 0.75rem;
    text-align: left;
}

.item-description-compact {
    font-size: 0.85rem;
    color: #a0aec0;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    white-space: normal;
    /* Ensure text wraps */
    overflow-wrap: break-word;
    /* Break long words if needed */
}

.stats-durability-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
    flex: 1;
    min-width: 0;
    justify-content: center;
    /* Center content vertically */
}

.stat-badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.stat-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

/* Variant Colors */
.stat-badge.capacity,
.stat-badge.endurance,
.stat-badge.health {
    background-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.4);
}

.stat-badge.damage,
.stat-badge.penetration {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.4);
}

.stat-badge.armor {
    background-color: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.4);
}

.stat-badge.crit,
.stat-badge.stamina {
    background-color: rgba(234, 179, 8, 0.2);
    color: #fde047;
    border-color: rgba(234, 179, 8, 0.4);
}

.stat-badge.accuracy {
    background-color: rgba(20, 184, 166, 0.2);
    color: #5eead4;
    border-color: rgba(20, 184, 166, 0.4);
}

.stat-badge.dodge {
    background-color: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.4);
}

.stat-badge.lifesteal {
    background-color: rgba(236, 72, 153, 0.2);
    color: #f9a8d4;
    border-color: rgba(236, 72, 153, 0.4);
}

.stat-badge.strength {
    background-color: rgba(249, 115, 22, 0.2);
    color: #fdba74;
    border-color: rgba(249, 115, 22, 0.4);
}

.stat-badge.agility {
    background-color: rgba(6, 182, 212, 0.2);
    color: #67e8f9;
    border-color: rgba(6, 182, 212, 0.4);
}

/* Durability Bar Styles */
.durability-container {
    width: 100%;
    margin-top: 0.5rem;
}

.durability-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    margin-bottom: 0.25rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.durability-text-low {
    color: #f87171;
}

.durability-track {
    height: 0.5rem;
    background-color: #374151;
    border-radius: 9999px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.durability-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.durability-fill.high {
    background-color: #10b981;
}

.durability-fill.medium {
    background-color: #eab308;
}

.durability-fill.low {
    background-color: #ef4444;
}

/* Actions Section */
.item-actions-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    border-left: 1px solid #4a5568;
    padding-left: 1rem;
    align-self: stretch;
    flex-direction: column;
    justify-content: flex-end;
    width: 180px;
    /* Fixed width for consistency */
    min-width: 180px;
    /* Ensure it doesn't shrink */
    flex-shrink: 0;
}

.category-header {
    grid-column: 1 / -1;
    padding: 0.5rem 0;
    color: #a0aec0;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #4a5568;
    margin: 0.5rem 0;
}

.item-actions-section.bottom-right {
    /* Deprecated class, keeping for safety but resetting styles if needed */
    margin-top: 0;
    align-self: center;
}

.action-btn {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.action-btn.use {
    background: rgba(72, 187, 120, 0.2);
    color: #48bb78;
    border: 1px solid rgba(72, 187, 120, 0.4);
}

.action-btn.use:hover {
    background: rgba(72, 187, 120, 0.3);
    transform: translateY(-1px);
}

.action-btn.equip {
    background: rgba(66, 153, 225, 0.2);
    color: #4299e1;
    border: 1px solid rgba(66, 153, 225, 0.4);
}

.action-btn.equip:hover {
    background: rgba(66, 153, 225, 0.3);
    transform: translateY(-1px);
}

.action-btn.unequip {
    background: rgba(237, 137, 54, 0.2);
    color: #ed8936;
    border: 1px solid rgba(237, 137, 54, 0.4);
}

.action-btn.unequip:hover {
    background: rgba(237, 137, 54, 0.3);
    transform: translateY(-1px);
}

.drop-actions-group {
    display: flex;
    gap: 2px;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px;
    border-radius: 6px;
    border: 1px solid rgba(245, 101, 101, 0.3);
}

.action-btn.drop {
    background: transparent;
    color: #f56565;
    border: none;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 4px;
}

.action-btn.drop:hover {
    background: rgba(245, 101, 101, 0.2);
}

.action-btn.drop.single {
    /* Style for single drop button */
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #718096;
    gap: 1rem;
}

.empty-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.item-card-equipped {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(66, 153, 225, 0.2);
    color: #63b3ed;
    border: 1px solid rgba(66, 153, 225, 0.4);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.item-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 0.5rem 1rem;
    align-items: center;
}