/* ====== Tableau des factures – Front My Account / Order details ====== */

.swebetech-order-invoices {
    margin-top: 2rem;
}

.swebetech-order-invoices .shop_table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--wp--preset--color--fond-alternatif, #fff);
    border: 1px solid var(--wp--preset--color--gris, #ddd);
    border-radius: 12px;
    overflow: hidden;
}

.swebetech-order-invoices .shop_table thead th {
    background: var(--wp--preset--color--contrast-1, #f6f6f6);
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    font-size: var(--wp--preset--font-size--small);
}

.swebetech-order-invoices .shop_table tbody td {
    padding: 12px 16px;
    border-top: 1px solid var(--wp--preset--color--gris, #eee);
    vertical-align: middle;
}

.swebetech-order-invoices .filename {
    word-break: break-word;
}

/* Colonne actions : boutons compacts sans label (icônes uniquement) */
.swebetech-order-invoices .invoice-actions .button {
    margin-right: 8px;
    padding: 8px 10px;
    line-height: 1;
    min-width: 0;
    border-radius: 8px;
    background-color: var(--wp--preset--color--cta-principal-fond);
    color: var(--wp--preset--color--cta-principal-texte);
    border: 1px solid transparent;
}
.swebetech-order-invoices .invoice-actions .button:last-child {
    margin-right: 0;
}
.swebetech-order-invoices .invoice-actions .button:hover {
    filter: brightness(0.96);
}

/* Badges de statut */
.pending {
    background-color: var(--wp--preset--color--error-100);
    border-radius: 8px;
    padding: 4px 8px;
    color: var(--wp--preset--color--error-900);
    border: 1px solid var(--wp--preset--color--error-500);
    font-size: var(--wp--preset--font-size--small);
    font-weight: 400;
    width: fit-content;
}
.paid {
    background-color: var(--wp--preset--color--positive-100);
    font-size: var(--wp--preset--font-size--small);
    border-radius: 8px;
    padding: 4px 8px;
    color: var(--wp--preset--color--positive-900);
    border: 1px solid var(--wp--preset--color--positive-500);
    font-weight: 400;
    width: fit-content;
}

/* Icônes Font Awesome sur les boutons d'actions */
.woocommerce .woocommerce-MyAccount-content table.shop_table.my_account_orders_invoices .button::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: var(--wp--preset--font-size--small);
    width: auto;
    padding-right: 0px;
    text-align: center;
    display: inline-block;
    color: var(--wp--preset--color--cta-principal-texte);
    transition: color 0.3s ease;
}

/* Responsive (stack en mobile) */
@media (max-width: 600px) {
    .swebetech-order-invoices .shop_table thead {
        display: none;
    }
    .swebetech-order-invoices .shop_table tr {
        display: block;
        border-bottom: 1px solid var(--wp--preset--color--gris, #eee);
    }
    .swebetech-order-invoices .shop_table td {
        display: grid;
        grid-template-columns: 40% 60%;
        gap: 8px;
        border: 0;
        padding: 10px 14px;
    }
    .swebetech-order-invoices .shop_table td::before {
        content: attr(data-title);
        font-weight: 600;
        color: var(--wp--preset--color--contrast, #111);
    }
    .swebetech-order-invoices .invoice-actions .button {
        padding: 8px 10px;
    }
}


/* ====== Tableau WooCommerce – Détails de commande ====== */

.woocommerce-table.woocommerce-table--order-details.shop_table.order_details,
table.woocommerce-orders-table.woocommerce-MyAccount-orders {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background: var(--wp--preset--color--fond-alternatif, #fff);
    border: 1px solid var(--wp--preset--color--gris, #ddd);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 2rem;
}

/* En-têtes */
.woocommerce-table--order-details thead th,
table.woocommerce-orders-table.woocommerce-MyAccount-orders thead th {
    background: var(--wp--preset--color--contrast-1, #f6f6f6);
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    font-size: var(--wp--preset--font-size--medium);
    border-bottom: 2px solid var(--wp--preset--color--gris);
}
.woocommerce-table--order-details thead th.woocommerce-table__product-table,
table.woocommerce-orders-table.woocommerce-MyAccount-orders thead th {
    text-align: right;
}

/* Corps */
.woocommerce-table--order-details tbody td,
table.woocommerce-orders-table.woocommerce-MyAccount-orders tbody td {
    padding: 12px 16px;
    border-top: 1px solid var(--wp--preset--color--gris, #eee);
    vertical-align: middle;
    font-size: var(--wp--preset--font-size--medium);
    text-align: right;
}

/* Nom du produit */
.woocommerce-table--order-details .product-name a,
.woocommerce-table--order-details td.woocommerce-table__product-name,
table.woocommerce-orders-table.woocommerce-MyAccount-orders th a {
    font-weight: 500;
    color: var(--wp--preset--color--liens-hypertextes);
    text-decoration: none;
    text-align: left;
    transition: color 0.2s ease;
    width: 70%;
}
.woocommerce-table--order-details .product-name a:hover,
table.woocommerce-orders-table.woocommerce-MyAccount-orders th a:hover {
    color: var(--wp--preset--color--liens-hypertextes-hover);
}
.woocommerce-table--order-details .product-quantity {
    font-weight: 600;
    margin-left: 6px;
    color: var(--wp--preset--color--gris, #555);
}
.woocommerce-table--order-details td.woocommerce-table__product-total {
    text-align: right;
    width: 30%;
}

/* Totaux en pied */
.woocommerce-table--order-details tfoot {
    border-top: 2px solid var(--wp--preset--color--gris);
}
.woocommerce-table--order-details tfoot th,
.woocommerce-table--order-details tfoot td {
    padding: 12px 16px;
    border-top: 1px solid var(--wp--preset--color--gris, #eee);
    text-align: left;
    font-size: var(--wp--preset--font-size--small)!important;
}
.woocommerce-table--order-details tfoot th {
    font-weight: 600;
    width: 40%;
}
.woocommerce-table--order-details tfoot td {
    text-align: right;
}

/* Total final mis en valeur */
.woocommerce-table--order-details tfoot tr:last-of-type td,
.woocommerce-table--order-details tfoot tr:last-of-type th {
    font-weight: 700;
    font-size: var(--wp--preset--font-size--medium);
    border-top: 2px solid var(--wp--preset--color--contrast, #111);
}

/* Note du client */
.woocommerce-table--order-details tfoot tr th:contains("Note"),
.woocommerce-table--order-details tfoot tr td:has(textarea),
.woocommerce-table--order-details tfoot tr td:last-child {
    white-space: normal;
    word-break: break-word;
}

/* Responsive mobile */
@media (max-width: 600px) {
    .woocommerce-table--order-details thead {
        display: none;
    }
    .woocommerce-table--order-details tr {
        display: block;
        border-bottom: 1px solid var(--wp--preset--color--gris, #eee);
    }
    .woocommerce-table--order-details td,
    .woocommerce-table--order-details th {
        display: grid;
        grid-template-columns: 45% 55%;
        gap: 8px;
        border: 0;
        padding: 10px 14px;
    }
    .woocommerce-table--order-details td::before {
        content: attr(data-title);
        font-weight: 600;
        color: var(--wp--preset--color--contrast, #111);
    }
}
