/* Weight and Volume Progress Bars */
.sidebar-progress-fill.weight {
    background: var(--game-gradient-health);
    /* Using health/red-orange for weight/load */
}

.sidebar-progress-fill.volume {
    background: var(--game-gradient-stamina);
    /* Using stamina/yellow-gold for volume */
}

/* 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 --- */
/* --- Redesigned Inventory Modal --- */
.game-modal-container.inventory-modal-redesign {
    display: flex;
    flex-direction: column;
    height: 90%;
    max-height: 90%;
    width: 95vw;
    max-width: 1400px;
    background: var(--game-bg-modal);
    border: 1px solid var(--game-border-color);
    box-shadow: var(--game-shadow-modal);
    overflow: hidden;
    color: var(--game-text-primary);
    font-family: var(--game-font-main);
    clip-path: var(--game-clip-path);
}

.game-modal-container.inventory-modal-redesign .game-modal-content {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Ensure it fills the container */
}

/* Top Bar */
.inventory-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--game-bg-panel);
    border-bottom: 1px solid var(--game-border-color);
    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: rgba(0, 0, 0, 0.5);
    overflow: hidden;
    border: 1px solid var(--game-border-color);
    clip-path: var(--game-clip-path-sm);
}

.metric-fill {
    height: 100%;
    clip-path: var(--game-clip-path-sm);
    transition: width 0.3s ease;
}

.metric-fill.weight {
    background: var(--game-gradient-health);
}

.metric-fill.volume {
    background: var(--game-gradient-stamina);
}

.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;
    background: rgba(255, 255, 255, 0.05);
    clip-path: var(--game-clip-path);
}

.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 */
/* Sidebar Filters */
.inventory-sidebar-filters {
    width: 220px;
    background: var(--game-bg-panel);
    border-right: 1px solid var(--game-border-color);
    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: 1px solid transparent;
    clip-path: var(--game-clip-path-sm);
    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;
    background-color: var(--game-bg-panel);
}

.game-search-container {
    margin-bottom: 1.5rem;
    box-sizing: border-box;
}

/* View Toggle Button */
.inventory-view-toggle {
    display: flex;
    align-items: center;
    border-left: 1px solid var(--game-border-color);
    padding-left: 0.75rem;
    margin-left: 0.5rem;
}

.view-toggle-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #a0aec0;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    /* Minor radius for small button */
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-toggle-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.view-toggle-btn.active {
    color: #63b3ed;
    background: rgba(66, 153, 225, 0.15);
    border-color: rgba(66, 153, 225, 0.3);
}

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

/* Grid View Layout */
/* Grid View Layout */
.items-container.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 90px);
    justify-content: center;
    grid-auto-rows: max-content;
    gap: 0.5rem;
    align-content: start;
}

.items-container.list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Wrapper to handle tooltip + card relative positioning */
.inventory-grid-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Compact Item Card */
/* Compact Item Card */
.inventory-item-card.compact {
    display: flex;
    flex-direction: row;
    background-color: var(--game-bg-card);
    border: 1px solid var(--game-border-color);
    clip-path: var(--game-clip-path);
    padding: 0.75rem;
    gap: 1rem;
    align-items: stretch;
    transition: all 0.2s ease;
    margin-bottom: 0.75rem;
    box-shadow: var(--game-shadow-sm);
}

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

/* Base Card Style for Grid */
.inventory-item-card.grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--game-bg-card);
    border: 1px solid var(--game-border-color);
    clip-path: var(--game-clip-path);
    padding: 0.5rem;
    aspect-ratio: 1;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--game-shadow-sm);
    width: 90px;
    height: 90px;
    box-sizing: border-box;
}

.inventory-item-card.grid:hover,
.inventory-item-card.grid.active {
    border-color: #63b3ed;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.inventory-item-card.grid.equipped {
    border-color: #63b3ed;
    background: rgba(66, 153, 225, 0.1);
}

/* Grid Image Area */
.item-grid-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.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);
    clip-path: var(--game-clip-path-no-br);
    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;
}

/* Grid Icon adjustments */
.inventory-item-card.grid .item-icon-large {
    font-size: 2.5rem;
}

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



.item-equipped-indicator {
    position: absolute;
    top: 2px;
    left: 2px;
    /* moved to left to free up space for clip path */
    background: #4299e1;
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: var(--game-clip-path-sm);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.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;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-tier-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    clip-path: var(--game-clip-path-sm);
    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;
    clip-path: var(--game-clip-path-sm);
    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,
.stat-badge.buff {
    background-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.4);
}

.stat-badge.cure {
    background-color: rgba(45, 212, 191, 0.2);
    color: #5eead4;
    border-color: rgba(45, 212, 191, 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;
    background-color: #374151;
    clip-path: var(--game-clip-path-sm);
    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;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.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: 1px solid var(--game-border-color);
    background: rgba(255, 255, 255, 0.05);
    clip-path: var(--game-clip-path-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-btn:disabled,
.action-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(100%);
    pointer-events: none;
    background: rgba(144, 144, 144, 0.2) !important;
    color: #a0aec0 !important;
    border-color: rgba(160, 174, 192, 0.4) !important;
    transform: none !important;
}

.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(234, 113, 66, 0.1);
    color: var(--game-color-primary);
    border: 1px solid var(--game-color-primary);
}

.action-btn.unequip:hover {
    background: rgba(234, 113, 66, 0.2);
    transform: translateY(-1px);
}

.drop-actions-group {
    display: flex;
    gap: 2px;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px;
    clip-path: var(--game-clip-path-sm);
    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;
    clip-path: var(--game-clip-path-sm);
}

.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;
    clip-path: var(--game-clip-path-sm);
    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;
}

/* Backpack Category Sections */
.backpack-category-section {
    margin-bottom: 0.5rem;
}

/* Tooltip Custom Content */
.item-tooltip-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 180px;
}

.tooltip-header {
    font-weight: 700;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 0.25rem;
    margin-bottom: 0.25rem;
}

.tooltip-desc {
    color: #a0aec0;
    font-size: 0.85rem;
    font-style: italic;
    line-height: 1.3;
}

.tooltip-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #cbd5e0;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.tooltip-stat {
    font-size: 0.85rem;
    font-weight: 500;
    color: #e2e8f0;
}