/**
 * WC Enhanced - My Account Layout
 * Endpoints:
 * - /my-account/orders/
 * - /my-account/view-order/{order_id}/
 * - /my-account/edit-address/
 * - /my-account/edit-account/
 *
 * Layout system: FLEX ONLY
 */

/* ==========================================================
   Base Wrapper
   ========================================================== */

.wce-myaccount .wce-myaccount__wrap {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    box-sizing: border-box;
}

/* Hide theme page title (e.g. "Orders") on WCE my-account endpoints */
.wce-myaccount h1.entry-title {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ==========================================================
   Header
   ========================================================== */

.wce-myaccount__header {
    margin-bottom: 32px;
    background: #F8F3ED;
    text-align: center;
    padding: 22px 16px;
    border-radius: 8px;
}

.wce-myaccount__title {
    margin: 0;
    font-family: "Fraunces", serif;
    font-size: 3em;
    font-weight: 700;
    line-height: 1.2;
}

/* ==========================================================
   Main Layout (Flex)
   ========================================================== */

.wce-myaccount__layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 40px;
}

/* ==========================================================
   Sidebar
   ========================================================== */

.wce-myaccount__sidebar {
    /* 30% of wrapper width */
    flex: 0 0 30%;
    max-width: 30%;

    background-color: #F8F3ED;
    padding: 1.5em 1em;
    box-sizing: border-box;
    border-radius: 8px;
}

.wce-myaccount__nav {
    width: 100%;
}

.wce-myaccount__menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.wce-myaccount__menu-item {
    margin-bottom: 8px;

    /* Item background lives on LI so each keeps its own background */
    background-color: #EBE0CC;
    border-radius: 8px;
    overflow: hidden;
}

.wce-myaccount__menu-item a {
    text-decoration: none;
}

.wce-myaccount__menu-item:last-child {
    margin-bottom: 0;
}

.wce-myaccount__menu-item.is-active {
    background-color: #DDCAA7;
}

.wce-myaccount__menu-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none; /* remove underline */
    border-radius: 0; /* radius handled by LI */
    font-size: 15px;
    font-weight: 500;
    transition: filter 0.2s ease-in-out;
    background: transparent;
    color: #111;
}

/* Hover */
.wce-myaccount__menu-item:hover .wce-myaccount__menu-link {
    filter: brightness(0.98);
}

/* ==========================================================
   Content Area
   ========================================================== */

/* Safety overrides in case theme/Woo floats leak in */
.woocommerce-account .woocommerce-MyAccount-navigation,
.woocommerce-account .woocommerce-MyAccount-content {
    float: none;
    width: 100%;
}

.wce-myaccount__content {
    /* Remaining space (approx 70%) */
    flex: 1 1 70%;
    min-width: 0; /* prevents flex overflow issues */
    background-color: #F8F3ED;
    padding: 1.5em 1em;
    border-radius: 8px;
}

.my_account_orders thead th {
    border: none;
    text-align: center;
    background-color: #DDCAA7;
}

.my_account_orders tbody th,
.my_account_orders tbody td,
table {
    border: none;
    background-color: #EBE0CC;
    text-align: center;
    color: #000;
}

.my_account_orders tbody a {
    color: #000;
}

.my_account_orders .button.view {
    background-color: #000;
    color: #fff;
}

table thead:first-child tr:first-child th {
    border: none;
}

.woocommerce table.shop_table {
    border: none;
}

/* Improve Woo default tables spacing */
.wce-myaccount__content .woocommerce table.shop_table {
    width: 100%;
    border-collapse: collapse;
}

.wce-myaccount__content .woocommerce table.shop_table th,
.wce-myaccount__content .woocommerce table.shop_table td {
    padding: 14px 12px;
}

/* Improve forms spacing */
.wce-myaccount__content .woocommerce form {
    margin: 0;
}

.wce-myaccount__content .woocommerce .form-row {
    margin-bottom: 16px;
}

.wce-myaccount__content .woocommerce input.input-text,
.wce-myaccount__content .woocommerce select,
.wce-myaccount__content .woocommerce textarea {
    width: 100%;
    box-sizing: border-box;
}

/* Buttons */
.wce-myaccount__content .woocommerce button.button,
.wce-myaccount__content .woocommerce a.button {
    border-radius: 6px;
    padding: 10px 18px;
}

/* ==========================================================
   Responsive
   ========================================================== */

@media (max-width: 1024px) {
    .wce-myaccount__layout {
        gap: 24px;
    }

    .wce-myaccount__sidebar {
        /* Keep the same 30% behavior on tablet */
        flex: 0 0 30%;
        max-width: 30%;
    }
}

@media (max-width: 768px) {

    .wce-myaccount__wrap {
        padding: 30px 16px;
    }

    .wce-myaccount__layout {
        flex-direction: column;
        gap: 24px;

        /* FIX: in column, allow children to stretch full width */
        align-items: stretch;
    }

    .wce-myaccount__sidebar {
        flex: 1 1 100%;
        max-width: 100%;
        width: 100%;
    }

    /* FIX: ensure content matches sidebar width on mobile */
    .wce-myaccount__content {
        flex: 1 1 100%;
        max-width: 100%;
        width: 100%;
    }

    .wce-myaccount__menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .wce-myaccount__menu-item {
        margin-bottom: 0;
    }

    .wce-myaccount__menu-link {
        padding: 8px 12px;
        font-size: 14px;
    }

    .wce-myaccount__title {
        font-size: 1.5em;
    }
}
