/* Plan de classeur — barre d'outils alignée sur les composants partagés */

.binder-toolbar {
    margin-bottom: var(--space-3);
}

.binder-toolbar__row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    min-width: 0;
}

.btb-label {
    flex-shrink: 0;
    font-family: var(--font-heading);
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: #e8c84a;
    border-left: 3px solid currentColor;
    padding-left: 0.45rem;
}

.binder-toolbar__shelf {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 40%;
}

.binder-toolbar__shelf .binder-shelf {
    margin-bottom: 0;
}

.binder-toolbar__shelf .binder-form-panel {
    margin-top: var(--space-2);
}

.binder-toolbar__row > .btb-page {
    margin-left: auto;
    flex-shrink: 0;
}

.binder-stage {
    display: grid;
    grid-template-columns: 17rem minmax(0, 1fr) 13.5rem;
    gap: var(--space-4);
    align-items: stretch;
}

.binder-rail {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
    min-height: 0;
    align-self: stretch;
    padding: var(--space-2);
    background: rgba(10, 9, 18, 0.55);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 0 0 1px rgba(255, 255, 255, 0.04);
}

.binder-rail--binders {
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    z-index: 5;
}

.binder-rail--pages {
    border-left: 3px solid #6ec8ff;
    z-index: 2;
}

.binder-rail__label {
    flex-shrink: 0;
    font-family: var(--font-heading);
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    padding-left: 0.15rem;
}

.binder-rail--pages .binder-rail__label {
    color: #6ec8ff;
}

.binder-rail__shelf {
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
}

.binder-rail .binder-shelf {
    margin-bottom: 0;
}

.binder-rail--pages .binder-page-index {
    flex: 1 1 auto;
    min-height: 0;
}

.binder-stage__page {
    min-width: 0;
}

.binder-page-index {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.28rem;
    overflow-y: auto;
    padding-right: 0.1rem;
    scrollbar-width: thin;
}

.binder-page-index__empty {
    grid-column: 1 / -1;
    margin: 0;
    font-family: var(--font-grimoire);
    font-size: var(--fs-2xs);
    font-style: italic;
    color: var(--text-muted);
}

.binder-page-index__btn {
    --cut: 4px;
    --cut-r: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    min-height: 2.35rem;
    padding: 0.28rem 0.15rem 0.22rem;
    border: 0;
    border-radius: 0;
    background-color: #101828;
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, transparent 48%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -2px 0 rgba(180, 190, 255, 0.18);
    color: var(--text-muted);
    cursor: pointer;
    clip-path: polygon(
        var(--cut) 0,
        calc(100% - var(--cut-r)) 0,
        100% var(--cut-r),
        100% 100%,
        0 100%,
        0 var(--cut)
    );
}

.binder-page-index__btn:hover {
    color: #e8f6ff;
    background-color: #142838;
}

.binder-page-index__n {
    font-family: var(--font-heading);
    font-size: var(--fs-2xs);
    font-weight: 700;
    line-height: 1;
}

.binder-page-index__meter {
    display: block;
    width: 70%;
    height: 0.28rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

.binder-page-index__fill {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: left center;
    background: rgba(180, 190, 255, 0.35);
}

.binder-page-index__btn--empty .binder-page-index__fill {
    background: transparent;
}

.binder-page-index__btn--partial .binder-page-index__fill {
    background: #e8c84a;
}

.binder-page-index__btn--full .binder-page-index__fill {
    background: #6ec8ff;
}

.binder-page-index__btn--full {
    color: #9ed8ff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -2px 0 rgba(94, 200, 255, 0.55);
}

.binder-page-index__btn.is-current {
    color: #e8f6ff;
    background-color: #1c4a68;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 -2px 0 rgba(94, 200, 255, 0.85);
}

.btb-page {
    --cut: 8px;
    --cut-r: 10px;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: 2.35rem;
    padding: 0.15rem 0.5rem 0.15rem var(--space-3);
    border: 0;
    border-radius: 0;
    background-color: #101828;
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, transparent 48%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -2px 0 rgba(94, 200, 255, 0.55);
    flex-shrink: 0;
    clip-path: polygon(
        var(--cut) 0,
        calc(100% - var(--cut-r)) 0,
        100% var(--cut-r),
        100% 100%,
        0 100%,
        0 var(--cut)
    );
}

.btb-page__label {
    font-family: var(--font-heading);
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: #6ec8ff;
    margin-right: var(--space-1);
}

.page-nav__btn {
    --cut: 4px;
    --cut-r: 6px;
    width: 1.8rem;
    height: 1.8rem;
    border: 0;
    border-radius: 0;
    background-color: #142838;
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, transparent 50%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -2px 0 rgba(94, 200, 255, 0.7);
    color: #9ed8ff;
    cursor: pointer;
    font-size: var(--fs-sm);
    line-height: 1;
    padding: 0;
    clip-path: polygon(
        var(--cut) 0,
        calc(100% - var(--cut-r)) 0,
        100% var(--cut-r),
        100% 100%,
        0 100%,
        0 var(--cut)
    );
}

.page-nav__btn:hover:not(:disabled) {
    color: #e8f6ff;
    background-color: #1c4a68;
}

.page-nav__btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

#page-input {
    width: 2.8rem;
    height: 1.75rem;
    text-align: center;
    padding: 0;
    border: none;
    background: transparent;
    color: #6ec8ff;
    font-family: var(--font-heading);
    font-size: var(--fs-sm);
    font-weight: 700;
}

#page-input:focus-visible {
    outline: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--focus-ring);
}

.page-nav__max {
    color: var(--text-muted);
    font-family: var(--font-grimoire);
    font-size: var(--fs-xs);
    font-style: italic;
    min-width: 2.2rem;
}

.binder-status {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: var(--space-2) var(--space-3);
    min-width: 0;
    flex: 1 1 auto;
    margin: 0;
    padding: 0;
    text-align: left;
}

.binder-status[hidden] {
    display: none !important;
}

.binder-status__name {
    flex-shrink: 0;
    font-family: var(--font-nav);
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    color: var(--status-name, var(--gold-light));
    line-height: 1.05;
    white-space: nowrap;
    text-shadow: 0 0 22px color-mix(in srgb, var(--status-name, var(--gold)) 45%, transparent);
}

.binder-status__tagline {
    flex-shrink: 1;
    min-width: 0;
    font-family: var(--font-grimoire);
    font-size: var(--fs-xl);
    font-style: italic;
    color: var(--text-muted);
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: none;
}

.binder-status__tag {
    font-style: italic;
    font-weight: 600;
}

.binder-status__tag-sep {
    margin: 0 0.28em;
    color: rgba(180, 190, 255, 0.45);
    font-style: normal;
}

.binder-status__tag--mythic { color: var(--rarity-mythic); }
.binder-status__tag--rare { color: var(--rarity-rare); }
.binder-status__tag--uncommon { color: var(--rarity-uncommon); }
.binder-status__tag--common { color: #d8dce8; }
.binder-status__tag--w { color: #f4efe4; }
.binder-status__tag--u { color: #5eb8ff; }
.binder-status__tag--b { color: #c4a0ff; }
.binder-status__tag--r { color: #ff6b4a; }
.binder-status__tag--g { color: #5dcc6a; }

.binder-status__stats {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
    margin: 0 0 0 auto;
    padding: 0;
    list-style: none;
    flex-shrink: 0;
}

.binder-status__stat {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-1);
    padding: 0 var(--space-3);
    position: relative;
    white-space: nowrap;
}

.binder-status__stat + .binder-status__stat::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 1px;
    background: linear-gradient(180deg, transparent, var(--border-strong), transparent);
}

.binder-status__k {
    font-family: var(--font-heading);
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--gold);
}

.binder-status__v {
    font-family: var(--font-heading);
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--text-card);
    line-height: 1.1;
}

.binder-status__stat--page .binder-status__k { color: #6ec8ff; }
.binder-status__stat--page .binder-status__v { color: #9ed8ff; }

.binder-status__stat--slots .binder-status__k { color: #e8c84a; }
.binder-status__stat--slots .binder-status__v { color: #f0d88a; }

.binder-status__stat--cards .binder-status__k { color: #c4a0ff; }
.binder-status__stat--cards .binder-status__v { color: #d8c0ff; }

.binder-status__of {
    font-size: var(--fs-2xs);
    font-weight: 600;
    color: var(--text-muted);
}

.binder-grid {
    display: grid;
    grid-template-columns: repeat(var(--binder-cols, 3), 1fr);
    gap: var(--space-3);
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

.binder-grid--4 {
    max-width: 480px;
}

.binder-grid--9 {
    max-width: 720px;
}

.binder-grid--12,
.binder-grid--16 {
    max-width: 960px;
}

.binder-slot {
    position: relative;
    aspect-ratio: 488 / 680;
    background: var(--surface);
    border: none;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    box-shadow:
        0 0 0 1.5px var(--border),
        0 6px 18px rgba(0, 0, 0, 0.45);
    transition: box-shadow var(--t-mid) ease, transform var(--t-mid) ease;
}

.binder-slot:hover {
    transform: translateY(-3px);
    box-shadow:
        0 0 0 2px var(--border-strong),
        0 12px 28px rgba(0, 0, 0, 0.55);
}

.binder-slot--empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0.72;
    box-shadow:
        0 0 0 1.5px rgba(255, 255, 255, 0.14),
        0 4px 12px rgba(0, 0, 0, 0.35);
}

.binder-slot--empty:hover,
.binder-slot--empty:focus-visible {
    opacity: 1;
    box-shadow:
        0 0 0 2px var(--border-strong),
        0 10px 24px rgba(0, 0, 0, 0.5);
}

.binder-slot--empty .binder-slot__empty {
    color: var(--text-muted);
    font-family: var(--font-grimoire);
    font-size: var(--fs-xs);
    font-style: italic;
    font-weight: 500;
}

.binder-slot--empty:hover .binder-slot__empty,
.binder-slot--empty:focus-visible .binder-slot__empty {
    color: var(--gold-light);
}

.binder-slot__num {
    position: absolute;
    top: 0.35rem;
    left: 0.35rem;
    z-index: 2;
    background: var(--seal-gradient);
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--fs-2xs);
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.3rem;
    display: grid;
    place-items: center;
    border-radius: 45% 55% 50% 50% / 50% 45% 55% 50%;
    border: 1px solid rgba(255, 240, 200, 0.4);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.binder-slot__qty {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
}

.binder-slot__qty-btn,
.binder-slot__qty-val {
    margin: 0;
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 800;
    line-height: 1;
}

.binder-slot__qty-val {
    min-width: 1.7rem;
    min-height: 1.45rem;
    padding: 0.18rem 0.32rem;
    display: grid;
    place-items: center;
    border-radius: 0.5rem;
    font-size: var(--fs-sm);
    letter-spacing: 0.01em;
    color: rgba(255, 255, 255, 0.82);
    background: rgba(12, 8, 4, 0.72);
    border: 1px solid rgba(255, 240, 200, 0.28);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.binder-slot__qty-val--multi {
    min-width: 2.7rem;
    min-height: 2.45rem;
    padding: 0.28rem 0.45rem;
    border-radius: 0.7rem;
    font-size: var(--fs-2xl);
    color: var(--gold-ink);
    background: linear-gradient(180deg, #fff8d6, var(--gold-light) 40%, var(--gold));
    border: 2px solid rgba(255, 248, 220, 0.95);
    box-shadow:
        0 0 0 2px var(--gold-bright),
        0 0 14px rgba(232, 200, 74, 0.55),
        0 4px 12px rgba(0, 0, 0, 0.55);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.binder-slot__qty-val:hover {
    filter: brightness(1.08);
}

.binder-slot__qty-actions {
    display: inline-flex;
    overflow: hidden;
    border-radius: 999px;
    border: 1px solid rgba(255, 240, 200, 0.4);
    background: rgba(12, 8, 4, 0.82);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.binder-slot__qty-btn {
    width: 1.35rem;
    height: 1.2rem;
    padding: 0;
    background: transparent;
    color: #fff;
    font-size: 0.85rem;
}

.binder-slot__qty-btn:hover:not(:disabled) {
    background: rgba(232, 200, 74, 0.28);
}

.binder-slot__qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.binder-slot__empty {
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.binder-slot__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.binder-slot__info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-2);
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.binder-slot__name {
    font-family: var(--font-heading);
    font-size: var(--fs-2xs);
    font-weight: 700;
    line-height: var(--lh-tight);
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.binder-slot__meta {
    font-family: var(--font-grimoire);
    font-size: var(--fs-2xs);
    font-style: italic;
    color: rgba(255, 255, 255, 0.8);
}

.binder-overflow {
    margin-top: var(--space-5);
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.binder-overflow h2 {
    margin: 0 0 var(--space-2);
    font-size: var(--fs-md);
    font-family: var(--font-heading);
    color: var(--gold);
}

.binder-overflow ul {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

@media (max-width: 1100px) {
    .binder-stage {
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
    }

    .binder-rail {
        position: relative;
        top: auto;
        max-height: none;
        padding: var(--space-2) var(--space-3);
    }

    .binder-rail--binders {
        order: 1;
        padding: 0;
        background: transparent;
        box-shadow: none;
    }

    .binder-rail--pages {
        order: 2;
        border-left: 0;
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.06),
            inset 0 -2px 0 rgba(94, 200, 255, 0.45);
    }

    .binder-stage__page {
        order: 3;
    }

    .binder-page-index {
        grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr));
        max-height: 8.5rem;
    }
}

@media (max-width: 900px) {
    .binder-toolbar__row {
        flex-wrap: wrap;
    }

    .binder-toolbar__shelf {
        max-width: none;
        flex: 1 1 160px;
    }

    .binder-status {
        flex: 1 1 100%;
        border-left: none;
        padding-left: 0;
        order: 3;
    }

    .binder-toolbar__row > .btb-page {
        margin-left: 0;
        order: 4;
    }

    .binder-grid {
        gap: var(--space-2);
    }

    .binder-slot__qty-btn {
        width: 1.2rem;
        height: 1.1rem;
    }

    .binder-slot__qty-val {
        min-width: 1.55rem;
        min-height: 1.3rem;
        font-size: var(--fs-xs);
    }

    .binder-slot__qty-val--multi {
        min-width: 2.4rem;
        min-height: 2.2rem;
        font-size: var(--fs-xl);
    }
}
