/*
 * Бонусная карта в профиле — стилизация под банковскую карту.
 * Три варианта: обычная (зелёная), VIP (тёмная с золотом), сотрудник (скидка).
 * Флип на обратную сторону с историей операций.
 */

.metro-card-wrap {
    perspective: 1200px;
    -webkit-tap-highlight-color: transparent;
}

.metro-card {
    position: relative;
    width: 100%;
    aspect-ratio: 1.586;
    min-height: 205px;
    cursor: pointer;
    user-select: none;
    transform-style: preserve-3d;
    will-change: transform;
}

.metro-card__inner {
    position: absolute;
    inset: 0;
    transition: transform .6s cubic-bezier(.35, .1, .3, 1);
    transform-style: preserve-3d;
}

.metro-card.is-flipped .metro-card__inner {
    transform: rotateY(180deg);
}

.metro-card__side {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
    color: #fff;
    background: linear-gradient(135deg, #458f03, #6abd1d);
}

.metro-card__back {
    transform: rotateY(180deg);
}

/* Блик, как на пластике */
.metro-card__side::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 120% 90% at 85% -20%, rgba(255, 255, 255, .22), transparent 55%);
    pointer-events: none;
}

/* Тонкий «гильош» — дуги как на настоящих картах */
.metro-card__side::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 110% 110%, transparent 54%, rgba(255, 255, 255, .05) 55%, transparent 56%),
        radial-gradient(circle at 108% 112%, transparent 63%, rgba(255, 255, 255, .05) 64%, transparent 65%),
        radial-gradient(circle at 112% 108%, transparent 72%, rgba(255, 255, 255, .05) 73%, transparent 74%);
    pointer-events: none;
}

.metro-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.metro-card__brand {
    font-size: .85em;
    font-weight: bold;
    letter-spacing: .18em;
    opacity: .95;
}

.metro-card__paywave {
    opacity: .75;
    flex-shrink: 0;
}

.metro-card__mid {
    display: flex;
    align-items: center;
    gap: 16px;
}

.metro-card__chip {
    width: 42px;
    height: 31px;
    flex-shrink: 0;
    border-radius: 6px;
    background: linear-gradient(135deg, #f5d67b, #d9a94b 60%, #f0c964);
    border: 1px solid rgba(120, 80, 10, .55);
    position: relative;
}

.metro-card__chip::before {
    content: '';
    position: absolute;
    left: 8px;
    right: 8px;
    top: 6px;
    bottom: 6px;
    border: 1px solid rgba(120, 80, 10, .45);
    border-radius: 3px;
}

.metro-card__chip::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 14px;
    border-top: 1px solid rgba(120, 80, 10, .45);
}

.metro-card__label {
    font-size: .78em;
    opacity: .85;
}

.metro-card__balance {
    font-size: 1.9em;
    font-weight: bold;
    line-height: 1.1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.metro-card__number {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 1.05em;
    letter-spacing: .22em;
    opacity: .9;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .25);
    white-space: nowrap;
}

.metro-card__bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    font-size: .8em;
}

.metro-card__holder {
    letter-spacing: .14em;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metro-card__since {
    opacity: .75;
    flex-shrink: 0;
}

.metro-card__hint {
    font-size: .72em;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .65;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ----- обратная сторона ----- */

.metro-card__magstripe {
    margin: 0 -20px;
    height: 36px;
    background: rgba(0, 0, 0, .55);
    flex-shrink: 0;
}

.metro-card__backhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .78em;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .85;
    margin: 8px 0 4px;
}

/* Список таскается пальцем/указателем (см. JS в profile.php):
   нативный тач-скролл внутри 3D-перевёрнутой карты не работает,
   а системная полоса прокрутки на пластике смотрится чужеродно */
.metro-card__history {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: rgba(0, 0, 0, .18);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: .82em;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    overscroll-behavior: contain;
    /* растворение краёв — намёк, что список продолжается */
    -webkit-mask-image: linear-gradient(transparent, #000 10px, #000 calc(100% - 10px), transparent);
    mask-image: linear-gradient(transparent, #000 10px, #000 calc(100% - 10px), transparent);
}

.metro-card__history::-webkit-scrollbar {
    display: none;
}

.metro-card__history.is-dragging {
    cursor: grabbing;
}

.metro-card__trx {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.metro-card__trx:last-child {
    border-bottom: none;
}

.metro-card__trx-sum {
    font-weight: bold;
    white-space: nowrap;
}

.metro-card__trx-sum--credit {
    color: #d4ffbc;
}

.metro-card__trx-sum--debit {
    color: #ffdede;
}

.metro-card__empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: .7;
    font-size: .85em;
}

/* ----- VIP ----- */

.metro-card--vip .metro-card__side {
    background: linear-gradient(135deg, #1e1e22, #34343c);
    border: 1px solid rgba(212, 175, 106, .4);
    color: #ece9e4;
}

.metro-card--vip .metro-card__side::after {
    background: radial-gradient(ellipse 120% 90% at 85% -20%, rgba(255, 255, 255, .12), transparent 55%);
}

.metro-card--vip .metro-card__brand,
.metro-card--vip .metro-card__number {
    color: #d4af6a;
}

.metro-card--vip .metro-card__balance {
    color: #fff;
}

.metro-card--vip .metro-card__history {
    background: rgba(255, 255, 255, .07);
}

.metro-card__vipbadge {
    font-size: .68em;
    font-weight: bold;
    letter-spacing: .22em;
    color: #d4af6a;
    border: 1px solid rgba(212, 175, 106, .8);
    border-radius: 5px;
    padding: 2px 8px 2px 10px;
    flex-shrink: 0;
}

/* ----- карта сотрудника ----- */

.metro-card--staff {
    cursor: default;
}

.metro-card__discount {
    font-size: 2.1em;
    font-weight: bold;
    line-height: 1.1;
}

/* ----- список заказов плитками ----- */

.order-tiles__caption {
    font-size: .78em;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #a9a49b;
    margin: 0 2px 8px;
    text-align: left;
}

.order-tile {
    position: relative;
    background: #fff;
    border: 1px solid #eceae5;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(60, 50, 30, .06);
    padding: 12px 14px;
    margin-bottom: 10px;
    text-align: left;
}

.order-tile__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.order-tile__title {
    font-weight: bold;
    color: #333;
    text-decoration: none;
    margin-right: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-tile__title:hover {
    color: #333;
    text-decoration: none;
}

/* вся плитка кликабельна (кнопка повтора — выше по z-index) */
.order-tile__title::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
}

.order-tile__status {
    flex-shrink: 0;
    font-size: .78em;
    padding: 3px 10px;
    border-radius: 20px;
    background: #eef5e4;
    color: #458f03;
    white-space: nowrap;
}

.order-tile--done .order-tile__status {
    background: #f2f1ee;
    color: #999;
}

.order-tile--done .order-tile__title {
    color: #8b8b8b;
}

.order-tile__addr {
    font-size: .85em;
    color: #777;
    margin-top: 2px;
    margin-right: 44px;
}

.order-tile__items {
    font-size: .85em;
    color: #a5a09b;
    line-height: 1.3;
    margin-top: 6px;
    margin-right: 44px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.order-tile .repeat-order {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 2;
    width: 32px;
    height: 32px;
}

.order-tile--empty {
    color: #777;
    text-align: center;
    padding: 18px 14px;
}

/* ----- кнопка «Повторить заказ» ----- */

.repeat-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: #f0ede5;
    color: #458f03;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.repeat-order:hover {
    background: #458f03;
    color: #fff;
}

.repeat-order.loading {
    pointer-events: none;
    opacity: .6;
}

/* крупный вариант для страницы трекинга (в списке профиля — круглая иконка) */
.repeat-order--btn {
    display: flex;
    width: 100%;
    height: 2.5em;
    border-radius: 12px;
    background: #458f03;
    color: #fff;
    font-size: 1em;
    user-select: none;
}

.repeat-order--btn svg {
    margin-right: 8px;
}

.repeat-order--btn:hover {
    background: #387503;
    color: #fff;
}

.repeat-order.loading svg {
    animation: repeat-spin .8s linear infinite;
}

@keyframes repeat-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ----- прогресс до VIP ----- */

.vip-progress {
    margin-top: 12px;
}

.vip-progress__text {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: .8em;
    color: #666;
    margin-bottom: 4px;
}

.vip-progress__bar {
    height: 7px;
    background: #e9e7e2;
    border-radius: 4px;
    overflow: hidden;
}

.vip-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, #458f03, #6abd1d);
    border-radius: 4px;
    transition: width .8s ease;
}
