/**
 * ABHO CPF Login Styles
 * 
 * Layout moderno, limpo e intuitivo para o fluxo de login por CPF.
 * Mobile-first. Cores do tema ABHO (#00476B azul escuro, #0098D9 azul claro).
 */

/* =========================================================================
   Container
   ========================================================================= */
.abho-cpf-login {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 40px auto;
    padding: 36px 32px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}

/* =========================================================================
   Logo
   ========================================================================= */
.abho-cpf-login__logo {
    text-align: center;
    margin-bottom: 28px;
}

.abho-cpf-login__logo img {
    height: 48px !important;
    width: auto !important;
    max-width: 200px !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* =========================================================================
   Typography
   ========================================================================= */
.abho-cpf-login__title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a2e;
    text-align: center;
    margin: 0 0 6px;
    line-height: 1.3;
}

.abho-cpf-login__subtitle {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    margin: 0 0 24px;
    line-height: 1.4;
}

/* =========================================================================
   Form Fields
   ========================================================================= */
.abho-cpf-login__field {
    margin-bottom: 20px;
}

.abho-cpf-login__label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.abho-cpf-login__input {
    display: block;
    width: 100%;
    padding: 12px 14px;
    font-size: 1.05rem;
    font-family: inherit;
    color: #1a1a2e;
    background: #f8f9fb;
    border: 2px solid #e2e6ea;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
}

.abho-cpf-login__input:focus {
    border-color: #0098D9;
    box-shadow: 0 0 0 3px rgba(0, 152, 217, 0.12);
    background: #fff;
}

.abho-cpf-login__input::placeholder {
    color: #b0b8c1;
}

/* Password wrapper */
.abho-cpf-login__password-wrap {
    position: relative;
}

.abho-cpf-login__password-wrap .abho-cpf-login__input {
    padding-right: 48px;
}

.abho-cpf-login__toggle-pw {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: #999;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.abho-cpf-login__toggle-pw:hover {
    color: #00476B;
}

.abho-cpf-login__toggle-pw--visible {
    color: #0098D9;
}

/* =========================================================================
   Errors
   ========================================================================= */
.abho-cpf-login__error {
    margin-top: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    color: #c0392b;
    background: #fdf0ef;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    line-height: 1.4;
}

/* =========================================================================
   Primary Button
   ========================================================================= */
.abho-cpf-login__btn {
    display: block;
    width: 100%;
    padding: 13px 20px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: #ffffff;
    background: #00476B;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-align: center;
    line-height: 1.4;
}

.abho-cpf-login__btn:hover {
    background: #003854;
}

.abho-cpf-login__btn:active {
    transform: scale(0.98);
}

.abho-cpf-login__btn:disabled {
    background: #93b3c5;
    cursor: not-allowed;
    transform: none;
}

/* =========================================================================
   Links
   ========================================================================= */
.abho-cpf-login__links {
    text-align: center;
    margin-top: 18px;
    font-size: 0.85rem;
    color: #666;
}

.abho-cpf-login__links a,
.abho-cpf-login__link-btn {
    color: #0098D9;
    text-decoration: none;
    font-weight: 500;
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    cursor: pointer;
    font-family: inherit;
}

.abho-cpf-login__links a:hover,
.abho-cpf-login__link-btn:hover {
    color: #00476B;
    text-decoration: underline;
}

.abho-cpf-login__separator {
    margin: 0 8px;
    color: #ccc;
}

/* Back button */
.abho-cpf-login__back {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 18px;
    padding: 10px;
    background: none;
    border: 1px solid #e2e6ea;
    border-radius: 10px;
    color: #666;
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.abho-cpf-login__back:hover {
    border-color: #0098D9;
    color: #0098D9;
}

/* =========================================================================
   Account Cards (Step 2 — Selection)
   ========================================================================= */
.abho-cpf-login__accounts {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.abho-cpf-login__account-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: #f8f9fb;
    border: 2px solid #e2e6ea;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
    width: 100%;
    box-sizing: border-box;
}

.abho-cpf-login__account-card:hover {
    border-color: #0098D9;
    box-shadow: 0 2px 12px rgba(0, 152, 217, 0.12);
    transform: translateY(-1px);
}

.abho-cpf-login__account-card:active {
    transform: translateY(0);
}

/* Account main info */
.abho-cpf-login__account-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.3;
}

.abho-cpf-login__account-email {
    font-size: 0.85rem;
    color: #888;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    letter-spacing: 0.3px;
}

.abho-cpf-login__account-matricula {
    font-size: 0.8rem;
    color: #666;
}

/* Account metadata */
.abho-cpf-login__account-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.abho-cpf-login__account-sub {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    line-height: 1.4;
}

/* Status colors */
.abho-cpf-login__sub-status--active {
    color: #0e6245;
    background: #e6f7ef;
}

.abho-cpf-login__sub-status--pending,
.abho-cpf-login__sub-status--on-hold {
    color: #856404;
    background: #fff8e1;
}

.abho-cpf-login__sub-status--expired,
.abho-cpf-login__sub-status--cancelled,
.abho-cpf-login__sub-status--none {
    color: #888;
    background: #f0f0f0;
}

.abho-cpf-login__status-icon {
    flex-shrink: 0;
}

.abho-cpf-login__status-icon--active {
    color: #27ae60;
}

.abho-cpf-login__status-icon--pending {
    color: #f39c12;
}

.abho-cpf-login__status-icon--none {
    color: #999;
}

.abho-cpf-login__account-orders {
    font-size: 0.78rem;
    color: #666;
    font-weight: 500;
}

.abho-cpf-login__account-date {
    font-size: 0.78rem;
    color: #999;
    white-space: nowrap;
}

/* =========================================================================
   Selected Account (Step 3 — Password)
   ========================================================================= */
.abho-cpf-login__selected-account {
    text-align: center;
    padding: 14px 16px;
    margin-bottom: 20px;
    background: #f0f6fb;
    border-radius: 10px;
    border: 1px solid #d6e7f2;
}

.abho-cpf-login__selected-name {
    font-size: 1rem;
    font-weight: 600;
    color: #00476B;
    margin-bottom: 2px;
}

.abho-cpf-login__selected-email {
    font-size: 0.82rem;
    color: #666;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* =========================================================================
   Loading Overlay
   ========================================================================= */
.abho-cpf-login__loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    z-index: 10;
}

.abho-cpf-login__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e6ea;
    border-top-color: #0098D9;
    border-radius: 50%;
    animation: abho-spin 0.7s linear infinite;
}

@keyframes abho-spin {
    to { transform: rotate(360deg); }
}

/* =========================================================================
   Force Elementor / WooCommerce parents to full width for centering
   (CSS only loaded on my-account page when not logged in, so safe to
   target .elementor-widget-wc-elements directly — no :has() needed)
   ========================================================================= */
.elementor-widget-wc-elements {
    width: 100% !important;
    max-width: 100% !important;
}

.elementor-widget-wc-elements > .elementor-widget-container,
.elementor-widget-wc-elements .woocommerce {
    width: 100%;
}

/* =========================================================================
   Document type hint (CPF/CNPJ)
   ========================================================================= */
.abho-cpf-login__doc-hint {
    font-size: 12px;
    line-height: 1.4;
    margin-top: 6px;
    min-height: 17px;
    color: #6b7280;
    transition: color 0.2s;
}
.abho-cpf-login__doc-hint--cpf {
    color: #0098D9;
}
.abho-cpf-login__doc-hint--cnpj {
    color: #7c3aed;
}

/* =========================================================================
   PJ Fields (Razão Social)
   ========================================================================= */
.abho-cpf-login__pj-field {
    animation: abhoFadeIn 0.3s ease;
}
@keyframes abhoFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   Document display (read-only in registration)
   ========================================================================= */
.abho-cpf-login__cpf-display {
    padding: 10px 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    letter-spacing: 0.5px;
}

/* =========================================================================
   Company name in account cards
   ========================================================================= */
.abho-cpf-login__account-company {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

/* =========================================================================
   Company name in selected account (password step)
   ========================================================================= */
.abho-cpf-login__selected-company {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 2px;
}

/* =========================================================================
   Override: Reset the my-account grid when showing login form
   When not logged in, .woocommerce has grid 280px+1fr from my-account.css
   which puts the login form in a grid cell instead of centering it.
   WordPress adds .logged-in to <body> when authenticated.
   ========================================================================= */
body.woocommerce-account:not(.logged-in) .woocommerce {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    grid-template-columns: none !important;
    max-width: none !important;
    padding: 0 !important;
    gap: 0 !important;
}

/* Hide WC notices wrapper when empty (avoids extra gap) */
body.woocommerce-account:not(.logged-in) .woocommerce > .woocommerce-notices-wrapper:empty {
    display: none !important;
}

/* =========================================================================
   Page-level centering wrapper
   ========================================================================= */
.abho-cpf-login-page {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: calc(100vh - 200px);
    padding: 40px 16px;
    box-sizing: border-box;
}

/* =========================================================================
   Registration Type Cards (Step 4)
   ========================================================================= */
.abho-cpf-login__register-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}

.abho-cpf-login__register-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 18px 16px;
    background: #f8f9fb;
    border: 2px solid #e2e6ea;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
    box-sizing: border-box;
}

.abho-cpf-login__register-card:hover {
    border-color: #0098D9;
    box-shadow: 0 2px 12px rgba(0, 152, 217, 0.12);
    transform: translateY(-1px);
}

.abho-cpf-login__register-card:active {
    transform: translateY(0);
}

.abho-cpf-login__register-card--member {
    border-color: #0098D9;
    background: #f0f8fd;
}

.abho-cpf-login__register-card--member:hover {
    border-color: #00476B;
    box-shadow: 0 2px 16px rgba(0, 71, 107, 0.15);
}

.abho-cpf-login__register-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #e8ecf0;
    color: #00476B;
}

.abho-cpf-login__register-card--member .abho-cpf-login__register-icon {
    background: #0098D9;
    color: #fff;
}

.abho-cpf-login__register-text,
.abho-cpf-login__register-info {
    flex: 1;
    min-width: 0;
}

.abho-cpf-login__register-text strong,
.abho-cpf-login__register-info strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 2px;
}

.abho-cpf-login__register-text span,
.abho-cpf-login__register-info span {
    display: block;
    font-size: 0.8rem;
    color: #777;
    line-height: 1.3;
}

.abho-cpf-login__register-arrow {
    flex-shrink: 0;
    color: #bbb;
    transition: color 0.2s, transform 0.2s;
}

.abho-cpf-login__register-card:hover .abho-cpf-login__register-arrow {
    color: #0098D9;
    transform: translateX(2px);
}

/* =========================================================================
   Registration Form (Step 5)
   ========================================================================= */
.abho-cpf-login__form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
}

.abho-cpf-login__form-grid .abho-cpf-login__field {
    margin-bottom: 16px;
}

.abho-cpf-login__field--full {
    grid-column: 1 / -1;
}

/* CPF display (read-only) */
.abho-cpf-login__cpf-display {
    display: block;
    width: 100%;
    padding: 12px 14px;
    font-size: 1.05rem;
    color: #666;
    background: #eef1f4;
    border: 2px solid #e2e6ea;
    border-radius: 10px;
    box-sizing: border-box;
    cursor: not-allowed;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* CEP + Número layout */
.abho-cpf-login__cep-row {
    display: grid;
    grid-template-columns: 1fr 100px;
    gap: 14px;
    grid-column: 1 / -1;
}

/* Address auto-display */
.abho-cpf-login__address-auto {
    grid-column: 1 / -1;
    padding: 10px 14px;
    background: #f0f8fd;
    border: 1px solid #d6e7f2;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: abho-fade-in 0.3s ease;
}

.abho-cpf-login__address-auto svg {
    flex-shrink: 0;
    margin-top: 1px;
    color: #0098D9;
}

.abho-cpf-login__address-text {
    font-size: 0.85rem;
    color: #444;
    line-height: 1.4;
}

@keyframes abho-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   Hide WooCommerce default login form
   ========================================================================= */
.abho-wc-login-original {
    display: none !important;
}

/* Also hide any potential WC login wrapper when our form is present */
.abho-cpf-login ~ .u-columns,
.abho-cpf-login ~ .woocommerce-form-login,
.abho-cpf-login ~ form.woocommerce-form-login {
    display: none !important;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 480px) {
    .abho-cpf-login-page {
        padding: 20px 12px;
        min-height: auto;
        align-items: flex-start;
    }

    .abho-cpf-login {
        margin: 0;
        padding: 28px 20px;
        border-radius: 12px;
        width: 100%;
    }

    .abho-cpf-login__title {
        font-size: 1.2rem;
    }

    .abho-cpf-login__account-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .abho-cpf-login__logo img {
        height: 40px !important;
    }

    .abho-cpf-login__form-grid {
        grid-template-columns: 1fr;
    }

    .abho-cpf-login__cep-row {
        grid-template-columns: 1fr 90px;
    }

    .abho-cpf-login__register-card {
        padding: 14px 12px;
    }
}
