/**
 * WOALY My Account Critical CSS
 * File: woaly-myaccount-critical.css
 * Purpose: Critical styles for My Account pages to prevent FOUC
 */

/* Base WooCommerce styles */
.woocommerce-Input,
.woocommerce-input-wrapper input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(79, 79, 79, 0.2);
    border-radius: 12px;
    font-size: 14px;
    background: transparent;
    outline: none;
    transition: border-color 0.2s ease;
}

.woocommerce-Input:focus {
    border-color: rgba(79, 79, 79, 0.4);
}

.button,
.woocommerce-Button,
input[type="submit"] {
    background: #242638;
    color: white;
    border: none;
    padding: 16px 20px;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: Rethink Sans;
    font-weight: 500;
    font-size: 14px;
    text-align: center;
    line-height: 10px;
}

.button:hover,
.woocommerce-Button:hover {
    background: #1a1d2b;
}

/* All WooCommerce message styles (success, error, info) moved to woocommerce.css for consistency */

/* Modern Address Buttons */
.woaly-address-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 22px;
    width: 100%;
    margin: 0 auto;
}

.woaly-address-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    height: 62px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    box-sizing: border-box;
}

.woaly-address-button:hover {
    background: #f9f9f9;
    border-color: #d1d1d1;
    text-decoration: none;
}

.woaly-address-button .address-label {
  font-family: Rethink Sans;
  font-weight: 500;
  font-size: 16px;
  line-height: 11px;
  color: #3A4151;
}

.woaly-address-button .edit-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.woaly-address-button:hover .edit-icon {
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .woaly-address-buttons-container {
        max-width: 100%;
        padding: 0 16px;
    }

    .woaly-address-button {
        padding: 14px 16px;
        height: 52px;
    }

    .woaly-address-button .address-label {
        font-size: 14px;
    }
}

/* Address Form Styles */
.woaly-address-form-container {
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
}

.woaly-address-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    position: relative;
}

.woaly-back-button {
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.woaly-back-button:hover {
    background-color: #f5f5f5;
}

.woaly-address-title {
    font-family: Rethink Sans;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
    flex: 1;
    text-align: left;
}

.woaly-address-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.woaly-form-row {
    display: flex;
    gap: 12px;
}

.woaly-form-row.woaly-two-columns {
    display: flex;
    gap: 12px;
}

.woaly-form-row.woaly-two-columns .input-wrapper {
    flex: 1;
}

.woaly-form-row.woaly-full-width {
    width: 100%;
}

.woaly-form-row.woaly-full-width .input-wrapper {
    width: 100%;
}

/* Reuse existing floating input styles from edit-account */
.woaly-address-form .input-wrapper {
    position: relative;
    margin-bottom: 0;
}

.woaly-address-form .floating-input,
.woaly-address-form .floating-select {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 14px;
    border: 1px solid rgba(79, 79, 79, 0.2);
    border-radius: 12px;
    background: transparent;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.woaly-address-form .floating-select {
    padding-right: 40px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='%234F4F4F' d='M6 8L0 2h12L6 8z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
    cursor: pointer;
}

.woaly-address-form .floating-input:focus,
.woaly-address-form .floating-select:focus {
    border-color: rgba(79, 79, 79, 0.4);
}

.woaly-address-form .floating-label {
    position: absolute;
    left: 12px;
    top: 12px;
    background: white;
    padding: 0 4px;
    font-size: 14px;
    color: rgba(79, 79, 79, 0.52);
    transition: all 0.2s ease;
    pointer-events: none;
}

.woaly-address-form .floating-input:focus + .floating-label,
.woaly-address-form .floating-input:not(:placeholder-shown) + .floating-label,
.woaly-address-form .floating-select:focus + .floating-label,
.woaly-address-form .select-wrapper .floating-label {
    top: -8px;
    font-size: 12px;
    color: #242638;
}

.woaly-address-form .required {
    color: #ef4444;
}

.woaly-form-actions {
    margin-top: 24px;
    display: flex;
    justify-content: flex-start;
}

.woaly-save-button {
    background: #242638;
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: Rethink Sans;
    font-weight: 500;
    font-size: 14px;
    line-height: 1;
}

.woaly-save-button:hover {
    background: #1a1d2b;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .woaly-form-row.woaly-two-columns {
        flex-direction: column;
        gap: 16px;
    }

    .woaly-address-form-container {
        padding: 0 12px;
    }

    .woaly-address-header {
        margin-bottom: 24px;
    }

    .woaly-address-title {
        font-size: 18px;
    }
}

/* Mi-cuenta (My Account) Plugin Layout Preservation */
.tgwc-woocommerce-customize-my-account #tgwc-woocommerce {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.tgwc-woocommerce-customize-my-account #tgwc-woocommerce .woocommerce-MyAccount-content {
    flex: 1;
}

.logged-in.woocommerce-account.tgwc-woocommerce-customize-my-account #tgwc-woocommerce.woocommerce {
    display: flex;
    width: 1200px;
    max-width: 100%;
    margin: 36px auto;
}

/* Plugin specific navigation styles */
.tgwc-woocommerce-customize-my-account #tgwc-woocommerce .tgwc-icon {
    width: 0.875em;
    height: 1em;
    vertical-align: -0.125em;
    display: inline-block;
    font-size: inherit;
}

/* Tab layout preservation */
.tgwc-woocommerce-customize-my-account #tgwc-woocommerce[data-menu-style=tab] {
    flex-direction: column;
}

.tgwc-woocommerce-customize-my-account #tgwc-woocommerce[data-menu-style=tab] .tgwc-woocommerce-MyAccount-navigation,
.tgwc-woocommerce-customize-my-account #tgwc-woocommerce[data-menu-style=tab] .woocommerce-MyAccount-content {
    width: 100%;
    grid-column: auto;
}

/* Sidebar layout preservation - OVERRIDE PLUGIN DEFAULT */
body.logged-in.woocommerce-account.tgwc-woocommerce-customize-my-account #tgwc-woocommerce[data-menu-style=sidebar] {
    grid-auto-flow: column;
}

body.logged-in.woocommerce-account.tgwc-woocommerce-customize-my-account #tgwc-woocommerce[data-menu-style=sidebar] .tgwc-woocommerce-MyAccount-navigation {
    width: 100%;
    max-width: 388px;
}

.tgwc-woocommerce-customize-my-account #tgwc-woocommerce[data-menu-style=sidebar] .tgwc-woocommerce-MyAccount-navigation,
.tgwc-woocommerce-customize-my-account #tgwc-woocommerce[data-menu-style=sidebar] .woocommerce-MyAccount-content {
    position: relative;
    margin: 0;
}

.tgwc-woocommerce-customize-my-account #tgwc-woocommerce[data-menu-style=sidebar][data-sidebar-position=left] .tgwc-woocommerce-MyAccount-navigation {
    position: sticky;
    position: -webkit-sticky;
    top: 16px;
    align-self: flex-start;
    grid-column: 1/2;
}

.tgwc-woocommerce-customize-my-account #tgwc-woocommerce[data-menu-style=sidebar][data-sidebar-position=right] {
    flex-direction: row-reverse;
}

/* Form styling - preserve exact original design */
.woocommerce-EditAccountForm .input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.woocommerce-EditAccountForm .floating-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 14px;
    border: 1px solid rgba(79, 79, 79, 0.2);
    border-radius: 12px;
    background: transparent;
    outline: none;
    transition: border-color 0.2s ease;
}

.woocommerce-EditAccountForm .floating-label {
    position: absolute;
    left: 12px;
    top: 12px;
    background: white;
    padding: 0 4px;
    font-size: 14px;
    color: rgba(79, 79, 79, 0.52);
    transition: all 0.2s ease;
    pointer-events: none;
}

/* Floating Select Wrapper */
.woocommerce-EditAccountForm .select-wrapper {
    position: relative;
    margin-bottom: 24px;
}

/* Floating Select Styling */
.woocommerce-EditAccountForm .floating-select {
    width: 100%;
    height: 48px;
    padding: 0 40px 0 16px;
    font-size: 14px;
    border: 1px solid rgba(79, 79, 79, 0.2);
    border-radius: 12px;
    background: transparent;
    outline: none;
    transition: border-color 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%234F4F4F' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
    cursor: pointer;
}

.woocommerce-EditAccountForm .floating-select:focus {
    border-color: rgba(79, 79, 79, 0.4);
}

/* Select wrapper label positioning */
.woocommerce-EditAccountForm .select-wrapper .floating-label {
    position: absolute;
    left: 12px;
    top: -8px;
    background: white;
    padding: 0 4px;
    font-size: 12px;
    color: #242638;
    transition: all 0.2s ease;
    pointer-events: none;
}

/* Placeholder styling for select */
.woocommerce-EditAccountForm .floating-select option[value=""] {
    color: rgba(79, 79, 79, 0.52);
}

/* Critical: Ensure labels float correctly for filled inputs */
.woocommerce-EditAccountForm .floating-input:focus + .floating-label,
.woocommerce-EditAccountForm .floating-input:not(:placeholder-shown) + .floating-label,
.woocommerce-EditAccountForm .floating-input[value]:not([value=""]) + .floating-label,
.woocommerce-EditAccountForm .floating-label.floating-active {
    top: -8px;
    font-size: 12px;
    color: #242638;
}

/* Override fieldset background for security form */
.security-form fieldset {
    padding: 0px;
    margin: 0px;
    border: 0px;
    background-color: transparent;
}

form.woocommerce-EditAccountForm.edit-account fieldset legend {
    font-family: Rethink Sans;
    font-weight: 600;
    font-size: 20px;
    line-height: 14px;
    margin: 0 0 32px 0;
}

form.woocommerce-EditAccountForm.edit-account fieldset {
  margin: 0 0 12px 0;
}

/* Security form floating input styles */
.security-form .input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.security-form .floating-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 14px;
    border: 1px solid rgba(79, 79, 79, 0.2);
    border-radius: 12px;
    background: transparent;
    outline: none;
    transition: border-color 0.2s ease;
}

.security-form .floating-label {
    position: absolute;
    left: 12px;
    top: 12px;
    background: white;
    padding: 0 4px;
    font-size: 14px;
    color: rgba(79, 79, 79, 0.52);
    transition: all 0.2s ease;
    pointer-events: none;
}

.security-form .floating-input:focus + .floating-label,
.security-form .floating-input:not(:placeholder-shown) + .floating-label,
.security-form .floating-input[value]:not([value=""]) + .floating-label,
.security-form .floating-label.floating-active {
    top: -8px;
    font-size: 12px;
    color: #242638;
}

/* Delete Account Section */
.delete-account-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 28px;
    border: 1px solid #F2F4F8;
    border-radius: 32px;
    width: 100%;
    margin: 20px 0 0 0;
}

.delete-account-section h3 {
    color: #242638;
    font-family: Rethink Sans;
    font-weight: 600;
    font-size: 20px;
    line-height: 14px;
    margin: 0px;
}

.delete-account-section p {
    color: #7f1d1d;
    font-size: 14px;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.delete-account-btn {
    background: #fff;
    color: #242638;
    border: 1px solid #242638;
    padding: 16px 40px;
    border-radius: 100px;
    cursor: pointer;
    font-family: Rethink Sans;
    font-weight: 500;
    font-size: 14px;
    line-height: 15px;
}
.delete-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.delete-modal.modal-opened {
    opacity: 1;
}

.delete-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.delete-modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 24px;
    max-width: 546px;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    z-index: 1;
}

.delete-modal.modal-opened .delete-modal-content {
    transform: scale(1);
}

.delete-modal-content h3 {
    color: #262626;
    font-family: Rethink Sans;
    font-weight: 600;
    font-size: 20px;
    margin: 0 0 20px 0;
    text-align: start;
    line-height: 14px;
}

.delete-modal-content p {
    color: #262626;
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 48px 0;
    text-align: start;
}

.delete-modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: end;
}

.cancel-btn {
    background-color: #fff;
    color: #242638;
    border: 1px solid #242638;
    padding: 16px 40px;
    border-radius: 42px;
    cursor: pointer;
    font-family: Rethink Sans;
    font-weight: 400;
    font-size: 16px;
    line-height: 11px;
    transition: background-color 0.2s ease;
}

.confirm-delete-btn {
    background-color: #242638;
    color: #fff;
    border: none;
    padding: 16px 20px;
    border-radius: 42px;
    cursor: pointer;
    font-family: Rethink Sans;
    font-weight: 400;
    font-size: 16px;
    line-height: 11px;
    transition: background-color 0.2s ease;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .delete-modal-content {
        padding: 24px 20px;
        margin: 0 12px;
    }

    .delete-modal-buttons {
        flex-direction: column;
    }

    .cancel-btn,
    .confirm-delete-btn {
        width: 100%;
        padding: 14px;
    }
}

/* Prevent FOUC for default content */
.woocommerce-MyAccount-content > p:first-of-type {
    display: none;
}

/* Plugin container visibility */
.tgwc-woocommerce-customize-my-account {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Orders List - matching original design */
.woocommerce-orders-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

.woocommerce-orders-table th,
.woocommerce-orders-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.woocommerce-orders-table th {
    background: #f8f9fa;
    font-weight: 600;
}

