/**
 * UNDFND Responsive Table Styles
 * Cohérent avec le style desktop du thème
 * Breakpoint: 768px (tablet)
 */

/* Wrapper */
.undfnd-responsive-table-wrapper {
    width: 100%;
}

/* Desktop: show table, hide cards */
.undfnd-responsive-table-desktop {
    display: block;
}

.undfnd-responsive-table-mobile {
    display: none;
}

/* Mobile: hide table, show cards */
@media screen and (max-width: 767px) {
    .undfnd-responsive-table-desktop {
        display: none;
    }

    .undfnd-responsive-table-mobile {
        display: block;
        margin: 30px 0;
    }
}

/* ========================================
   Cards container
   ======================================== */
.undfnd-table-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ========================================
   Single card - style cohérent avec table desktop
   ======================================== */
.undfnd-table-card {
    border: 1px solid #000;
    overflow: hidden;
}

.undfnd-table-card--footer {
    background-color: #f0f0f0;
}

/* ========================================
   Card header - comme le th desktop
   ======================================== */
.undfnd-table-card__header {
    background-color: color-mix(in srgb, var(--wp--preset--color--mist, #DCE0E4) 60%, transparent);
    padding: 8px;
    border-bottom: 1px solid #000;
}

.undfnd-table-card__title {
    font-weight: 600;
    display: block;
}

/* ========================================
   Card body
   ======================================== */
.undfnd-table-card__body {
    display: flex;
    flex-direction: column;
}

/* ========================================
   Card row - comme les td desktop
   ======================================== */
.undfnd-table-card__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 8px;
    border-bottom: 1px solid #000;
}

.undfnd-table-card__row:last-child {
    border-bottom: none;
}

/* Label - comme le th */
.undfnd-table-card__label {
    font-weight: 600;
    flex-shrink: 0;
    min-width: 40%;
    color: inherit;
}

/* Value - comme le td */
.undfnd-table-card__value {
    text-align: right;
    flex-grow: 1;
}

/* ========================================
   Inline formatting - preserve bold, italic, underline, links
   ======================================== */
.undfnd-table-card__value strong,
.undfnd-table-card__value b,
.undfnd-table-card__title strong,
.undfnd-table-card__title b,
.undfnd-table-card__label strong,
.undfnd-table-card__label b {
    font-weight: 700;
}

.undfnd-table-card__value em,
.undfnd-table-card__value i,
.undfnd-table-card__title em,
.undfnd-table-card__title i,
.undfnd-table-card__label em,
.undfnd-table-card__label i {
    font-style: italic;
}

.undfnd-table-card__value u,
.undfnd-table-card__title u,
.undfnd-table-card__label u {
    text-decoration: underline;
}

.undfnd-table-card__value a,
.undfnd-table-card__title a,
.undfnd-table-card__label a {
    color: var(--wp--preset--color--tide, #0066cc);
    text-decoration: underline;
}

.undfnd-table-card__value a:hover,
.undfnd-table-card__title a:hover,
.undfnd-table-card__label a:hover {
    text-decoration: none;
}

/* ========================================
   Style stripes - cohérent avec is-style-stripes
   ======================================== */
.is-style-stripes + .undfnd-responsive-table-mobile .undfnd-table-card__row:nth-child(odd),
.undfnd-responsive-table-wrapper:has(.is-style-stripes) .undfnd-table-card__row:nth-child(odd) {
    background-color: #f0f0f0;
}

/* ========================================
   MODE COLONNES - Chaque colonne = un bloc
   ======================================== */

.undfnd-table-columns {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.undfnd-table-column {
    border: 1px solid #000;
    overflow: hidden;
}

.undfnd-table-column--footer {
    background-color: #f0f0f0;
}

/* Column header - comme le th desktop */
.undfnd-table-column__header {
    background-color: color-mix(in srgb, var(--wp--preset--color--mist, #DCE0E4) 60%, transparent);
    padding: 8px;
    border-bottom: 1px solid #000;
}

.undfnd-table-column__title {
    font-weight: 600;
    display: block;
}

/* Column body */
.undfnd-table-column__body {
    display: flex;
    flex-direction: column;
}

/* Column row - comme les td desktop */
.undfnd-table-column__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 8px;
    border-bottom: 1px solid #000;
}

.undfnd-table-column__row:last-child {
    border-bottom: none;
}

/* Label - identifiant de ligne (1ère colonne) */
.undfnd-table-column__label {
    font-weight: 600;
    flex-shrink: 0;
}

.undfnd-table-column__value {
    text-align: right;
    flex-grow: 1;
}

/* Inline formatting - preserve bold, italic, underline, links */
.undfnd-table-column__value strong,
.undfnd-table-column__value b,
.undfnd-table-column__title strong,
.undfnd-table-column__title b,
.undfnd-table-column__label strong,
.undfnd-table-column__label b {
    font-weight: 700;
}

.undfnd-table-column__value em,
.undfnd-table-column__value i,
.undfnd-table-column__title em,
.undfnd-table-column__title i,
.undfnd-table-column__label em,
.undfnd-table-column__label i {
    font-style: italic;
}

.undfnd-table-column__value u,
.undfnd-table-column__title u,
.undfnd-table-column__label u {
    text-decoration: underline;
}

.undfnd-table-column__value a,
.undfnd-table-column__title a,
.undfnd-table-column__label a {
    color: var(--wp--preset--color--tide, #0066cc);
    text-decoration: underline;
}

.undfnd-table-column__value a:hover,
.undfnd-table-column__title a:hover,
.undfnd-table-column__label a:hover {
    text-decoration: none;
}

/* Stripes for column mode */
.undfnd-responsive-table-wrapper:has(.is-style-stripes) .undfnd-table-column__row:nth-child(odd) {
    background-color: #f0f0f0;
}
