/* ============================================================
   deckbuilder.css
   ============================================================ */

/* Overlays fullscreen */
#db-overlay,
#db-overlay-mesdecks {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #0d0b08;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  overflow: hidden;
}

#db-overlay.db-overlay-visible,
#db-overlay-mesdecks.db-overlay-visible {
  opacity: 1;
  pointer-events: all;
}

/* Topbar */
.db-topbar {
  height: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: rgba(0, 0, 0, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.db-topbar-title {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #e8dcc8;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.db-topbar-close {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.6);
  padding: 0.35rem 0.9rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
}

.db-topbar-close:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: #e8dcc8;
}

/* Layout gauche + droite */
.db-body {
  display: flex;
  flex-direction: row;
  flex: 1;
  height: calc(100vh - 48px);
  overflow: hidden;
}

.db-col-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.db-col-right {
  width: 340px;
  min-width: 340px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

/* Filtres */
#db-filters {
  padding: 0.65rem 1.25rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.db-filter-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.db-search {
  flex: 1;
  min-width: 160px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #e8dcc8;
  padding: 0.4rem 0.75rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.db-search:focus {
  border-color: #b5903a;
}

.db-search::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.db-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #e8dcc8;
  padding: 0.4rem 0.55rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.db-select:focus {
  border-color: #b5903a;
}

.db-instinct-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.db-instinct-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.5);
  padding: 0.22rem 0.65rem;
  font-size: 0.76rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.db-instinct-tab:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #e8dcc8;
}

.db-instinct-tab.active {
  background: #b5903a;
  border-color: #b5903a;
  color: #1a1008;
  font-weight: 700;
}

/* Catalogue 5 colonnes */
#db-catalogue {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.25rem 2rem;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 420px;
  gap: 1rem;
  align-content: start;
}

#db-catalogue::-webkit-scrollbar {
  width: 6px;
}

#db-catalogue::-webkit-scrollbar-track {
  background: transparent;
}

#db-catalogue::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

/* Carte */
.db-card {
  width: 100%;
  height: 420px;
  background: #0f0d09;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  user-select: none;
  position: relative;
  box-sizing: border-box;
}

.db-card:hover:not(.db-card-disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--instinct-color, #555);
}

.db-card-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.db-card-selected {
  box-shadow: 0 0 0 2px var(--instinct-color, #b5903a);
}

/* Illustration 160px fixe */
.db-card-illustration {
  position: relative;
  width: 100%;
  height: 290px;
  min-height: 290px;
  max-height: 290px;
  overflow: hidden;
  background: #080604;
  flex-shrink: 0;
}

.db-card-illustration img {
  width: 100%;
  height: 290px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.db-card:hover:not(.db-card-disabled) .db-card-illustration img {
  transform: scale(1.05);
}

.db-card-illus-fallback {
  width: 100%;
  height: 290px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.db-card-illus-icon {
  font-size: 2rem;
  opacity: 0.22;
}

.db-card-illus-text {
  font-family: 'Inter', sans-serif;
  font-size: 0.63rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.2);
  text-align: center;
}

/* Badge compteur */
.db-card-count-badge {
  position: absolute;
  top: 7px;
  left: 7px;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid #b5903a;
  border-radius: 4px;
  color: #b5903a;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 1px 6px;
  z-index: 2;
}

/* Bouton retrait */
.db-card-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(231, 76, 60, 0.6);
  border-radius: 50%;
  color: #e74c3c;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 0.15s, transform 0.15s, background 0.15s;
}

.db-card-selected .db-card-remove-btn,
.db-card:hover .db-card-remove-btn {
  opacity: 1;
  transform: scale(1);
}

.db-card-remove-btn:hover {
  background: rgba(231, 76, 60, 0.3);
  border-color: #e74c3c;
}

/* Badge type */
.db-card-type-badge {
  position: absolute;
  bottom: 5px;
  left: 5px;
  z-index: 2;
}

.db-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.75);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.db-badge-weather {
  color: #6ec6c6;
}

/* Corps texte 130px fixe */
.db-card-body {
  width: 100%;
  height: 130px;
  min-height: 130px;
  max-height: 130px;
  padding: 0.25rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  border-top: 2px solid var(--instinct-color, #333);
  overflow: hidden;
  box-sizing: border-box;
}

.db-card-name {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  font-weight: 700;
  color: #e8dcc8;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.db-card-stats {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.db-stat {
  font-size: 0.62rem;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  padding: 0.04rem 0.22rem;
  border-radius: 3px;
}

.db-stat.atk {
  background: rgba(192, 57, 43, 0.2);
  color: #e74c3c;
}

.db-stat.hp {
  background: rgba(39, 174, 96, 0.2);
  color: #2ecc71;
}

.db-stat.cost {
  background: rgba(90, 70, 200, 0.2);
  color: #9b8fe8;
}

.db-card-ability {
  font-family: 'Inter', sans-serif;
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.db-empty {
  color: rgba(255, 255, 255, 0.32);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  padding: 3rem 0;
  grid-column: 1 / -1;
  text-align: center;
}

/* Panel Mon Deck */
#db-deck-panel {
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow: hidden;
  height: 100%;
  box-sizing: border-box;
}

.db-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.db-panel-title {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #e8dcc8;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.db-panel-count-total {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
  transition: color 0.2s;
}

.db-panel-count-total.complet {
  color: #2ecc71;
}

.db-panel-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.db-panel-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #b5903a, #e8c06a);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.db-panel-empty {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.25);
  text-align: center;
  padding: 1.5rem 0;
}

.db-panel-liste {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.db-panel-liste::-webkit-scrollbar {
  width: 3px;
}

.db-panel-liste::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

.db-panel-group {
  margin-bottom: 0.5rem;
}

.db-panel-group-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255, 255, 255, 0.3);
  margin: 0.35rem 0 0.2rem;
}

.db-panel-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.db-panel-count {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #b5903a;
  min-width: 22px;
}

.db-panel-name {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  color: #e8dcc8;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-panel-stats {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.3);
  white-space: nowrap;
}

.db-panel-remove {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.22);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.15rem;
  line-height: 1;
  transition: color 0.12s;
  flex-shrink: 0;
}

.db-panel-remove:hover {
  color: #e74c3c;
}

.db-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 0.75rem;
}

.db-btn-reset {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.42);
  padding: 0.45rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.13s;
}

.db-btn-reset:hover {
  border-color: #e74c3c;
  color: #e74c3c;
}

.db-btn-save {
  background: linear-gradient(135deg, #b5903a, #8a6c28);
  border: none;
  border-radius: 6px;
  color: #1a1008;
  padding: 0.6rem;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.13s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.db-btn-save:hover:not(.disabled) {
  background: linear-gradient(135deg, #d4a944, #a07a30);
}

.db-btn-save.disabled {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.28);
  cursor: not-allowed;
}

/* Overlay Mes Decks */
.db-mesdecks-body {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
}

.db-mesdecks-left {
  width: 320px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  gap: 0.6rem;
  overflow: hidden;
}

.db-mesdecks-title {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.38);
  flex-shrink: 0;
}

#db-mes-decks-liste {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

#db-mes-decks-liste::-webkit-scrollbar {
  width: 3px;
}

#db-mes-decks-liste::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

.db-saved-deck {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  transition: all 0.13s;
  flex-shrink: 0;
}

.db-saved-deck:hover,
.db-saved-deck.selected {
  background: rgba(181, 144, 58, 0.1);
  border-color: #b5903a;
}

.db-saved-deck-icons {
  font-size: 1rem;
  min-width: 26px;
}

.db-saved-deck-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.db-saved-deck-name {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #e8dcc8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-saved-deck-meta {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.3);
}

.db-saved-deck-actions {
  display: flex;
  gap: 0.2rem;
}

.db-saved-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0.18rem 0.22rem;
  border-radius: 4px;
  opacity: 0.4;
  transition: opacity 0.13s;
}

.db-saved-btn:hover {
  opacity: 1;
}

.db-new-deck-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.5);
  padding: 0.5rem 0.85rem;
  font-family: 'Cinzel', serif;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.db-new-deck-btn:hover {
  background: rgba(181, 144, 58, 0.08);
  border-color: #b5903a;
  color: #e8dcc8;
}

/* Preview deck */
#db-mes-decks-preview {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

#db-mes-decks-preview::-webkit-scrollbar {
  width: 4px;
}

#db-mes-decks-preview::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.db-preview-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.db-preview-icons {
  font-size: 1.6rem;
}

.db-preview-name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: #e8dcc8;
}

.db-preview-meta {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 0.15rem;
}

.db-preview-liste {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.db-preview-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.db-preview-actions .btn {
  flex: 1;
  text-align: center;
}

/* Boutons step 2 */
.deck-create-btn-group {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.deck-create-btn-v2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.62);
  padding: 0.6rem 1.25rem;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.17s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.deck-create-btn-v2:hover {
  background: rgba(181, 144, 58, 0.08);
  border-color: #b5903a;
  color: #e8dcc8;
}

.deck-create-btn-v2 .plus-icon {
  color: #b5903a;
}

.db-card-special {
  font-family: 'Inter', sans-serif;
  font-size: 0.58rem;
  color: rgba(181, 144, 58, 0.85);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  margin-top: 0.08rem;
  padding-top: 0.08rem;
  border-top: 1px solid rgba(181, 144, 58, 0.2);
}

.db-card-special-name {
  font-weight: 700;
  color: #b5903a;
}
