/**
 * TXL Gen4 Design System - Cards
 * 
 * Composants de cartes flexibles
 */

/* ============================================
   CARD BASE
   ============================================ */

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: var(--color-surface);
    background-clip: border-box;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-body {
    flex: 1 1 auto;
    padding: var(--spacing-6);
}

.card-header {
    padding: var(--spacing-4) var(--spacing-6);
    background-color: var(--color-neutral-50);
    border-bottom: 1px solid var(--color-border);
    border-top-left-radius: calc(var(--radius-lg) - 1px);
    border-top-right-radius: calc(var(--radius-lg) - 1px);
}

.card-footer {
    padding: var(--spacing-4) var(--spacing-6);
    background-color: var(--color-neutral-50);
    border-top: 1px solid var(--color-border);
    border-bottom-left-radius: calc(var(--radius-lg) - 1px);
    border-bottom-right-radius: calc(var(--radius-lg) - 1px);
}

.card-title {
    margin-top: 0;
    margin-bottom: var(--spacing-3);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.card-subtitle {
    margin-top: calc(var(--spacing-3) * -0.5);
    margin-bottom: var(--spacing-3);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

.card-text {
    margin-bottom: var(--spacing-4);
}

.card-text:last-child {
    margin-bottom: 0;
}

/* ============================================
   CARD IMAGE
   ============================================ */

.card-img,
.card-img-top,
.card-img-bottom {
    width: 100%;
    height: auto;
}

.card-img,
.card-img-top {
    border-top-left-radius: calc(var(--radius-lg) - 1px);
    border-top-right-radius: calc(var(--radius-lg) - 1px);
}

.card-img,
.card-img-bottom {
    border-bottom-left-radius: calc(var(--radius-lg) - 1px);
    border-bottom-right-radius: calc(var(--radius-lg) - 1px);
}

.card-img-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    padding: var(--spacing-6);
    border-radius: calc(var(--radius-lg) - 1px);
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
    color: var(--color-neutral-0);
}

/* ============================================
   CARD VARIANTS
   ============================================ */

.card-bordered {
    border-width: 2px;
}

.card-hover {
    transition: all var(--transition-base);
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-flat {
    border: none;
    box-shadow: none;
}

.card-elevated {
    border: none;
    box-shadow: var(--shadow-md);
}

/* Color variants */
.card-primary {
    border-color: var(--color-primary-500);
}

.card-primary .card-header {
    background-color: var(--color-primary-500);
    color: var(--color-neutral-0);
    border-bottom-color: var(--color-primary-600);
}

.card-success {
    border-color: var(--color-success-500);
}

.card-success .card-header {
    background-color: var(--color-success-500);
    color: var(--color-neutral-0);
    border-bottom-color: var(--color-success-600);
}

.card-warning {
    border-color: var(--color-warning-500);
}

.card-warning .card-header {
    background-color: var(--color-warning-500);
    color: var(--color-neutral-900);
    border-bottom-color: var(--color-warning-600);
}

.card-error {
    border-color: var(--color-error-500);
}

.card-error .card-header {
    background-color: var(--color-error-500);
    color: var(--color-neutral-0);
    border-bottom-color: var(--color-error-600);
}

/* ============================================
   CARD HORIZONTAL
   ============================================ */

.card-horizontal {
    flex-direction: row;
}

.card-horizontal .card-img {
    width: auto;
    max-width: 40%;
    border-top-right-radius: 0;
    border-bottom-left-radius: calc(var(--radius-lg) - 1px);
}

.card-horizontal .card-body {
    flex: 1;
}

/* ============================================
   CARD GROUP & DECK
   ============================================ */

.card-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
}

@media (min-width: 768px) {
    .card-group {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .card-group > .card {
        flex: 1 0 0%;
    }
    
    .card-group > .card:not(:last-child) {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
        border-right: 0;
    }
    
    .card-group > .card:not(:first-child) {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }
}

.card-deck {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-6);
}

/* ============================================
   CARD COLUMNS (Masonry)
   ============================================ */

.card-columns {
    column-count: 1;
    column-gap: var(--spacing-6);
}

@media (min-width: 768px) {
    .card-columns {
        column-count: 2;
    }
}

@media (min-width: 1024px) {
    .card-columns {
        column-count: 3;
    }
}

.card-columns .card {
    display: inline-block;
    width: 100%;
    margin-bottom: var(--spacing-6);
}

/* ============================================
   CARD LIST GROUP
   ============================================ */

.card-list-group {
    margin-bottom: 0;
    padding-left: 0;
    list-style: none;
}

.card-list-group-item {
    position: relative;
    display: block;
    padding: var(--spacing-3) var(--spacing-6);
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.card-list-group-item:first-child {
    border-top: 0;
}

.card-list-group-item:hover {
    background-color: var(--color-surface-hover);
}

.card-list-group-item-action {
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

/* ============================================
   CARD BADGE
   ============================================ */

.card-badge {
    position: absolute;
    top: var(--spacing-4);
    right: var(--spacing-4);
    z-index: 1;
}

/* ============================================
   PRODUCT CARD (Special)
   ============================================ */

.card-product {
    position: relative;
    overflow: hidden;
}

.card-product-image {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background-color: var(--color-neutral-100);
}

.card-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.card-product:hover .card-product-image img {
    transform: scale(1.05);
}

.card-product-badge {
    position: absolute;
    top: var(--spacing-3);
    right: var(--spacing-3);
    z-index: 1;
}

.card-product-body {
    padding: var(--spacing-4);
}

.card-product-category {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wider);
}

.card-product-title {
    margin: var(--spacing-2) 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
}

.card-product-description {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-4);
}

.card-product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-4);
    border-top: 1px solid var(--color-border);
}

.card-product-price {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary-600);
}

.card-product-price-old {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    text-decoration: line-through;
    margin-right: var(--spacing-2);
}

/* ============================================
   STAT CARD
   ============================================ */

.card-stat {
    text-align: center;
}

.card-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: var(--spacing-4);
    background-color: var(--color-primary-100);
    border-radius: var(--radius-full);
    color: var(--color-primary-600);
}

.card-stat-value {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-2);
}

.card-stat-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wider);
}

.card-stat-change {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    margin-top: var(--spacing-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.card-stat-change.positive {
    color: var(--color-success-600);
}

.card-stat-change.negative {
    color: var(--color-error-600);
}
