/**
 * WooCommerce My Account Overhaul - Japebo Branded
 */

:root {
    /* Color Palette */
    --wc-acct-primary: #4dae65;
    --wc-acct-primary-hover: #3d8e52;
    --wc-acct-bg: #f7f9fb;
    --wc-acct-card-bg: #ffffff;
    --wc-acct-text-main: #1a1a1a;
    --wc-acct-text-muted: #666666;
    --wc-acct-border: #eeeeee;

    /* Spacing & Shapes */
    --wc-acct-radius: 16px;
    /* Matching the card look in screenshots */
    --wc-acct-btn-radius: 10px;
    /* Per user instruction */
    --wc-acct-shadow: none;
    --nav-width: 280px;
}

/* 1. Page Title & Header Section */
.my-account-header {
    background: transparent;
    padding: 40px 15px 20px !important;
}

.my-account-header h1 {
    font-size: 30px !important;
    font-weight: 600 !important;
    /* Slightly softened boldness */
    color: var(--wc-acct-text-main) !important;
    letter-spacing: -0.02em !important;
    text-transform: none !important;
    margin-bottom: 4px !important;
}

.my-account-header small {
    font-size: 14px !important;
    /* Slightly larger */
    font-weight: 500 !important;
    color: var(--wc-acct-primary-hover) !important;
    /* Deeper green for better contrast */
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    /* Reduced spacing for readability */
    display: block;
}


/* Main Container & Alignment */
.woocommerce-account .row.vertical-tabs {
    display: flex !important;
    align-items: flex-start !important;
    gap: 0;
}

/* 2. Navigation Sidebar Wrapper & Profile (Matching your theme DOM) */
.woocommerce-account .large-3.col.col-border {
    background: var(--wc-acct-card-bg);
    padding: 32px !important;
    border-radius: var(--wc-acct-radius);
    box-shadow: none !important;
    /* Force no shadow */
    height: fit-content;
    border: 1px solid var(--wc-acct-border) !important;
    box-sizing: border-box;
    margin-top: 0 !important;
}

/* 3. Content Area Alignment */
.woocommerce-account .large-9.col {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.woocommerce-MyAccount-content {
    background: var(--wc-acct-card-bg);
    padding: 40px;
    border-radius: var(--wc-acct-radius);
    box-shadow: none !important;
    /* Force no shadow */
    border: 1px solid var(--wc-acct-border);
    margin-top: 0 !important;
}

/* Remove default sidebar styling now that parent has it */
.woocommerce-account .woocommerce-MyAccount-navigation {
    padding: 0 !important;
    background: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* Style the actual user profile from your theme */
.account-user {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    box-shadow: none !important;
    /* Remove the theme's shadow */
    background: none !important;
    /* Remove any theme background */
}

/* Hide the ::before icons in navigation links */
.woocommerce-MyAccount-navigation ul li a::before {
    display: none !important;
}

.account-user .image img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: block;
}

.account-user .user-name {
    font-weight: 600;
    color: var(--wc-acct-text-main);
    font-size: 16px;
    line-height: 1.2;
}


.woocommerce-MyAccount-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.woocommerce-MyAccount-navigation ul li {
    margin-bottom: 6px;
    border: none !important;
}

.woocommerce-MyAccount-navigation ul li a {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    text-decoration: none;
    color: var(--wc-acct-text-main);
    font-weight: 500;
    font-size: 15px;
    border-radius: 12px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.woocommerce-MyAccount-navigation ul li.is-active a {
    background: var(--wc-acct-primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(77, 174, 101, 0.25);
    cursor: default;
    /* Show it's not clickable */
}

.woocommerce-MyAccount-navigation ul li:not(.is-active) a:hover {
    background: #f0f7f1;
    color: var(--wc-acct-primary);
}

/* 3. Content Area */
.woocommerce-MyAccount-content {
    flex: 1;
    min-width: 300px;
    background: var(--wc-acct-card-bg);
    padding: 40px;
    border-radius: var(--wc-acct-radius);
    border: 1px solid var(--wc-acct-border);
    box-shadow: none !important;
    /* Force no shadow */
}

/* 4. Heading & Typography */
.woocommerce-MyAccount-content p {
    color: var(--wc-acct-text-muted);
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 20px;
}

.woocommerce-MyAccount-content h2,
.woocommerce-MyAccount-content h3 {
    color: var(--wc-acct-text-main);
    margin-bottom: 24px;
    margin-top: 0;
    /* Removed excessive top margin */
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* 4.5 Order Specific Styles (Details Page) */
.woocommerce-MyAccount-content mark {
    background: none !important;
    color: var(--wc-acct-text-main) !important;
    font-weight: 600;
    padding: 0;
}

.order_details thead th {
    background: #fafafa;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.05em;
}

.order_details tfoot th {
    text-align: left;
    font-weight: 600;
    color: var(--wc-acct-text-main);
    padding: 15px 20px !important;
    border-top: 1px solid #f2f2f2;
    font-size: 15px;
}

.order_details tfoot td {
    text-align: right !important;
    padding: 15px 20px !important;
    border-top: 1px solid #f2f2f2;
    font-size: 15px;
    color: var(--wc-acct-text-main);
}

.order_details tfoot tr:last-child th,
.order_details tfoot tr:last-child td {
    font-weight: 700;
    /* Keeps same size as other lines */
}

/* 5. Tables & Cards */
.shop_table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
    border: 1px solid var(--wc-acct-border);
    border-radius: 12px;
    overflow: hidden;
}

.shop_table thead th {
    background: #fafafa;
    padding: 18px;
    text-align: left;
    color: #333;
    font-weight: 600;
    font-size: 15px;
    /* Larger text */
    border-bottom: 1px solid var(--wc-acct-border);
}

.shop_table tbody td {
    padding: 18px;
    border-bottom: 1px solid var(--wc-acct-border);
    color: var(--wc-acct-text-main);
    /* Darker text for visibility */
    font-size: 15px;
    /* Larger text */
    vertical-align: middle;
}

/* Give order number more breathing room */
.shop_table .woocommerce-orders-table__cell-order-number,
.shop_table .woocommerce-orders-table__header-order-number {
    padding-left: 20px !important;
}

/* Refine buttons in table - Balanced for desktop to stay in one row */
.woocommerce-MyAccount-content .shop_table .button {
    padding: 8px 16px !important;
    /* Slightly larger on desktop */
    font-size: 13px !important;
    min-width: 70px !important;
    text-align: center;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-weight: 600 !important;
}

/* Kills theme-specific inset shadow on scrollable tables */
.touch-scroll-table {
    box-shadow: none !important;
}

/* Flex buttons on orders log - STRICT no wrap on desktop */
.order-actions-container,
td.woocommerce-orders-table__cell-order-actions {
    display: flex !important;
    gap: 4px !important;
    /* Very tight gap to allow larger buttons */
    align-items: center !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
}

/* Specific fix for vertical alignment in the actions cell */
td.woocommerce-orders-table__cell-order-actions {
    vertical-align: middle !important;
    height: 100% !important;
    padding-right: 15px !important;
    /* Give them a bit more breathing room on the right */
}

/* Buttons */
.woocommerce-MyAccount-content .button,
.woocommerce-Button {
    background: var(--wc-acct-primary) !important;
    color: #ffffff !important;
    padding: 12px 24px !important;
    border-radius: var(--wc-acct-btn-radius) !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    text-transform: none !important;
    border: none !important;
    transition: transform 0.2s ease, background 0.2s ease !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.woocommerce-MyAccount-content .woocommerce-info:has(a[href*="add-payment-method"]) .message-container {
    margin: 0 !important;
}

.woocommerce-MyAccount-content .woocommerce-info:has(a[href*="add-payment-method"]) .button {
    margin-left: 15px !important;
    margin-top: 0 !important;
}


.woocommerce-MyAccount-content .button:hover {
    background: var(--wc-acct-primary-hover) !important;
    transform: translateY(-1px);
}

/* 6. Dashboard Link Grid (Based on your theme DOM) */
.dashboard-links {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 15px !important;
    margin: 30px 0 !important;
    list-style: none !important;
    padding: 0 !important;
}

.dashboard-links li {
    flex: 0 0 calc(33.33% - 10px);
    /* Fixed 3-column layout */
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    box-sizing: border-box;
}

.dashboard-links li a {
    display: block !important;
    background: #ffffff !important;
    border: 1.5px solid var(--wc-acct-border) !important;
    padding: 22px 10px !important;
    border-radius: 10px !important;
    color: var(--wc-acct-primary) !important;
    text-align: center !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

.dashboard-links li a:hover {
    background: #f0f7f1 !important;
    color: var(--wc-acct-primary) !important;
    border-color: var(--wc-acct-primary) !important;
    box-shadow: 0 4px 12px rgba(77, 174, 101, 0.1) !important;
}

/* Mobile: Switch to 2 columns */
@media (max-width: 600px) {
    .dashboard-links li {
        flex: 0 0 calc(50% - 8px);
    }
}

/* Reset any specific active states in the grid that might be dark */
.dashboard-links li.is-active a {
    background: #ffffff;
    color: var(--wc-acct-primary);
}

/* 7. Addresses (Matching the "Terms & Policies" card style) */
.woocommerce-Addresses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-top: 30px;
}

.woocommerce-Address {
    background: #ffffff;
    border: 1px solid var(--wc-acct-border);
    padding: 32px;
    border-radius: var(--wc-acct-radius);
    transition: border-color 0.3s ease;
}

.woocommerce-Address:hover {
    border-color: var(--wc-acct-primary);
}

.woocommerce-Address-title h3 {
    font-size: 18px;
    margin-bottom: 15px;
}

.woocommerce-Address address {
    font-style: normal;
    color: var(--wc-acct-text-muted);
    line-height: 1.8;
    font-size: 14px;
}

.woocommerce-Address address a.edit {
    display: inline-block;
    color: var(--wc-acct-primary);
    text-decoration: none;
    margin-bottom: 8px;
}

/* 8. Forms & Inputs */
.woocommerce-EditAccountForm .form-row {
    margin-bottom: 24px;
}

.woocommerce-EditAccountForm label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--wc-acct-text-main);
}

.woocommerce-Input,
.input-text,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #d1d5db;
    /* Stronger border color */
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: var(--wc-acct-text-main);
    transition: all 0.2s ease;
    box-sizing: border-box;
    background-color: #ffffff;
}

.woocommerce-Input:focus,
.input-text:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--wc-acct-primary);
    box-shadow: 0 0 0 3px rgba(77, 174, 101, 0.15);
}

.woocommerce-EditAccountForm fieldset {
    border: none;
    border-top: 1px solid var(--wc-acct-border);
    padding-top: 30px;
    margin-top: 20px;
}

.woocommerce-EditAccountForm legend {
    font-weight: 700;
    font-size: 18px;
    color: var(--wc-acct-text-main);
    padding-bottom: 16px;
    text-transform: uppercase;
}

/* Mobile Adjustments */
@media (max-width: 992px) {
    .woocommerce-account .row.vertical-tabs {
        flex-direction: column !important;
    }

    .woocommerce-account .large-3.col.col-border,
    .woocommerce-account .large-9.col {
        width: 100% !important;
        max-width: 100% !important;
        flex-basis: auto !important;
    }

    .woocommerce-account .large-3.col.col-border {
        margin-bottom: 20px !important;
        padding: 15px !important;
        /* Reduced padding */
    }

    .woocommerce-MyAccount-content {
        padding: 15px !important;
        /* Reduced padding */
    }
}

@media (max-width: 768px) {

    /* 1. Transform Table to Cards */
    .shop_table.my_account_orders,
    .shop_table.my_account_orders thead,
    .shop_table.my_account_orders tbody,
    .shop_table.my_account_orders tr,
    .shop_table.my_account_orders td,
    .shop_table.my_account_orders th {
        display: block !important;
        width: 100% !important;
        border: none !important;
    }

    .shop_table.my_account_orders thead {
        display: none !important;
        /* Hide headers on mobile */
    }

    .shop_table.my_account_orders tr {
        background: #fff !important;
        border: 1.5px solid var(--wc-acct-border) !important;
        border-radius: 16px !important;
        margin-bottom: 20px !important;
        padding: 20px !important;
        position: relative !important;
        box-sizing: border-box !important;
    }

    .shop_table.my_account_orders td,
    .shop_table.my_account_orders th {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 0 !important;
        text-align: right !important;
        border-bottom: 1px solid #f9f9f9 !important;
    }

    .shop_table.my_account_orders td:last-child,
    .shop_table.my_account_orders th:last-child {
        border-bottom: none !important;
        margin-top: 10px !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    /* Add labels back via CSS (except for the order number) */
    .shop_table.my_account_orders td:not(.woocommerce-orders-table__cell-order-number):not(.woocommerce-orders-table__cell-order-actions)::before,
    .shop_table.my_account_orders th:not(.woocommerce-orders-table__cell-order-number):not(.woocommerce-orders-table__cell-order-actions)::before {
        content: attr(data-title) ": ";
        font-weight: 700;
        color: var(--wc-acct-text-muted);
        text-align: left;
        flex-shrink: 0;
        margin-right: 15px;
    }

    /* Style the Order Number as a large Header */
    .shop_table.my_account_orders .woocommerce-orders-table__cell-order-number {
        justify-content: flex-start !important;
        padding-top: 5px !important;
        padding-bottom: 12px !important;
        padding-left: 0 !important;
        margin-left: 0 !important;
        margin-bottom: 5px !important;
        border-bottom: 2px solid #f0f0f0 !important;
    }

    .shop_table.my_account_orders .woocommerce-orders-table__cell-order-number a {
        font-size: 17px !important;
        font-weight: 700 !important;
        color: var(--wc-acct-primary) !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .shop_table.my_account_orders .woocommerce-orders-table__cell-order-number::before {
        display: none !important;
        /* Hide "Order" label */
    }

    /* Handle the Action buttons at the bottom */
    .shop_table.my_account_orders .woocommerce-orders-table__cell-order-actions {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
        gap: 10px !important;
        border-top: 1.5px solid var(--wc-acct-border) !important;
        padding-top: 15px !important;
        margin-top: 5px !important;
    }

    .shop_table.my_account_orders .woocommerce-orders-table__cell-order-actions::before {
        display: none !important;
        /* Hide "Actions" label */
    }

    .shop_table.my_account_orders .button {
        flex: 0 1 auto !important;
        /* Compact width instead of full-width */
        min-width: 90px !important;
        padding: 10px 20px !important;
        font-size: 13px !important;
        text-align: center !important;
        margin: 0 !important;
    }

    /* Status Badges */
    .woocommerce-orders-table__cell-order-status {
        font-weight: 600;
        color: var(--wc-acct-primary) !important;
    }
}

@media (max-width: 480px) {
    .shop_table.my_account_orders .button {
        flex: 1 1 100% !important;
        /* Stack buttons on very small screens */
    }
}

.normal-title {
    border-bottom: none !important;
}

/* 7. Account Restructuring (Skip Dashboard) - Hidden Globally */
.woocommerce-MyAccount-navigation-link--dashboard {
    display: none !important;
}

/* 8. Premium Logout UX (Modal Overlay Style) */
/* This targets the Flatsome/WooCommerce notice wrapper */
body.is-logout-confirmation .woocommerce-notices-wrapper,
body.is-logout-confirmation .woocommerce-message-wrapper,
body.is-logout-confirmation .woocommerce-MyAccount-content:has(.woocommerce-info, .woocommerce-message) {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.4) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 99999 !important;
    backdrop-filter: blur(4px);
    margin: 0 !important;
    padding: 0 !important;
}

/* Transform the standard notice into the premium card */
body.is-logout-confirmation .woocommerce-info,
body.is-logout-confirmation .woocommerce-message,
body.is-logout-confirmation .message-wrapper {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: var(--wc-acct-card-bg) !important;
    padding: 60px 40px !important;
    border-radius: 24px !important;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.2) !important;
    max-width: 500px !important;
    /* Widened to fit text on one line */
    width: 95% !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 999999 !important;
    margin: 0 !important;
}

/* Force vertical stack for the injected notice */
body.is-logout-confirmation .woocommerce-info,
body.is-logout-confirmation .woocommerce-message,
body.is-logout-confirmation .message-wrapper,
body.is-logout-confirmation .message-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--wc-acct-text-main) !important;
}

/* Specifically style the injected "Go back" link */
.cancel-logout-link {
    order: 3 !important;
    /* Move to the bottom */
    color: #999 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    margin-top: 25px !important;
    display: block !important;
    transition: color 0.2s ease !important;
}

.cancel-logout-link:hover {
    color: var(--wc-acct-text-main) !important;
}

/* Style the confirmation link (the red button) */
body.is-logout-confirmation .message-container a:not(.cancel-logout-link) {
    order: 2 !important;
    display: block !important;
    margin: 30px auto 0 !important;
    background: #e74c3c !important;
    color: #fff !important;
    padding: 14px 40px !important;
    border-radius: 12px !important;
    text-decoration: none !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    transition: background 0.2s ease !important;
}

.logout-message-text {
    order: 1 !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
}

/* Specifically hide that icon-checkmark <i> tag */
body.is-logout-confirmation i.icon-checkmark,
body.is-logout-confirmation .icon-checkmark {
    display: none !important;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
