/* === MY ACCOUNT - modern layout === */

body.woocommerce-account {
    --rwot-account-accent: var(--rwot-main-color, #0265DC);
    --rwot-account-accent-soft: color-mix(in srgb, var(--rwot-account-accent) 10%, #FFFFFF);
    --rwot-account-border: #ECEEF1;
    --rwot-account-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
    --rwot-account-radius: 16px;
}

/* Hide the old greeting card: the dashboard has its own header now */
body.woocommerce-account .myaccount-greeting-card {
    display: none !important;
}

/* --- Navigation --- */
body.woocommerce-account .woocommerce-MyAccount-navigation {
    align-self: flex-start;
    padding: 16px;
    background: #FFFFFF;
    border: 0 !important;
    border-radius: var(--rwot-account-radius);
    box-shadow: var(--rwot-account-shadow);
}

@media (min-width: 992px) {
    body.woocommerce-account .woocommerce-MyAccount-navigation {
        position: sticky;
        top: 24px;
    }
}

.rwot-account-nav-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 4px 16px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--rwot-account-border);
}

.rwot-account-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.rwot-account-nav-profile-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rwot-account-nav-name {
    overflow-wrap: anywhere;
    font-weight: 700;
    color: var(--text-default);
}

.rwot-account-nav-email {
    font-size: 12px;
    color: var(--text-disabled);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.woocommerce-account .woocommerce-MyAccount-navigation ul {
    gap: 4px;
}

/* No colored side borders / accent bars in the menu, whatever stylesheet adds them */
body.woocommerce-account .woocommerce-MyAccount-navigation ul,
body.woocommerce-account .woocommerce-MyAccount-navigation li,
body.woocommerce-account .woocommerce-MyAccount-navigation li a {
    border-left: 0 !important;
    border-right: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

body.woocommerce-account .woocommerce-MyAccount-navigation li::before,
body.woocommerce-account .woocommerce-MyAccount-navigation li::after,
body.woocommerce-account .woocommerce-MyAccount-navigation li a::before,
body.woocommerce-account .woocommerce-MyAccount-navigation li a::after {
    content: none !important;
    display: none !important;
}

body.woocommerce-account .woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link {
    height: auto;
    border-radius: 10px;
    transition: background-color .15s ease;
}

body.woocommerce-account .woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link a {
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-weak);
}

body.woocommerce-account .woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link:hover {
    background: #F6F7F8;
}

body.woocommerce-account .woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link.is-active {
    background-color: var(--rwot-account-accent-soft) !important;
}

body.woocommerce-account .woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link--customer-logout {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--rwot-account-border);
    border-radius: 0;
}

body.woocommerce-account .woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link--customer-logout a {
    color: #D31510;
}

body.woocommerce-account .woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link--customer-logout:hover {
    background: #FEF3F2;
}

/* --- Content card --- */
body.woocommerce-account:not(.woocommerce-view-order) .woocommerce-MyAccount-content {
    padding: 24px;
    background: #FFFFFF;
    border: 1px solid var(--rwot-account-border);
    border-radius: var(--rwot-account-radius);
    box-shadow: var(--rwot-account-shadow);
}

body.woocommerce-account.woocommerce-dashboard .woocommerce-MyAccount-content {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

/* --- Dashboard --- */
.rwot-dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rwot-dashboard-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    overflow: hidden;
    color: #FFFFFF;
    border-radius: var(--rwot-account-radius);
    background-color: var(--rwot-account-accent);
    background-image: linear-gradient(135deg, rgba(255, 255, 255, .12) 0%, rgba(0, 0, 0, .12) 100%);
    box-shadow: var(--rwot-account-shadow);
}

.rwot-dashboard-hero::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -60px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    pointer-events: none;
}

.rwot-dashboard-hero-avatar {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
}

.rwot-dashboard-hero-text {
    flex: 1;
    min-width: 0;
}

.rwot-dashboard-hero-text p,
.rwot-dashboard-hero-text h2 {
    margin: 0;
    color: inherit;
}

.rwot-dashboard-hero-hello {
    font-size: 14px;
    opacity: .9;
}

.rwot-dashboard-hero-name {
    overflow-wrap: anywhere;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

.rwot-dashboard-hero-meta {
    font-size: 13px;
    opacity: .8;
}

.rwot-dashboard-hero-logout {
    position: relative;
    z-index: 1;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF !important;
    text-decoration: none;
    white-space: nowrap;
    background: rgba(255, 255, 255, .18);
    border-radius: 100px;
    transition: background-color .15s ease;
}

.rwot-dashboard-hero-logout:hover {
    background: rgba(255, 255, 255, .28);
}

.rwot-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.rwot-dashboard-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #FFFFFF;
    border: 1px solid var(--rwot-account-border);
    border-radius: var(--rwot-account-radius);
    box-shadow: var(--rwot-account-shadow);
}

.rwot-dashboard-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    color: var(--rwot-account-accent);
    background: var(--rwot-account-accent-soft);
    border-radius: 12px;
}

.rwot-dashboard-stat-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-default);
    word-break: break-word;
}

.rwot-dashboard-stat-label {
    font-size: 12px;
    color: var(--text-disabled);
}

.rwot-dashboard-section {
    padding: 20px;
    background: #FFFFFF;
    border: 1px solid var(--rwot-account-border);
    border-radius: var(--rwot-account-radius);
    box-shadow: var(--rwot-account-shadow);
}

.rwot-dashboard-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.rwot-dashboard-section-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.rwot-dashboard-section-head a {
    font-size: 13px;
    font-weight: 600;
    color: var(--rwot-account-accent);
    text-decoration: none;
}

.rwot-dashboard-orders {
    margin: 0;
    padding: 0;
    list-style: none;
}

.rwot-dashboard-orders li + li {
    border-top: 1px solid var(--rwot-account-border);
}

.rwot-dashboard-orders a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 8px;
    color: inherit;
    text-decoration: none;
    border-radius: 10px;
    transition: background-color .15s ease;
}

.rwot-dashboard-orders a:hover {
    background: #F6F7F8;
}

.rwot-dashboard-order-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.rwot-dashboard-order-number {
    font-weight: 700;
    color: var(--text-default);
}

.rwot-dashboard-order-date {
    font-size: 12px;
    color: var(--text-disabled);
}

.rwot-dashboard-order-total {
    min-width: 90px;
    font-weight: 700;
    text-align: right;
    color: var(--text-default);
}

.rwot-order-status {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    color: #414346;
    background: #F1F2F4;
    border-radius: 100px;
}

.rwot-order-status.status-processing,
.rwot-order-status.status-on-hold {
    color: #B54708;
    background: #FFFAEB;
}

.rwot-order-status.status-pending {
    color: #175CD3;
    background: #EFF8FF;
}

.rwot-order-status.status-completed {
    color: #067647;
    background: #ECFDF3;
}

.rwot-order-status.status-cancelled,
.rwot-order-status.status-failed,
.rwot-order-status.status-refunded {
    color: #B42318;
    background: #FEF3F2;
}

.rwot-dashboard-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    text-align: center;
    color: var(--text-disabled);
}

.rwot-dashboard-empty p {
    margin: 0;
}

.rwot-dashboard-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.rwot-dashboard-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    color: inherit;
    text-decoration: none;
    border: 1px solid var(--rwot-account-border);
    border-radius: 12px;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.rwot-dashboard-link:hover {
    background: #F6F7F8;
    box-shadow: var(--rwot-account-shadow);
    transform: translateY(-2px);
}

.rwot-dashboard-link-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rwot-dashboard-link-text strong {
    color: var(--text-default);
}

.rwot-dashboard-link-text small {
    font-size: 12px;
    color: var(--text-disabled);
}

/* --- Responsive --- */
@media (max-width: 991px) {
    .rwot-dashboard-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    body.woocommerce-account .woocommerce-MyAccount-navigation,
    body.woocommerce-account .woocommerce-MyAccount-content {
        width: 100% !important;
        float: none !important;
    }

    body.woocommerce-account .woocommerce-MyAccount-navigation {
        padding: 12px;
    }

    body.woocommerce-account.woocommerce-dashboard .rwot-account-nav-profile {
        display: none;
    }

    body.woocommerce-account:not(.woocommerce-view-order) .woocommerce-MyAccount-content {
        padding: 16px;
    }

    body.woocommerce-account.woocommerce-dashboard .woocommerce-MyAccount-content {
        padding: 0;
    }

    .rwot-dashboard {
        gap: 16px;
    }

    .rwot-dashboard-hero {
        flex-wrap: wrap;
        gap: 12px;
        padding: 20px;
    }

    .rwot-dashboard-hero-avatar {
        width: 52px;
        height: 52px;
    }

    .rwot-dashboard-hero-name {
        font-size: 18px;
    }

    .rwot-dashboard-hero-logout {
        width: 100%;
        text-align: center;
    }

    .rwot-dashboard-stats {
        gap: 10px;
    }

    .rwot-dashboard-stat {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 14px;
    }

    .rwot-dashboard-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

    .rwot-dashboard-stat-value {
        font-size: 16px;
    }

    .rwot-dashboard-section {
        padding: 16px;
    }

    /* order row: number + total on top, status below */
    .rwot-dashboard-orders a {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px 12px;
        padding: 12px 4px;
    }

    .rwot-dashboard-orders .rwot-order-status {
        grid-row: 2;
        grid-column: 1;
        justify-self: start;
    }

    .rwot-dashboard-order-total {
        grid-row: 1;
        grid-column: 2;
        min-width: 0;
    }

    .rwot-dashboard-links {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .rwot-dashboard-link {
        padding: 12px;
    }
}
