/**
 * Inventory System Styling
 * Document-style inventory matching prayer book aesthetic
 */

/* Main container */
.inventory-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #3A3238;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    font-family: 'Courier New', monospace;
}

/* Close button */
.inventory-close {
    position: absolute;
    right: 20px;
    top: 20px;
    background: transparent;
    border: 2px solid #8E7F7F;
    color: #5F5449;
    font-size: 16px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Courier New', monospace;
    z-index: 300;
}

.inventory-close:hover {
    background: rgba(142, 127, 127, 0.2);
    border-color: #5F5449;
}

/* Document container */
.inventory-document {
    position: relative;
    width: 90%;
    max-width: 1000px;
    height: 650px;
    background: #EBE6D8;
    border: 2px solid #8E7F7F;
    box-shadow:
        0 0 30px rgba(0,0,0,0.3),
        inset 0 0 100px rgba(210,180,140,0.1);
    display: flex;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════
   TUTORIAL MODE — chapter-scripted layout strip-down
   (Day 5 Kitty ibuprofen + future tutorial moments).
   ═══════════════════════════════════════════════════════ */

/* Hide the equipment sidebar entirely when the scene doesn't
   want to reveal the body diagram yet. Categories + items
   reflow to fill the freed space. */
.inv-tutorial.inv-hide-equipment .inventory-document {
    width: min(80%, 720px);
    max-width: 720px;
}
.inv-tutorial.inv-hide-equipment .inventory-equipment {
    display: none !important;
}
.inv-tutorial.inv-hide-equipment .inventory-content {
    border-right: none !important;
}

/* Categories sidebar gets a quieter look in tutorial mode —
   no overwhelming menu when only one or two items matter. */
.inv-tutorial .inventory-category {
    opacity: .92;
}
.inv-tutorial .inventory-category.active {
    opacity: 1;
}

/* Paper texture */
.inventory-document::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.8"/></filter><rect width="100" height="100" filter="url(%23noise)" opacity="0.1"/></svg>');
    pointer-events: none;
    opacity: 0.3;
    z-index: 0;
}

/* Left sidebar - categories */
.inventory-sidebar {
    width: 200px;
    background: rgba(142, 127, 127, 0.1);
    border-right: 2px solid #8E7F7F;
    padding: 20px;
    overflow-y: auto;
    z-index: 1;
}

.inventory-sidebar h2 {
    color: #5F5449;
    font-size: 16px;
    margin-bottom: 20px;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #8E7F7F;
}

.inventory-categories {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.inventory-category {
    background: transparent;
    border: 2px solid #8E7F7F;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #5F5449;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
}

.inventory-category:hover {
    background: rgba(142, 127, 127, 0.15);
    border-color: #5F5449;
}

.inventory-category.active {
    background: #5F5449;
    border-color: #5F5449;
    color: #EBE6D8;
}

/* Right sidebar - Equipment list */
.inventory-equipment {
    width: 240px;
    background: rgba(142, 127, 127, 0.1);
    border-left: 2px solid #8E7F7F;
    padding: 20px;
    overflow-y: auto;
    z-index: 1;
}

.equipment-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #8E7F7F;
}

.equipment-title {
    color: #5F5449;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.equipment-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.equipment-slot {
    background: transparent;
    border: 2px solid #8E7F7F;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.equipment-slot:hover {
    background: rgba(142, 127, 127, 0.1);
    border-color: #5F5449;
}

.equipment-slot.equipped {
    background: rgba(95, 84, 73, 0.08);
    border-color: #5F5449;
}

.equipment-slot-label {
    color: #8E7F7F;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    margin-bottom: 8px;
}

.equipment-slot-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.equipment-slot-icon {
    font-size: 24px;
    min-width: 30px;
    text-align: center;
}

.equipment-slot-info {
    flex: 1;
}

.equipment-slot-name {
    color: #5F5449;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 3px;
}

.equipment-slot-stats {
    color: #8E7F7F;
    font-size: 9px;
}

.equipment-slot-empty {
    color: #8E7F7F;
    font-size: 11px;
    font-style: italic;
}

/* Total Stats */
.equipment-total {
    margin-top: 20px;
    padding: 15px;
    border: 2px solid #8E7F7F;
    background: rgba(95, 84, 73, 0.05);
}

.equipment-total-title {
    color: #5F5449;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-align: center;
}

.equipment-total-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.equipment-total-stat {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #5F5449;
}

.equipment-total-label {
    text-transform: uppercase;
    letter-spacing: 1px;
}

.equipment-total-value {
    font-weight: bold;
}

/* Main content area */
.inventory-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    z-index: 1;
    position: relative;
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #8E7F7F;
}

.inventory-title {
    color: #5F5449;
    font-size: 18px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.inventory-stats {
    display: flex;
    gap: 20px;
    color: #8E7F7F;
    font-size: 11px;
}

.inventory-stat {
    display: flex;
    gap: 5px;
}

.inventory-stat-label {
    font-weight: bold;
    color: #5F5449;
}

/* Items grid */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.inventory-item {
    background: transparent;
    border: 2px solid #8E7F7F;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 140px;
}

.inventory-item:hover {
    background: rgba(142, 127, 127, 0.1);
    border-color: #5F5449;
}

.inventory-item-icon {
    font-size: 64px;
    margin-bottom: 10px;
    line-height: 1;
}

.inventory-item-name {
    color: #5F5449;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.inventory-item-quantity {
    color: #8E7F7F;
    font-size: 10px;
    margin-bottom: 8px;
}

.inventory-item-weight {
    color: #8E7F7F;
    font-size: 9px;
    font-style: italic;
}

.inventory-item.empty {
    border-style: dashed;
    opacity: 0.3;
    cursor: default;
}

.inventory-item.empty:hover {
    background: transparent;
    border-color: #8E7F7F;
}

/* Item details modal */
.inventory-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
}

.inventory-modal-content {
    background: #EBE6D8;
    border: 2px solid #8E7F7F;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    font-family: 'Courier New', monospace;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    position: relative;
}

.inventory-modal-content::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.8"/></filter><rect width="100" height="100" filter="url(%23noise)" opacity="0.1"/></svg>');
    pointer-events: none;
    opacity: 0.3;
    z-index: 0;
}

.inventory-modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #8E7F7F;
    position: relative;
    z-index: 1;
}

.inventory-modal-icon {
    font-size: 48px;
}

.inventory-modal-info {
    flex: 1;
}

.inventory-modal-name {
    color: #5F5449;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.inventory-modal-type {
    color: #8E7F7F;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.inventory-modal-body {
    position: relative;
    z-index: 1;
}

.inventory-modal-description {
    color: #5F5449;
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(142, 127, 127, 0.05);
    border: 1px solid #8E7F7F;
}

.inventory-modal-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.inventory-modal-detail {
    display: flex;
    justify-content: space-between;
    color: #5F5449;
    font-size: 11px;
    padding: 8px;
    border-bottom: 1px solid rgba(142, 127, 127, 0.3);
}

.inventory-modal-detail-label {
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.inventory-modal-actions {
    display: flex;
    gap: 10px;
}

/* THE CARD FITS THE SCREEN. A scene's dialogue strip holds the
   bottom of the screen (the Day-4 hoodie lesson); at 1600x900 the
   card ran past it and EQUIP / COMPARE sat under the strip —
   unclickable, the lesson stuck. The card now scrolls inside the
   screen, its buttons stay pinned to its bottom edge, and while a
   strip is up the modal keeps above it (same reserve as the pills
   mixer's window). */
.inventory-modal-content {
    max-height: calc(var(--vh100, 100vh) - 40px);
    overflow-y: auto;
    box-sizing: border-box;
}
.inventory-modal-actions {
    position: sticky;
    bottom: -30px;          /* the card's own padding — sit on its edge, nothing peeking under */
    margin: 0 -30px -30px;
    padding: 12px 30px 30px;
    background: #EBE6D8;
    box-shadow: 0 -8px 12px -10px rgba(0, 0, 0, 0.25);
    z-index: 2;
}
body:has(#overlayDialogue) .inventory-modal {
    padding-bottom: 176px;
    box-sizing: border-box;
}
body:has(#overlayDialogue) .inventory-modal-content {
    max-height: calc(var(--vh100, 100vh) - 206px);
}

.inventory-modal-btn {
    flex: 1;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.inventory-modal-btn-primary {
    background: #5F5449;
    border: 2px solid #5F5449;
    color: #EBE6D8;
}

.inventory-modal-btn-primary:hover {
    background: #4A3934;
    border-color: #4A3934;
}

.inventory-modal-btn-secondary {
    background: transparent;
    border: 2px solid #8E7F7F;
    color: #5F5449;
}

.inventory-modal-btn-secondary:hover {
    background: rgba(142, 127, 127, 0.1);
}

/* Empty state */
.inventory-empty {
    text-align: center;
    padding: 60px 20px;
    color: #8E7F7F;
}

.inventory-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.inventory-empty-text {
    font-size: 14px;
    line-height: 1.6;
}

/* Scrollbar styling */
.inventory-sidebar::-webkit-scrollbar,
.inventory-content::-webkit-scrollbar {
    width: 8px;
}

.inventory-sidebar::-webkit-scrollbar-track,
.inventory-content::-webkit-scrollbar-track {
    background: rgba(142, 127, 127, 0.1);
}

.inventory-sidebar::-webkit-scrollbar-thumb,
.inventory-content::-webkit-scrollbar-thumb {
    background: #8E7F7F;
    border-radius: 4px;
}

.inventory-sidebar::-webkit-scrollbar-thumb:hover,
.inventory-content::-webkit-scrollbar-thumb:hover {
    background: #5F5449;
}
