html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #141922 0%, #12171e 100%);
    font-family: Arial, sans-serif;
    color: #e5e7eb;
    overflow: hidden;
}

/* Layout principal */
.layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    grid-template-rows: 60px 1fr;
    width: 100%;
    height: 100%;
}

.topbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #2a2f3a;
}

.topbar h1 {
    margin: 0;
    font-size: 20px;
}

.sidebar-left {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.sidebar-search{
    padding: 10px 12px 10px;
    border-bottom: 1px solid #2a2f3a;
    border-right: 1px solid #2a2f3a;
}

.search-input{
  width: 100%;
  height: 34px;

  background: #0f1621;
  color: #e5e7eb;

  border: 1px solid #2a3242;
  border-radius: 10px;

  padding: 0 12px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.search-input::placeholder{
  color: #9aa4b2;
}

.search-input:focus{
  border-color: #3a455a;
  background: #141c28;
}

.sidebar-categorie {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px 20px 20px;
    box-sizing: border-box;
    border-right: 1px solid #2a2f3a;

    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-footer {
    height: 45px;
    border-top: 1px solid #2a2f3a;
    border-right: 1px solid #2a2f3a;
    display: flex;
    align-items: center;
    padding-left: 15%;
    padding-right: 15%;
    font-size: 14px;
    color: #9ca3af;
    background: #11151b;
}

#btn-show-all{
  width: 100%;
  height: 40px;

  background: #0f1621;
  color: #e5e7eb;

  border: 1px solid #2a3242;
  border-radius: 12px;

  font-size: 14px;
  font-weight: 500;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  transition: all 0.15s ease;
}

/* hover doux comme sur ton screen */
#btn-show-all:hover{
  background: #141c28;
  border-color: #3a455a;
}

/* effet clic */
#btn-show-all:active{
  transform: translateY(1px);
}

.category-btn {
    width: 100%;
    background: #1a1f27;
    border: none;
    padding: 12px;
    margin-bottom: 6px;
    color: #e5e7eb;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
}

.category-btn:hover {
    background: #242a33;
}

.sub-categories {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-bottom: 10px;
}

.sub-categories.active {
    max-height: 500px;
}

.sub-btn {
    width: 100%;
    background: #222831;
    border: none;
    padding: 10px 20px;
    margin-top: 4px;
    color: #cbd5e1;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
}

.sub-btn:hover {
    background: #2d3642;
}

.empty {
    color: #6b7280;
    font-style: italic;
    padding: 6px 10px;
}

/* Zone principale structurée */
.main {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px 20px 20px;
    box-sizing: border-box;

    scrollbar-width: none;
    -ms-overflow-style: none;
}

.main-content::-webkit-scrollbar {
    display: none;
}

.main-footer {
    height: 45px;
    border-top: 1px solid #2a2f3a;
    display: flex;
    align-items: center;
    padding-left: 15px;
    font-size: 14px;
    color: #9ca3af;
    background: #11151b;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.item-card {
    background: #1a1f27;
    border: 1px solid #2a2f3a;
    border-radius: 6px;
    padding: 14px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.item-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    background: #202632;
}

.item-label {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
}

.item-image {
    position: relative;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-image.no-icon::before {
    opacity: 0.6;
}

.item-icon {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    position: relative;
    z-index: 2;
}

.item-prices {
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    background: #11151b;
    padding: 6px 8px;
    border-radius: 4px;
}

.buy {
    color: #22c55e;
    font-weight: bold;
}

.sell {
    color: #ef4444;
    font-weight: bold;
}

/* Message vide */
.empty-items {
    text-align: center;
    color: #6b7280;
    padding: 40px 0;
}

/* ===== BACKDROP ===== */
#trade-modal.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
}

#trade-modal.modal-backdrop.open {
    display: flex;
}

/* ===== FENÊTRE ===== */
#trade-modal .modal {
    width: 100%;
    max-width: 520px;          /* 🔥 taille max */
    margin: 0 auto;

    background: #11151b;
    border: 1px solid #2a2f3a;
    border-radius: 12px;
    padding: 18px;
    position: relative;

    box-shadow: 0 20px 60px rgba(0,0,0,0.6);

    /* 🔥 espace latéral ~40% */
    transform: scale(0.95);
}

/* 🔥 version encore plus compacte sur petits écrans */
@media (max-width: 900px) {
    #trade-modal .modal {
        max-width: 420px;
    }
}

#trade-modal,
#trade-modal * {
    box-sizing: border-box;
}

#trade-modal .modal {
    opacity: 0;
    transform: scale(0.9);
    transition: all .15s ease;
}

#trade-modal.open .modal {
    opacity: 1;
    transform: scale(1);
}

/* ===== MODAL BACKDROP ===== */
#trade-modal.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
}

#trade-modal.modal-backdrop.open {
    display: flex;
}

#trade-modal,
#trade-modal * {
    box-sizing: border-box;
}

/* ===== MODAL = "ITEM CARD" STYLE ===== */
.trade-card {
    width: 60%;
    max-width: 520px;
    min-width: 320px;

    background: #1a1f27;
    border: 1px solid #2a2f3a;
    border-radius: 10px;
    padding: 16px 16px 14px 16px;
    text-align: center;
    position: relative;

    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

/* Animation légère */
#trade-modal .trade-card {
    opacity: 0;
    transform: scale(0.92);
    transition: all 0.15s ease;
}
#trade-modal.open .trade-card {
    opacity: 1;
    transform: scale(1);
}

/* Close */
.trade-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 8px;

    border: 1px solid #2a2f3a;
    background: #11151b;
    color: #e5e7eb;
    cursor: pointer;
}
.trade-close:hover {
    background: #202632;
    border-color: #3b82f6;
}

/* Titre comme label */
.trade-title {
    font-weight: 800;
    font-size: 16px;
    margin: 4px 0 12px 0;
}

/* Image comme item-image */
.trade-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 90px;
    margin: 0 auto 12px auto;
    font-size: 44px;
}

/* Quantité */
.trade-qty {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    margin: 0 0 10px 0;
    padding: 10px;

    background: #11151b;
    border: 1px solid #2a2f3a;
    border-radius: 8px;
}

.trade-qty-label {
    color: #9ca3af;
    font-size: 13px;
}

.trade-qty-input {
    width: 120px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #2a2f3a;
    background: #0f141a;
    color: #e5e7eb;
    outline: none;
    text-align: right;
}
.trade-qty-input:focus {
    border-color: #3b82f6;
}

/* Prix : réutilise price-row */
.trade-prices {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

/* Actions */
.trade-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

.trade-btn {
    border: 1px solid #2a2f3a;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: #e5e7eb;
    background: #11151b;
}
.trade-btn:hover {
    background: #202632;
    border-color: #3b82f6;
}

.trade-btn.primary {
    border-color: #3b82f6;
    background: #1d2a44;
}
.trade-btn.primary:hover {
    background: #223052;
}

.trade-btn.primary.sell {
    border-color: #ef4444;
    background: #3a1d22;
}
.trade-btn.primary.sell:hover {
    background: #422126;
}

.trade-qty-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.trade-qty-btn {
    height: 36px;
    padding: 0 12px;
    border-radius: 6px;

    background: #11151b;
    border: 1px solid #2a2f3a;
    color: #9ca3af;

    cursor: pointer;
    font-weight: 800;
    font-size: 12px;

    transition: all 0.15s ease;
}

.trade-qty-btn:hover {
    color: #e5e7eb;
    border-color: #3b82f6;
}