/* =============================================
 * Woo My Account Tabs - Ultimate Styles v4.0
 * ============================================= */

/* Base state - hidden by default */
.woocommerce-MyAccount-content {
    display: block;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Active states - multiple selectors for robustness */
.woocommerce-MyAccount-content.is-active,
.woocommerce-MyAccount-content[data-endpoint="dashboard"],
.woocommerce-MyAccount-content.is-initialized {
    display: block !important;
    opacity: 1 !important;
}
/* Base state */
.woocommerce-MyAccount-content {
    display: block;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Active state with multiple selectors for robustness */
.woocommerce-MyAccount-content.is-active,
.woocommerce-MyAccount-content[data-endpoint].is-active,
.woocommerce-MyAccount-content.is-initialized {
    display: block !important;
    opacity: 1 !important;
}

/* Loading state */
.woocommerce-MyAccount-content.is-loading {
    position: relative;
    min-height: 100px;
}

.woocommerce-MyAccount-content.is-loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Active tab styling */
.woocommerce-MyAccount-navigation li.is-active a {
    font-weight: bold;
    color: #000;
}

/* Form styling */
.woocommerce-MyAccount-content form {
    transition: all 0.3s ease;
}

.woocommerce-MyAccount-content form.is-active {
    display: block !important;
    opacity: 1 !important;
}

/* Core Structure & Visibility */
.afeb-my-account-tab {
    position: relative;
    width: 100%;
    clear: both;
    min-height: 400px;
    overflow: hidden;
    opacity: 1 !important;
}

/* Content Visibility States */
.afeb-my-account-tab .woocommerce-MyAccount-content {
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.afeb-my-account-tab .woocommerce-MyAccount-content.is-active {
    display: block;
    opacity: 1;
}

/* Form Visibility Control - CRITICAL FIXES */
.woocommerce-EditAccountForm,
.woocommerce-address-fields {
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.woocommerce-EditAccountForm.is-active,
.woocommerce-address-fields.is-active {
    display: block;
    opacity: 1;
}

/* Address Forms Specific */
.woocommerce-address-fields[data-address-type="billing"],
.woocommerce-address-fields[data-address-type="shipping"] {
    display: block;
}

.woocommerce-address-fields[data-address-type="billing"].is-active,
.woocommerce-address-fields[data-address-type="shipping"].is-active {
    display: block;
}

/* Editor Mode Overrides - FIXES EDITOR ISSUES */
.elementor-editor-active .woocommerce-EditAccountForm,
.elementor-editor-preview .woocommerce-EditAccountForm,
.elementor-editor-active .woocommerce-address-fields,
.elementor-editor-preview .woocommerce-address-fields {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Make forms fully interactive in editor */
.elementor-editor-active form,
.elementor-editor-preview form {
    pointer-events: auto !important;
}

/* Loading States */
.afeb-my-account-tab.loading {
    position: relative;
    pointer-events: none;
}
/*!* Typography Fixes *!*/
/*.afeb-my-account-tab,*/
/*.afeb-my-account-tab * {*/
/*    letter-spacing: inherit !important;*/
/*    word-spacing: inherit !important;*/
/*    line-height: inherit !important;*/
/*    font-family: inherit !important;*/
/*    font-weight: inherit !important;*/
/*    font-style: inherit !important;*/
/*    text-transform: inherit !important;*/
/*    text-decoration: inherit !important;*/
/*}*/

/* Specific typography controls */
.woocommerce-MyAccount-navigation ul li a {
    font-family: var(--afeb-woo-my-account-nav-typography-font-family, inherit);
    font-size: var(--afeb-woo-my-account-nav-typography-font-size, inherit);
    font-weight: var(--afeb-woo-my-account-nav-typography-font-weight, inherit);
    line-height: var(--afeb-woo-my-account-nav-typography-line-height, inherit);
    letter-spacing: var(--afeb-woo-my-account-nav-typography-letter-spacing, normal);
    text-transform: var(--afeb-woo-my-account-nav-typography-text-transform, none);
}

.afeb-my-account-tab.loading::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.7);
    z-index: 100;
}

.afeb-my-account-tab.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid rgba(91, 192, 222, 0.2);
    border-top-color: var(--afeb-woo-my-account-links-active-border, #5bc0de);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 101;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Navigation Structure */
.woocommerce-MyAccount-navigation {
    width: 25%;
    float: left;
}

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

.woocommerce-MyAccount-navigation li {
    margin-bottom: 5px;
}

.woocommerce-MyAccount-navigation li a {
    display: block;
    padding: 12px 15px;
    color: var(--afeb-woo-my-account-links-normal-color, #69727d);
    text-decoration: none;
    transition: all 0.3s ease;
    background: var(--afeb-woo-my-account-tabs-bg, #f9fafa);
    border-left: 3px solid transparent;
}

.woocommerce-MyAccount-navigation li.is-active a {
    color: var(--afeb-woo-my-account-links-active-color, #000);
    font-weight: 600;
    border-left-color: var(--afeb-woo-my-account-links-active-border, #5bc0de);
}

/* Content Area */
.woocommerce-MyAccount-ocontent {
    width: 75%;
    float: right;
    padding-left: 30px;
    box-sizing: border-box;
}

/* Form Elements - ENHANCED FOR EDIT ACCOUNT */
.woocommerce-EditAccountForm .woocommerce-form-row {
    margin-bottom: 20px;
}



.woocommerce-EditAccountForm .woocommerce-form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Address Edit Buttons - FIX FOR REFRESH ISSUE */
.woocommerce-Addresses .woocommerce-Address-title a.edit {
    display: inline-block;
    margin-left: 10px;
    font-size: 0.8em;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .woocommerce-MyAccount-navigation,
    .woocommerce-MyAccount-content {
        width: 100%;
        float: none;
        padding: 0;
    }

    .woocommerce-MyAccount-navigation {
        margin-bottom: 25px;
    }
}

/* Horizontal Layout */
.afeb-my-account-tabs-horizontal .woocommerce-MyAccount-navigation {
    width: 100% !important;
    float: none;
    margin-bottom: 30px;
}

.elementor-editor-preview .afeb-my-account-tabs-horizontal .woocommerce-MyAccount-navigation {
    width: 100% !important;
    float: none;
    margin-bottom: 30px;
}

.afeb-my-account-tabs-horizontal .afeb-my-account-tab .woocommerce-MyAccount-content.is-active{
    float:left;
    width:100%!important;
}

.elementor-editor-preview .afeb-my-account-tabs-horizontal .afeb-my-account-tab .woocommerce-MyAccount-content.is-active{
    float:left;
    width:100%!important;
}
.afeb-my-account-tabs-horizontal .woocommerce-MyAccount-navigation ul {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.afeb-my-account-tabs-horizontal .woocommerce-MyAccount-navigation li {
    flex: 1 0 auto;
    margin: 0;
}

.afeb-my-account-tabs-horizontal .woocommerce-MyAccount-navigation li a {
    text-align: center;
    border-left: none;
    border-bottom: 3px solid transparent;
}

.afeb-my-account-tabs-horizontal .woocommerce-MyAccount-navigation li.is-active a {
    border-left: none;
    border-bottom-color: var(--afeb-woo-my-account-links-active-border, #5bc0de);
}

/* Form Submission Handling */
form.woocommerce-EditAccountForm.submitting,
form.woocommerce-address-fields.submitting {
    position: relative;
    pointer-events: none;
}

form.woocommerce-EditAccountForm.submitting::after,
form.woocommerce-address-fields.submitting::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.7);
    z-index: 5;
}

/* Address Fields Grid Layout */
.woocommerce-address-fields__field-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Button Styles */
.woocommerce-Button {
    display: inline-block;
    padding: 12px 24px;
    background: var(--afeb-woo-my-account-button-bg, #5bc0de);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

/* Special Fix for Editor Preview */
.elementor-editor-active .afeb-my-account-tab .woocommerce-MyAccount-content:not(.is-active),
.elementor-editor-preview .afeb-my-account-tab .woocommerce-MyAccount-content:not(.is-active) {
    display: block!important;
}

.elementor-editor-active .afeb-my-account-tabs-horizontal .afeb-my-account-tab .woocommerce-MyAccount-content:not(.is-active),
.elementor-editor-preview .afeb-my-account-tabs-horizontal .afeb-my-account-tab .woocommerce-MyAccount-content:not(.is-active) {
    display: block!important;
    width:100% !important;
}

/* Horizontal Tabs Alignment Fix */
.afeb-my-account-tabs-horizontal .woocommerce-MyAccount-navigation ul {
    align-items: flex-end; /* Ensures all tabs align at the bottom */
}

.afeb-my-account-tabs-horizontal .woocommerce-MyAccount-navigation li {
    display: flex;
    height: 100%;
}

.afeb-my-account-tabs-horizontal .woocommerce-MyAccount-navigation li a {
    align-self: flex-end; /* Forces alignment to bottom */
    width: 100%!important;
    padding-top: 15px; /* Consistent top padding */
    padding-bottom: 15px; /* Consistent bottom padding */
}
/* Force dashboard to show on initial load */
.woocommerce-MyAccount-content[data-endpoint="dashboard"] {
    display: block !important;
    opacity: 1 !important;
}

/* Ensure other content stays hidden until activated */
.woocommerce-MyAccount-content:not([data-endpoint="dashboard"]) {
    display: block;
    opacity: 1;
}
/* Force redraw when tabs update */
.afeb-my-account-tab.force-refresh .woocommerce-MyAccount-navigation {
    animation: afebTabRefresh 0.1s;
}

@keyframes afebTabRefresh {
    from { opacity: 0.99; }
    to { opacity: 1; }
}

