.inventory-layout {
    display: flex;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    align-items: flex-start;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.inventory-panel {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0 24px 24px 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.filters-panel {
    width: 360px;
    background: transparent;
    border: 1px solid #1a1a1c;
    border-radius: 12px;
    padding: 12px 24px 4px 24px;
    flex-shrink: 0;
}

.inventory-header {
    border-bottom: 1px solid #333;
    padding-bottom: 12px;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.inv-pixel-title {
    font-family: 'Press Start 2P', cursive;
    color: var(--gold);
    font-size: 0.85rem;
    text-transform: uppercase;
    margin: 0;
    letter-spacing: 1px;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
}

.inventory-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.inv-tabs {
    display: flex;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 3px;
    gap: 2px;
}

.inv-control {
    height: 32px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #222;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0 10px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.inv-tabs .filter-btn {
    border: none;
    background: transparent;
    border-radius: 4px;
    height: 28px;
    padding: 0 15px;
    color: #fff;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    text-transform: uppercase;
    transition: all 0.2s;
}

.inv-tabs .filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.inv-tabs .filter-btn.active {
    background: var(--gold);
    color: #000;
}

.inv-control:hover {
    background-color: #333;
    border-color: var(--accent);
}

.inv-control.active {
    background-color: var(--accent);
    border-color: #747bff;
    color: #fff;
}

select.inv-control,
.inv-control.inv-dropdown {
    padding-right: 30px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23fff' d='M0 3l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    text-align-last: left;
    justify-content: flex-start;
}

.inventory-control-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

.inventory-control-group .inv-control {
    width: 100%;
}

.inventory-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.inventory-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: 0;
}

.inventory-body {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    width: 100%;
}

.inventory-grid-container {
    flex: 1;
}

.inventory-sidebar {
    width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 12px 15px 4px 15px;
    background: rgba(20, 20, 20, 0.4);
    border-radius: 12px;
    border: 1px solid #333;
    margin-top: 0;
}

.sidebar-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    width: 100%;
}

.sidebar-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.65rem;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    width: 110px;
    text-align: left;
    flex-shrink: 0;
}

.sidebar-group>*:not(.sidebar-label) {
    flex: 0 0 200px;
    min-width: 0;
}

.sidebar-group .inv-control {
    flex: 1;
}

/* Inventory Grid Layout */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 10px 10px 10px 0;
    overflow-y: auto;
}

/* Modal specific grid constraints */
#modal-inventory-grid {
    padding-right: 10px;
    /* Space for scrollbar */
}

/* Item Card Styling */
.inv-item-card {
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    position: relative;
    overflow: hidden;
    height: 80px;
    /* Fixed height to prevent shrinking */
    flex-shrink: 0;
}

.inv-item-card:hover {
    background: rgba(40, 40, 40, 0.8);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.inv-item-card:active {
    transform: translateY(0);
}

.inv-icon {
    width: 48px;
    height: 48px;
    background-size: cover;
    background-position: center;
    background-color: #1a1a1a;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    position: relative; /* For item-count positioning */
}

/* Item count overlay */
.item-count {
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.5rem;
    color: #fff;
    text-shadow: 1px 1px 0px #000, -1px -1px 0px #000, 1px -1px 0px #000, -1px 1px 0px #000;
    pointer-events: none;
    z-index: 5;
}


.inv-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.inv-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55rem;
    line-height: 1.4;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inv-sub {
    font-size: 0.75rem;
    color: #888;
    text-transform: capitalize;
}

/* Item Details specific pixel font classes */
.item-details-pixel-rarity {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.item-details-pixel-slot {
    font-size: 0.75rem;
    color: #666;
}

.item-details-pixel-desc {
    font-family: 'Inter', sans-serif;
    color: #ccc;
    font-style: italic;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 10px;
}

.item-details-grid {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-top: 5px;
}

.item-details-stats-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-details-sockets-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-details-pixel-stat-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.pixel-tooltip {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    background: #1a1a1f;
    border: 1px solid var(--gold);
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.8);
    max-width: 250px;
    animation: tooltip-fade-in 0.15s ease-out;
}

@keyframes tooltip-fade-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.pixel-tooltip-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    color: var(--gold);
    margin-bottom: 8px;
    text-transform: uppercase;
    line-height: 1.3;
}

.pixel-tooltip-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #ccc;
    font-style: italic;
    margin-bottom: 8px;
}

.pixel-tooltip-stat {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55rem;
    color: var(--gold);
}

.item-details-pixel-stat-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55rem;
    color: #888;
    text-transform: uppercase;
    display: inline-block;
    width: 85px;
}

.item-details-pixel-stat-value {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
}

/* Universal Pixel-Art Button */
.inv-btn-pixel {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    background: var(--gold);
    color: #000 !important;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
    text-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
}

.inv-btn-pixel:hover {
    background: #ffec8b;
    transform: scale(1.05);
}

/* Skill book learning */
.skill-book-summary { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.skill-book-cover { width: 72px; height: 72px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid; border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
.skill-book-cover img { width: 56px; height: 56px; object-fit: cover; image-rendering: pixelated; }
.skill-book-skill-name { color: #fff; font-weight: 800; line-height: 1.35; }
.skill-book-count, .skill-book-description, .skill-book-hero-meta { color: #b8b8c2; }
.skill-book-description { margin: 0 0 20px; line-height: 1.5; }
.skill-book-heading { margin: 0 0 10px; color: var(--gold); font-size: 0.82rem; }
.skill-book-hero-list { display: flex; flex-direction: column; gap: 8px; }

.skill-book-hero-option {
    min-height: 52px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #444;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, border-color 0.2s;
}

.skill-book-hero-option:hover,
.skill-book-hero-option:focus-visible { border-color: var(--gold); background: rgba(255, 215, 0, 0.08); }
.skill-book-hero-option:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.skill-book-hero-name { font-weight: 800; }
.skill-book-hero-meta { grid-column: 1; font-size: 0.78rem; }
.skill-book-learn-label { grid-column: 2; grid-row: 1 / span 2; color: var(--gold); font-size: 0.75rem; font-weight: 800; text-transform: uppercase; }
.skill-book-empty, .skill-book-feedback { padding: 14px; border-radius: 8px; color: #c8c8d0; background: rgba(255, 255, 255, 0.04); line-height: 1.5; }
.skill-book-feedback:empty { display: none; }
.skill-book-feedback { margin-top: 12px; color: #b9ffad; border: 1px solid rgba(30, 255, 0, 0.25); }

.inv-btn-pixel:active {
    transform: scale(0.95);
}

.inv-btn-pixel:disabled {
    background: #444 !important;
    color: #888 !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}


/* Gem Socketing Modal Styles */
.socketing-list-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.socketing-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: transparent;
    margin-bottom: 4px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.socketing-item-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.socketing-item-row.active {
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.05);
}

.socketing-modal-footer {
    padding: 20px;
    border-top: none;
    display: flex;
    justify-content: center;
    background: transparent;
}

.socketing-modal-footer .inv-btn-pixel {
    min-width: 180px;
    height: 44px;
    font-size: 0.75rem;
}

.socketing-modal-footer .inv-btn-pixel:disabled {
    background: #444;
    color: #888 !important;
    cursor: not-allowed;
    transform: none;
}
