/* =========================================
   INVENTORY & FACTORY UI - HOLOGRAPHIC V4
   ========================================= */

/* Mengurangi jarak (gap) dan lebar maksimal (max-width) agar kotak mengecil */
.inventory-grid { 
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 320px; margin: 0 auto; 
}

/* --- KOTAK ITEM DI DALAM TAS --- */
.inv-box {
    background: rgba(13, 17, 23, 0.6); 
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    border-radius: 8px; aspect-ratio: 1/1; 
    display: flex; justify-content: center; align-items: center;
    position: relative; cursor: pointer; width: 100%; 
    border: 1px solid rgba(255,255,255,0.1); 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}

.inv-box:hover { transform: translateY(-3px) scale(1.05); z-index: 2; }
.inv-box:active { transform: scale(0.95); }

/* Jika kotak ada isinya, beri efek nyala */
.inv-box:not(:empty) { 
    background: rgba(22, 27, 34, 0.8);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(255,255,255,0.05); 
}

.inv-img { width: 75%; height: 75%; object-fit: contain; filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.8)); }
.inv-rarity { position: absolute; top: 3px; left: 5px; font-size: 11px; font-weight: 900; text-shadow: 0 2px 4px #000, 0 0 8px currentColor; }
.inv-dot { width: 8px; height: 8px; border-radius: 50%; position: absolute; bottom: 4px; right: 4px; border: 1px solid #000; box-shadow: 0 0 5px currentColor;}

/* Efek Khusus Item Mythic & Legendary */
.glow-mythic {
    border-width: 2px !important; box-shadow: 0 0 15px rgba(255, 0, 85, 0.5), inset 0 0 10px rgba(255, 0, 85, 0.2) !important;
    animation: pulse-mythic 2s infinite ease-in-out;
}
@keyframes pulse-mythic {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 0, 85, 0.4); }
    50% { box-shadow: 0 0 25px rgba(255, 0, 85, 0.8); }
}

/* --- WADAH ITEM YANG DIPAKAI (EQUIPPED) --- */
#equipped-slots {
    display: flex;
    justify-content: center; /* Ketengahkan semua slot */
    gap: 10px !important; /* Jarak antar slot diperlebar */
    overflow: visible !important; /* HAPUS PAKSA SCROLL BAR BAWAAN HTML */
    flex-wrap: wrap !important; /* Otomatis susun ke bawah jika layar HP terlalu kecil */
    margin: 0 auto 25px auto !important;
    max-width: 340px; /* Lebarkan frame khusus kotak equip */
}

/* --- KOTAK ITEM YANG DIPAKAI --- */
.equip-slot { 
    width: 55px; height: 55px; /* Dibesarkan sedikit agar gambar dan teks tidak berdesakan */
    background: rgba(22, 27, 34, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border: 1px solid #30363d; border-radius: 8px; 
    display: flex; flex-direction: column; justify-content: center; align-items: center; 
    position: relative; flex-shrink: 0; cursor: pointer; transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.equip-slot:hover { transform: translateY(-3px); }
.equip-slot:active { transform: scale(0.92); }
.equip-slot:has(.equip-img) { background: rgba(46, 204, 113, 0.05); box-shadow: 0 0 15px rgba(46, 204, 113, 0.1); border-width: 2px;}

/* Penyesuaian gambar dan teks agar pas di kotak 55px */
.equip-img { width: 28px; height: 28px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));}
.equip-label { position: absolute; bottom: -16px; font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.5px; width: 100%; text-align: center; text-shadow: 0 0 5px rgba(0,0,0,0.8); border:none !important;}
.equip-empty { color: #6e7681; font-size: 8px; font-weight: bold; text-transform: uppercase; opacity: 0.5; letter-spacing: 1px;}

/* --- TOMBOL MATERIAL (ORE / ENERGY) --- */
.material-btn { 
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer; 
    padding: 8px 12px; background: rgba(13, 17, 23, 0.7); 
    border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; 
    transition: 0.2s ease; font-size: 12px; font-weight: 900; color: #e6edf3;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.material-btn:hover { background: rgba(255, 202, 40, 0.15); border-color: var(--gold); transform: translateY(-2px); box-shadow: 0 4px 15px rgba(255, 202, 40, 0.2); }
.material-sell-tag { font-size: 9px; color: var(--gold); border: 1px solid var(--gold); padding: 2px 6px; border-radius: 4px; letter-spacing: 1px; background: rgba(255, 202, 40, 0.1); }
.icon-mini { width: 22px !important; height: 22px !important; object-fit: contain; display: inline-block; vertical-align: middle; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.8));}

/* --- JUDUL SEKSI INVENTORY --- */
#screen-inventory h3, #screen-inventory h4, .inv-section-title {
    color: var(--emerald); font-size: 14px; font-weight: 900; margin: 30px 0 15px 0;
    letter-spacing: 2px; text-transform: uppercase; border-bottom: 1px solid rgba(46, 204, 113, 0.3);
    padding-bottom: 8px; text-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

/* --- BADGE STATISTIK (POPUP) --- */
.item-stats-box { display: flex; justify-content: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; background: rgba(0, 0, 0, 0.5); padding: 12px; border-radius: 8px; border: 1px solid #30363d; box-shadow: inset 0 0 10px rgba(0,0,0,0.8);}
.stat-badge { font-weight: 900; font-size: 11px; padding: 4px 8px; border-radius: 4px; background: #161b22; border: 1px solid #30363d; letter-spacing: 0.5px;}
.stat-badge.atk { color: #ff4444; border-color: rgba(255,68,68,0.3); background: rgba(255,68,68,0.1); } 
.stat-badge.hp { color: #2ecc71; border-color: rgba(46,204,113,0.3); background: rgba(46,204,113,0.1); } 
.stat-badge.def { color: #3498db; border-color: rgba(52,152,219,0.3); background: rgba(52,152,219,0.1); } 
.stat-badge.speed { color: #ffca28; border-color: rgba(255,202,40,0.3); background: rgba(255,202,40,0.1); } 
.stat-badge.crit { color: #9b59b6; border-color: rgba(155,89,182,0.3); background: rgba(155,89,182,0.1); }

/* --- PABRIK (FACTORY) --- */
#crafting-area {
    margin-top: 25px; padding: 20px; background: rgba(22, 27, 34, 0.6); 
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--panel-border); border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}
.craft-header { margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dashed #30363d; padding-bottom: 10px;}
.craft-title { color: var(--emerald); font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: 2px; text-shadow: 0 0 10px rgba(46, 204, 113, 0.4);}
.craft-cost { font-size: 10px; color: #8b949e; text-transform: uppercase; font-weight: bold; background: #0d1117; padding: 4px 8px; border-radius: 4px; border: 1px solid #30363d;}
.craft-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.btn-craft { 
    padding: 12px; background: rgba(13, 17, 23, 0.8); border: 1px solid var(--emerald); 
    color: var(--text-main); font-size: 11px; border-radius: 8px; font-weight: 900; 
    cursor: pointer; transition: 0.2s; text-transform: uppercase; letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.btn-craft:hover { background: rgba(46, 204, 113, 0.15); box-shadow: 0 0 15px rgba(46, 204, 113, 0.3); transform: translateY(-2px);}
.btn-craft:active { background: var(--emerald); color: #000; transform: scale(0.95); }
.btn-craft.small { flex: 1 1 30%; } .btn-craft.large { flex: 1 1 45%; }

/* Warna angka jumlah tetap putih */
.mat-count {
    color: #ffffff !important;
    font-weight: 900;
    font-family: 'Share Tech Mono', monospace;
    margin-left: 4px;
}

/* Style khusus untuk ORE (Abu-abu) */
.ore-style .mat-label {
    color: #a3aab1; /* Abu-abu metalik */
    font-weight: bold;
}
.ore-style {
    border-color: rgba(163, 170, 177, 0.3) !important;
}

/* Style khusus untuk ENERGY (Ungu) */
.energy-style .mat-label {
    color: #9b59b6; /* Ungu Dark Energy */
    font-weight: bold;
    text-shadow: 0 0 8px rgba(155, 89, 182, 0.5);
}
.energy-style {
    border-color: rgba(155, 89, 182, 0.4) !important;
    box-shadow: inset 0 0 10px rgba(155, 89, 182, 0.1);
}

/* Merapikan label di dalam tombol material */
.mat-label {
    font-size: 11px;
    letter-spacing: 1px;
}
