/* CSS plat partagé mtg-se : composants métier (raretés, mana, vignettes, autocomplete).
   Chargé après app.css (Tailwind). Toutes les couleurs passent par les variables --c-*. */

/* ---------- Raretés ---------- */
.mtg-rarity {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    color: white !important;
    background: rgb(var(--c-muted));
    line-height: 1.2;
    text-align: center;
    min-width: 70px;
}

.mtg-rarity[data-rarity="mythic"],
.mtg-rarity[data-rarity="m"] {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
}

.mtg-rarity[data-rarity="rare"],
.mtg-rarity[data-rarity="r"] {
    background: linear-gradient(135deg, #f39c12 0%, #d68910 100%) !important;
}

.mtg-rarity[data-rarity="uncommon"],
.mtg-rarity[data-rarity="u"] {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%) !important;
}

.mtg-rarity[data-rarity="common"],
.mtg-rarity[data-rarity="c"] {
    background: linear-gradient(135deg, #5d6d7e 0%, #4a5568 100%) !important;
    color: #d1d5db !important;
}

.mtg-rarity[data-rarity="special"],
.mtg-rarity[data-rarity="s"],
.mtg-rarity[data-rarity="bonus"],
.mtg-rarity[data-rarity="b"] {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%) !important;
}

.mtg-rarity[data-rarity="token"],
.mtg-rarity[data-rarity="t"] {
    background: linear-gradient(135deg, #7f8c8d 0%, #2c3e50 100%) !important;
}

.badge-foil {
    background: rgb(var(--c-accent) / 0.15);
    color: rgb(var(--c-accent));
}

/* ---------- Symboles de mana ---------- */
.mana-cost {
    display: inline-flex;
    gap: 2px;
    align-items: center;
    vertical-align: middle;
}

.ms-cost {
    font-size: 0.9em;
}

.ms-shadow {
    filter: drop-shadow(1px 1px 1px rgb(0 0 0 / 0.3));
}

.price {
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: rgb(var(--c-primary));
}

/* ---------- Vignettes de cartes ---------- */
.card-thumbnail-wrapper {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 56px;
    min-width: 40px;
    min-height: 56px;
    transition: transform 200ms ease, width 200ms ease;
    cursor: pointer;
    vertical-align: middle;
    /* Le zoom part du bord gauche : l'image s'étend vers la droite */
    transform-origin: left center;
}

.card-thumbnail-wrapper:hover {
    width: 80px;
    transform: scale(5);
    z-index: 1000;
}

.card-thumbnail,
.card-thumbnail-back {
    width: 40px;
    height: 56px;
    min-width: 40px;
    min-height: 56px;
    max-width: 40px;
    max-height: 56px;
    border-radius: 3px;
    object-fit: cover;
    background: rgb(var(--c-surface-2));
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    transition: none;
}

.card-thumbnail-back {
    left: 40px;
    display: none;
}

.card-thumbnail-wrapper.has-back-face:hover .card-thumbnail-back {
    display: block;
}

.card-thumbnail-wrapper:hover .card-thumbnail,
.card-thumbnail-wrapper:hover .card-thumbnail-back {
    box-shadow: 0 12px 32px rgb(0 0 0 / 0.6);
}

.card-thumbnail.hq-loading {
    filter: blur(2px);
}

.card-thumbnail.loading {
    opacity: 0.5;
}

/* ---------- Boutons de quantité ---------- */
.qty-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    background: rgb(var(--c-canvas));
    border: 1px solid rgb(var(--c-line));
    border-radius: 4px;
    color: rgb(var(--c-ink));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    border-color: rgb(var(--c-primary));
    color: rgb(var(--c-primary));
}

/* ---------- Autocomplete ---------- */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgb(var(--c-surface));
    border: 1px solid rgb(var(--c-line));
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
}

.autocomplete-results.active {
    display: block;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgb(var(--c-line));
    color: rgb(var(--c-ink));
    transition: background 150ms ease;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: rgb(var(--c-primary) / 0.15);
}

.autocomplete-item .card-name,
.autocomplete-item .card-info-main {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.autocomplete-item .card-name-translated,
.autocomplete-item .card-info-details,
.autocomplete-item .editions-count {
    font-size: 0.8rem;
    color: rgb(var(--c-muted));
}

.autocomplete-item .card-name-translated {
    font-style: italic;
}

.autocomplete-item .editions-count {
    font-size: 0.75rem;
}

.autocomplete-item .card-name-translated .lang-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-style: normal;
    font-weight: 700;
    text-transform: uppercase;
    background: rgb(var(--c-primary));
    color: white;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    margin-right: 0.3rem;
    vertical-align: middle;
}

.autocomplete-loading {
    padding: 1rem;
    text-align: center;
    color: rgb(var(--c-muted));
}
