/* Définition des couleurs (héritées) */
:root {
    --bg-dark: #121212;
    --bg-card: #1e1117;
    --bordeaux-dark: #4a0d1b;
    --bordeaux-main: #6b1426;
    --bordeaux-light: #942138;
    --bordeaux-bright: #b82d49;
    --orange-buy: #d97706; /* Couleur pour les achats */
    --text-main: #f5f5f5;
    --text-muted: #bfb0b5;
    --border-color: #521522;
    --font-family: Verdana, sans-serif;
}

.reserve-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 2%;
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Barre de contrôles globale */
.controls-bar {
    display: flex;
    flex-wrap: wrap; /* Permet d'adapter sur mobile si vraiment l'écran est trop petit */
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.8rem 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Zone de recherche (on limite sa largeur maximale pour ne pas qu'elle prenne toute la place) */
.search-group {
    display: flex;
    align-items: center;
    flex: 1 1 200px;
    max-width: 280px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
}

/* Groupes de boutons */
.filter-group,
.export-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#search-dmc {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-filter {
    background-color: var(--bg-dark);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-filter:hover { border-color: var(--bordeaux-light); color: var(--text-main); }
.btn-filter.active {
    background-color: var(--bordeaux-main);
    border-color: var(--bordeaux-bright);
    color: #ffffff;
}

.btn-filter.filter-buy.active {
    background-color: var(--orange-buy);
    border-color: #f59e0b;
}

/* Groupe des statistiques : poussé tout à droite sur la MÊME ligne */
.stats-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: right;
    margin-left: 1rem; /* Maintient un petit espace propre à droite du bouton Exporter Achats */
    white-space: nowrap; /* Empêche les retours à la ligne intempestifs */
}

.stats-highlight { color: #ffd700; font-size: 1rem; font-weight: bold; }
.text-orange { color: #fbbf24; }

/* Grille DMC */
.dmc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.dmc-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.dmc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(184, 45, 73, 0.15);
}

.dmc-card.owned { border-color: var(--bordeaux-light); }
.dmc-card.to-buy { border-color: var(--orange-buy); }

.dmc-swatch {
    height: 50px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    text-shadow: 0px 1px 3px rgba(0,0,0,0.5);
    position: relative; /* Pour positionner l'icône chariot */
}

.cart-indicator {
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 1.2rem;
    text-shadow: 0px 1px 2px rgba(0,0,0,0.8);
}

.dmc-info {
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.dmc-name {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    margin-bottom: 0.2rem;
}

/* Nouvelles rangées de quantités */
.qty-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-dark);
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.qty-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.btn-qty {
    background-color: #333;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-qty.stash-btn { background-color: var(--bordeaux-main); }
.btn-qty.stash-btn:hover { background-color: var(--bordeaux-bright); }

.btn-qty.buy-btn { background-color: var(--orange-buy); }
.btn-qty.buy-btn:hover { background-color: #f59e0b; }

.qty-value {
    color: var(--text-main);
    font-weight: bold;
    font-size: 0.95rem;
    min-width: 16px;
    text-align: center;
}

/* Styles pour les boutons d'export PDF */
.export-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-left: auto; /* Pousse ce groupe ET le groupe des stats vers la droite */
}

.btn-export {
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--bordeaux-main);
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    font-family: var(--font-family);
}

.btn-export:hover {
    background-color: var(--bordeaux-main);
    color: #fff;
}

.btn-export.buy-theme {
    border-color: var(--orange-buy);
}

.btn-export.buy-theme:hover {
    background-color: var(--orange-buy);
    color: #fff;
}

.modal-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:rgba(0,0,0,.58);backdrop-filter:blur(5px);display:flex;justify-content:center;align-items:center;z-index:2000;padding:1rem;box-sizing:border-box}
.modal-overlay.hidden{display:none}
.reserve-modal-box{
 max-width:460px;
 width: min(460px, 100%);
 text-align:left;
 background:linear-gradient(145deg,#28151d 0%,#1e1117 58%,#170d12 100%);
 border:1px solid var(--bordeaux-bright);
 border-radius:12px;
 padding:1.5rem;
 box-shadow:0 14px 45px rgba(0,0,0,.75),0 0 22px rgba(184,45,73,.16);
}
.reserve-modal-box h3{text-align:center;color:var(--text-main);margin:0 0 .7rem}
.reserve-modal-box>p{color:var(--text-muted);font-size:.9rem;line-height:1.45}
.modal-choice-list{display:flex;flex-direction:column;gap:.7rem;margin:1rem 0 1.3rem}
.modal-choice{display:flex;align-items:center;gap:.85rem;padding:.9rem 1rem;background:#121014;border:1px solid #44343b;border-radius:9px;cursor:pointer;transition:.2s}
.modal-choice:hover{border-color:var(--bordeaux-bright);background:#24151c}
.modal-choice:has(input:checked){border-color:var(--bordeaux-bright);background:rgba(107,20,38,.25);box-shadow:inset 3px 0 var(--bordeaux-bright)}
.modal-choice input{width:17px;height:17px;accent-color:var(--bordeaux-bright);flex-shrink:0}
.modal-choice>span:last-child{display:flex;flex-direction:column;gap:.2rem;color:var(--text-main)}
.modal-choice strong{font-size:.92rem}.modal-choice small{font-size:.76rem;color:var(--text-muted)}
.choice-icon{font-size:1.5rem;width:30px;text-align:center}
.reserve-modal-box .modal-actions{margin-top:1.2rem}
.reserve-modal-box .btn-clear,.reserve-modal-box .btn-secondary{border-radius:6px;padding:.65rem 1rem;cursor:pointer;font-weight:600}
.reserve-modal-box .btn-secondary{background:#2a2529;color:#fff;border:1px solid #443c42}
.reserve-modal-box .btn-clear{background:var(--bordeaux-main);color:#fff;border:1px solid var(--bordeaux-bright)}
.reserve-modal-box .btn-clear:hover{background:var(--bordeaux-bright)}
.import-summary{padding:.75rem 1rem;border:1px solid var(--bordeaux-bright);border-radius:8px;color:#ffd700;background:#121014;margin:.6rem 0}
.reserve-modal-box input[type=file]{display:block;width:100%;margin-top:.5rem;color:var(--text-muted)}
.reserve-modal-box #confirm-import-json{width:100%;margin:.5rem 0}
.cart-indicator,.stash-indicator{position:absolute;top:5px;font-size:1.15rem;filter:drop-shadow(0 1px 2px rgba(0,0,0,.85))}
.stash-indicator{left:8px;right:auto}.cart-indicator{right:8px;left:auto}
@media(max-width:650px){.reserve-modal-box{padding:1.1rem}.reserve-modal-box .modal-actions{flex-direction:column}}
