/* Card Base */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-border-radius);
    overflow: hidden;
    text-align: center;
    margin-bottom: 0.5rem; /* 8px → 0.5rem */
    position: relative;
    box-shadow: var(--shadow-medium);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
    /* Improve transition smoothness */
    transition: var(--transition-smooth);
    transform-origin: center center;
    will-change: transform, box-shadow, border-color;
    backface-visibility: hidden;
}
a.card {
    text-decoration: none;
}

.card:hover {
    /* transform: translateY(-0.3125rem); */
    box-shadow: var(--shadow-medium-hover);
}
a.card:hover {
    text-decoration: none;
}

.card.liclass:not(.selected) {
    opacity: 0.8;
    transition: all 0.3s ease-in-out;
}

.card. .card.disabled {
    filter: grayscale(100%);
    opacity: 0.5;

    transition: all 0.3s ease-in-out;
    cursor: not-allowed;
}

.card.disabled {
    transition: all 0.3s ease-in-out;
    cursor: not-allowed;
}
.card.disabled * {
    filter: grayscale(100%);
    opacity: 0.8;
}

.card.disabled::before {
    content: "";
    position: absolute;
    inset: 0;
    aspect-ratio: 1;
    background-image: url(/images/app/stopped.png);
    filter: drop-shadow(2px 4px 6px black);
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 10;
}

/* Selected Card State */
.card.selected:not(.disabled) {
    /* border-color: var(--color-secondary-700); */
    box-shadow: 0 0 15px var(--color-primary-400);
    transform: translateZ(0) scale(1.01); /* Smaller scale with translateZ to force GPU acceleration */
    z-index: 1;
}

/* Selected Card State */
.card.selected:not(.disabled) {
    border-color: rgba(var(--color-secondary-700-rgb), 0.5);
    box-shadow: 0 0 0.9375rem rgba(var(--color-secondary-700-rgb), 0.5); /* 15px → 0.9375rem */
    transform: translateZ(0) scale(1.02);
    z-index: 1;
}

.card.selected:not(.disabled) .badge-price {
    background-color: var(--color-secondary-900);
    transform: scale(1.05);
}

/* Card Image Container */
.card .ratio,
.card .img-container {
    overflow: hidden;
    position: relative;
    aspect-ratio: 1/1;
}

.card .card-img-top,
.card .img-container img {
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Card Content */
.card .card-body {
    padding: 0.25rem !important;
}

.card .card-title-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.card .card-title,
a .card .card-title {
    font-size: var(--text-sm);
    color: var(--text-color) !important;
    margin: 0;
    display: -webkit-box;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.2;
    min-height: calc(1.2em * 2);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    text-wrap: wrap;
}

/* Price Badge */
.card .badge-price {
    position: absolute;
    top: 0.625rem; /* 10px → 0.625rem */
    right: 0.625rem; /* 10px → 0.625rem */
    background-color: var(--color-secondary-700);
    padding: 0.125rem 0.5rem; /* 2px 8px → 0.125rem 0.5rem */
    border-radius: 0.625rem; /* 10px → 0.625rem */
    font-size: var(--text-xs);
    color: var(--color-secondary-50);
    z-index: 10;
    transform-origin: top right;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

/* Responsive Styles */
@media (max-width: 576px) {
    .card .card-title,
    a .card .card-title {
        font-size: 0.625rem; /* 10px → 0.625rem */
        line-height: 1.1;
        -webkit-line-clamp: 2; /* Changed from 1 to 2 */
    }
    .card .card-img-top {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    .card .badge-price {
        font-size: 0.625rem; /* 10px → 0.625rem */
        padding: 0.125rem 0.25rem; /* 2px 4px → 0.125rem 0.25rem */
        position: static;
        border-radius: 0;
        width: 100%;
        height: 1.25rem; /* 20px → 1.25rem */
        transform: none;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 11;
    }

    /* Override the transform for selected cards' badge on mobile */
    .card.selected:not(.disabled) .badge-price {
        transform: none;
        width: 100%;
    }
}

/* example usage */
/* 
<div class="row px-1 justify-content-center">
    <a class="col-4 col-lg-3 col-xl-2 text-decoration-none" href="{{ route('autopayments.autobib') }}">
        <div class="card">
            <div class="ratio ratio-1x1">
                <img src="......" class="card-img-top" />
            </div>
            <div class="card-title-wrapper">
                <h5 class="card-title"> usdt </h5>
            </div>
        </div>
    </a>
</div> 
*/
