/**
 * Account Page Styles
 *
 * @package Flaman_Storefront
 */

/* ── Login / Registration Error Notices ───────────────────────────────── */

.woocommerce-account:not(.logged-in) .woocommerce-notices-wrapper {
    max-width: 480px;
    margin: 1.5rem auto 0;
}

.woocommerce-account:not(.logged-in) .woocommerce-notices-wrapper:empty {
    display: none;
}

.woocommerce-account:not(.logged-in) .woocommerce-error {
    list-style: none;
    padding: 1rem 1.25rem;
    margin: 0;
    background: #fff5f5;
    border: 1px solid #ffcdd2;
    border-left: 4px solid var(--error, #c62828);
    border-radius: 8px;
    font-size: 0.9rem;
    color: #c62828;
}

.woocommerce-account:not(.logged-in) .woocommerce-error::before {
    display: none;
}

.woocommerce-account:not(.logged-in) .woocommerce-error li {
    margin: 0;
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

.woocommerce-account:not(.logged-in) .woocommerce-error li + li {
    border-top: 1px solid #ffcdd2;
    margin-top: 0.25rem;
    padding-top: 0.5rem;
}

.woocommerce-account:not(.logged-in) .woocommerce-error a {
    color: #c62828;
    font-weight: 600;
}

/* ── Login / Registration Centered Card Layout ───────────────────────── */

.flaman-account-forms {
    display: flex;
    justify-content: center;
    max-width: 480px;
    margin: 2rem auto;
}

.flaman-account-forms h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    color: #003646;
}

.flaman-form-subtitle {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.flaman-account-card {
    background: #fff;
    padding: 2.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    width: 100%;
}

.flaman-form--hidden {
    display: none;
}

.flaman-login-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.flaman-lost-password {
    font-size: 0.875rem;
    color: #C4161C;
}

.flaman-lost-password:hover {
    text-decoration: underline;
}


/* Terms checkbox */
.flaman-terms-checkbox {
    margin-top: 0.5rem;
}

.flaman-terms-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.flaman-terms-checkbox input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

.flaman-terms-checkbox a {
    color: var(--flaman-red);
    text-decoration: underline;
}

.flaman-terms-checkbox a:hover {
    color: var(--flaman-red-dark);
}

/* Hide WooCommerce default password strength meter (replaced by our checklist) */
.flaman-account-card .woocommerce-password-strength,
.flaman-account-card .woocommerce-password-hint {
    display: none;
}

/* Password requirements checklist */
.flaman-pw-requirements {
    list-style: none;
    padding: 0;
    margin: -0.5rem 0 0.75rem;
}

.flaman-pw-requirements li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #999;
    padding: 0.15rem 0;
    transition: color 0.2s;
}

.flaman-pw-requirements li.met {
    color: #2e7d32;
}

.flaman-pw-requirements .pw-check {
    display: inline-block;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    border: 1.5px solid #ccc;
    border-radius: 50%;
    position: relative;
    transition: border-color 0.2s, background 0.2s;
}

.flaman-pw-requirements li.met .pw-check {
    border-color: #2e7d32;
    background: #2e7d32;
}

.flaman-pw-requirements li.met .pw-check::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 7px;
    border: solid #fff;
    border-width: 0 1.5px 1.5px 0;
    transform: translate(-50%, -60%) rotate(45deg);
}

/* Toggle link between login/register */
.flaman-form-toggle {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #666;
}

.flaman-toggle-link {
    color: #C4161C;
    font-weight: 600;
    text-decoration: none;
}

.flaman-toggle-link:hover {
    text-decoration: underline;
}

/* Name fields side-by-side */
.flaman-name-row {
    display: flex;
    gap: 1rem;
}

.flaman-name-field {
    flex: 1;
}

/* Override WooCommerce default form.login / form.register border+padding */
.flaman-account-card form.login,
.flaman-account-card form.register {
    border: none;
    padding: 0;
    margin: 0;
    border-radius: 0;
}

/* Remove WC default border on the #customer_login wrapper */
#customer_login.flaman-account-forms {
    border: none;
    padding: 0;
}

/* Register/Login buttons — match card width, consistent padding */
.flaman-account-card .woocommerce-form-login__submit,
.flaman-account-card .woocommerce-form-register__submit {
    padding: 0.75rem 1.5rem;
    margin-top: 0.5rem;
}

/* Disabled register button until terms accepted */
.flaman-account-card .woocommerce-form-register__submit.button--disabled,
.flaman-account-card .woocommerce-form-register__submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Hide WooCommerce privacy policy text on registration form */
.flaman-account-card .woocommerce-privacy-policy-text {
    display: none;
}

/* ── My Account Navigation ───────────────────────────────────────── */

.woocommerce-MyAccount-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.woocommerce-MyAccount-navigation li {
    margin: 0;
    border-bottom: 1px solid #eee;
}

.woocommerce-MyAccount-navigation li:last-child {
    border-bottom: none;
}

.woocommerce-MyAccount-navigation a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
    border-radius: 4px;
}

.woocommerce-MyAccount-navigation a svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.woocommerce-MyAccount-navigation a:hover {
    background: #f5f5f5;
    color: #C4161C;
}

.woocommerce-MyAccount-navigation a:hover svg {
    opacity: 1;
}

.woocommerce-MyAccount-navigation .is-active a,
.woocommerce-MyAccount-navigation a[aria-current="page"] {
    background: #C4161C;
    color: #fff;
    font-weight: 600;
}

.woocommerce-MyAccount-navigation .is-active a svg,
.woocommerce-MyAccount-navigation a[aria-current="page"] svg {
    opacity: 1;
    stroke: #fff;
}

/* Delete account nav item — visually distinct but not disabled */
.woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link--delete-account a {
    color: #666;
}

.woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link--delete-account a:hover {
    color: #C4161C;
    background: #fff5f5;
}

/* When active, use the standard active styling (red bg, white text) */
.woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link--delete-account.is-active a {
    color: #fff;
    background: #C4161C;
}

/* ── Verification Banner ─────────────────────────────────────────── */

.flaman-verification-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #fff8e1;
    border: 1px solid #f0d060;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.flaman-verification-banner .verification-banner-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flaman-verification-banner svg {
    color: #e6a117;
    flex-shrink: 0;
}

.flaman-verification-banner p {
    margin: 0;
    font-size: 0.9rem;
}

.flaman-verification-banner .button {
    white-space: nowrap;
    font-size: 0.85rem;
}

/* ── Preferred Store Widget ──────────────────────────────────────── */

.flaman-preferred-store {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.flaman-preferred-store label {
    font-weight: 600;
    white-space: nowrap;
    margin: 0;
}

.flaman-preferred-store select {
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    background: #fff;
    cursor: pointer;
}

.flaman-preferred-store select:focus {
    border-color: #C4161C;
    outline: none;
    box-shadow: 0 0 0 2px rgba(196, 22, 28, 0.1);
}

.flaman-store-save-status {
    font-size: 0.8rem;
    color: #4caf50;
    opacity: 0;
    transition: opacity 0.3s;
}

.flaman-store-save-status.visible {
    opacity: 1;
}

/* ── Delete Account Page ─────────────────────────────────────────── */

.flaman-delete-account h3 {
    color: #C4161C;
    margin-bottom: 1rem;
}

.flaman-delete-warning {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: #fff5f5;
    border: 1px solid #ffcdd2;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.flaman-delete-warning svg {
    color: #C4161C;
    flex-shrink: 0;
    margin-top: 2px;
}

.flaman-delete-warning p {
    margin: 0 0 0.5rem;
}

.flaman-delete-warning ul {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
}

.flaman-delete-warning li {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.flaman-delete-button {
    background: #C4161C !important;
    color: #fff !important;
    border: none !important;
}

.flaman-delete-button:hover:not(:disabled) {
    background: #a11218 !important;
}

.flaman-delete-button--disabled,
.flaman-delete-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #C4161C !important;
}

/* ── No Orders Empty State ──────────────────────────────────────── */

.flaman-no-orders {
    text-align: center;
    padding: 3rem 1rem;
}

.flaman-no-orders p {
    color: #666;
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}

.flaman-no-orders .button {
    display: inline-block;
    width: auto;
    padding: 0.75rem 2rem;
}

/* ── Order Location ──────────────────────────────────────────────── */

.flaman-order-location {
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

/* ── Invoice column (orders list) ──────────────────────────────── */

.woocommerce-orders-table__cell-order-invoice .button {
    width: auto;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.invoice-na {
    color: #ccc;
}

/* ── Invoice button (order detail page) ───────────────────────── */

.flaman-invoice-actions {
    margin-top: 1rem;
}

.flaman-invoice-actions .button {
    width: auto;
    display: inline-block;
}


/* ── Session Timeout Warning ─────────────────────────────────────── */

.flaman-session-warning {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #fff3cd;
    border-bottom: 2px solid #e6a117;
    padding: 1rem 2rem;
    text-align: center;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.flaman-session-warning.visible {
    transform: translateY(0);
}

.flaman-session-warning p {
    margin: 0;
    font-size: 0.9rem;
    color: #856404;
}

/* ── Account Details / Password Change ──────────────────────────── */

/* Fieldset around "Password change" section */
.woocommerce-MyAccount-content fieldset {
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 1.5rem;
	margin: 1.5rem 0;
}

.woocommerce-MyAccount-content fieldset legend {
	font-size: 1.1rem;
	font-weight: 700;
	color: #003646;
	padding: 0 0.5rem;
}

/* Current password hint text */
.woocommerce-MyAccount-content fieldset > .form-row:first-of-type > span em {
	font-style: normal;
	font-size: 0.85rem;
	color: #666;
}

/* Account details form — constrain width for readability */
.woocommerce-EditAccountForm {
	max-width: 600px;
}


/* ── Address Forms ─────────────────────────────────────────────────── */

/* WC address form two-column grid */
.woocommerce-address-fields .woocommerce-address-fields__field-wrapper {
	display: flex;
	flex-wrap: wrap;
	gap: 0 1rem;
}

.woocommerce-address-fields .form-row {
	flex: 1 1 100%;
	box-sizing: border-box;
}

.woocommerce-address-fields .form-row-first,
.woocommerce-address-fields .form-row-last {
	flex: 1 1 calc(50% - 0.5rem);
}

/* Constrain width like account details */
.woocommerce-address-fields {
	max-width: 600px;
}

/* Country field — when WC renders <strong> for single-country */
.woocommerce-address-fields .woocommerce-input-wrapper strong {
	display: block;
	padding: 0.625rem 0.75rem;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 0.95rem;
	font-weight: 400;
	color: #333;
	background: #f5f5f5;
}

/* Style select2/selectWoo country/state dropdowns */
.woocommerce-address-fields .select2-container .select2-selection--single {
	height: auto;
	padding: 0.625rem 0.75rem;
	border: 1px solid #ccc;
	border-radius: 4px;
}

.woocommerce-address-fields .select2-container .select2-selection--single:focus-within,
.woocommerce-address-fields .select2-container--open .select2-selection--single {
	border-color: #C4161C;
	box-shadow: 0 0 0 2px rgba(196, 22, 28, 0.1);
}

/* Address form save button */
.woocommerce-address-fields .button {
	margin-top: 0.5rem;
}


/* ── My Account Layout (sidebar + content) ───────────────────────── */

.woocommerce-account .container {
    max-width: 1400px;
}

.woocommerce-account .woocommerce {
    max-width: 1400px;
    margin: 0 auto;
}

.woocommerce-MyAccount-navigation {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.5rem;
}

.woocommerce-MyAccount-content {
    min-height: 300px;
}

/* Form inputs on My Account pages */
.woocommerce-MyAccount-content .woocommerce-Input,
.woocommerce-MyAccount-content .input-text,
.woocommerce-MyAccount-content textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95rem;
}

.woocommerce-MyAccount-content .woocommerce-Input:focus,
.woocommerce-MyAccount-content .input-text:focus,
.woocommerce-MyAccount-content textarea:focus {
    border-color: #C4161C;
    outline: none;
    box-shadow: 0 0 0 2px rgba(196, 22, 28, 0.1);
}

/* Buttons */
.woocommerce-MyAccount-content .button,
.flaman-account-forms .button {
    background: #C4161C;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    width: 100%;
    font-size: 1rem;
}

.woocommerce-MyAccount-content .button:hover,
.flaman-account-forms .button:hover {
    background: #a11218;
}

/* ── Orders Table — Mobile Card Layout ────────────────────────────── */

@media (max-width: 768px) {
    .woocommerce-MyAccount-orders {
        border: none !important;
        border-collapse: collapse;
        margin-top: var(--spacing-lg);
    }

    .woocommerce-MyAccount-orders tbody {
        display: block;
        border: none;
    }

    .woocommerce-MyAccount-orders thead {
        display: none;
    }

    .woocommerce-MyAccount-orders tr,
    .woocommerce-MyAccount-orders tr:nth-child(even),
    .woocommerce-MyAccount-orders tr:nth-child(odd) {
        display: block;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-md);
        background: #fff !important;
    }

    .woocommerce-MyAccount-orders td,
    .woocommerce-MyAccount-orders th {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.4rem 0;
        border: none;
        text-align: right;
        background: transparent !important;
    }

    .woocommerce-MyAccount-orders td::before,
    .woocommerce-MyAccount-orders th::before {
        content: attr(data-title);
        font-weight: 600;
        color: var(--flaman-headings);
        text-align: left;
        margin-right: var(--spacing-md);
    }

    .woocommerce-MyAccount-orders td:last-child {
        padding-top: var(--spacing-sm);
        margin-top: var(--spacing-sm);
        border-top: 1px solid #eee;
        justify-content: flex-end;
    }
}

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .woocommerce-MyAccount-content {
        margin-top: var(--spacing-lg);
    }

    .flaman-login-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .flaman-verification-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .flaman-delete-warning {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .flaman-account-card {
        padding: 1.5rem;
    }

    .flaman-name-row {
        flex-direction: column;
        gap: 0;
    }

    .woocommerce-address-fields .form-row-first,
    .woocommerce-address-fields .form-row-last {
        flex: 1 1 100%;
    }
}
