/* ============================================================
   LAYOUT PRINCIPAL DA CONTA
============================================================ */
.user-dashboard {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.user-sidebar {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
}

.user-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}

.user-sidebar li {
    margin: 6px 0;
}

.user-sidebar li a {
    display: block;
    padding: 10px;
    border-radius: 6px;
    color: #1e3a5f;
    font-weight: 600;
}

.user-sidebar li a:hover,
.user-sidebar li a.active {
    background: #1e3a5f;
    color: #fff;
}

.user-content {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 30px;
    min-width: 0;
}

.conta-title {
    font-size: 1.8em;
    font-weight: 700;
    margin-bottom: 25px;
}
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}
/* ============================================================
   DADOS PESSOAIS (FORMULÁRIO)
============================================================ */
.conta-box {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 40px;
}

.conta-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px 40px;
}

.conta-field {
    min-width: 0;
}

.conta-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.conta-field input {
    width: 100%;
    padding: 12px;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
}

.conta-save-wrapper {
    grid-column: 1 / -1;
    margin-top: 10px;
}

.conta-btn {
    padding: 12px 25px;
    background: #1e3a5f;
    color: #fff;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    border: none;
}

.conta-btn:hover {
    background: #162c48;
}

/* ============================================================
   MORADAS – FORMULÁRIO
============================================================ */
.conta-address-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px 40px;
    width: 100%;
}

.conta-address-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.conta-address-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #111;
}

.conta-address-field input,
.conta-address-field select {
    width: 100%;
    padding: 12px;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.conta-address-field input:focus,
.conta-address-field select:focus {
    border-color: #1e3a5f;
    box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
    outline: none;
}

.conta-address-actions {
    grid-column: 1 / -1;
    margin-top: 20px;
    text-align: left;
}

.conta-address-btn {
    padding: 12px 25px;
    background: #1e3a5f;
    color: #fff;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.conta-address-btn:hover {
    background: #162c48;
}

.woocommerce-address-fields .form-row {
    margin-bottom: 0 !important;
}

.woocommerce-error {
    border: 1px solid #b91c1c !important;
    background: #fef2f2 !important;
    color: #7f1d1d !important;
    border-radius: 6px;
    padding: 12px 18px;
    font-size: 14px;
    margin-bottom: 20px;
}

.conta-address-field:first-of-type,
.conta-address-field:nth-of-type(2) {
    grid-column: span 1;
}

/* Cartão com a morada atual */
.conta-address-card {
    position: relative;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px 40px 16px 16px;
    background: #fafafa;
    margin-bottom: 20px;
}

.conta-address-card-body {
    font-size: 14px;
    line-height: 1.5;
}

.conta-address-card-remove {
    position: absolute;
    top: 8px;
    right: 8px;
}

.conta-address-card-remove-btn {
    border: none;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.conta-address-card-remove-btn:hover {
    color: #a00;
}

.conta-address-grid .form-row {
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
}

.conta-address-grid .woocommerce-input-wrapper,
.conta-address-grid input,
.conta-address-grid select {
    width: 100%;
}

/* ============================================================
   ENCOMENDAS – LISTA DE ORDERS / CARDS
============================================================ */
.pm-orders-wrapper {
    display: flex;
    flex-direction: column;
    gap: 25px;
    min-width: 0;
    max-width: 100%;
}

.pm-order-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
    transition: all .2s ease;
    border: 1px solid #e5e5e5;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.pm-order-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.14);
}

.pm-order-row {
    display: grid;
    grid-template-columns: 100px 150px 200px 120px minmax(0, 1fr);
    column-gap: 25px;
    align-items: flex-start;
    min-width: 0;
    max-width: 100%;
}

.pm-col {
    min-width: 0;
}

.pm-col .pm-label {
    display: block;
    font-size: 13px;
    opacity: 0.6;
    margin-bottom: 4px;
    font-weight: 500;
}

.pm-col .pm-value {
    font-size: 16px;
    font-weight: 600;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pm-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.pm-item-line {
    font-size: 12px;
    line-height: 1.3;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pm-stock {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
}

.pm-stock-ok {
    color: #0f7d0f;
    font-weight: 600;
}

.pm-stock-bad {
    color: #cc0000;
    font-weight: 600;
}

.pm-status {
    display: inline-flex;
    align-items: center;
    padding: 5px 15px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    max-width: 100%;
}

.pm-status-processing { background: #0073aa; }
.pm-status-completed  { background: #1fa800; }
.pm-status-on-hold    { background: #d9a600; }
.pm-status-pending    { background: #777; }
.pm-status-cancelled  { background: #d62828; }
.pm-status-refunded   { background: #6a0dad; }
.pm-status-failed     { background: #ff4e4e; }

/* ============================================================
   LOGIN / REGISTO (visitante)
============================================================ */
.user-login {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.user-login.pm-auth {
    min-height: calc(100vh - 220px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.pm-auth-inner {
    width: 100%;
    max-width: 520px;
    text-align: center;
}

.pm-auth-inner h1 {
    font-size: 1.9em;
    font-weight: 700;
    margin-bottom: 25px;
}

.pm-auth-inner .woocommerce {
    width: 100%;
}

.pm-auth-inner .u-columns.col2-set {
    width: 100%;
    margin: 0;
}

.pm-auth-inner .u-column1,
.pm-auth-inner .u-column2 {
    float: none !important;
    width: 100% !important;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 24px 32px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.06);
    text-align: left;
}

.pm-auth-inner .woocommerce form .form-row {
    margin-bottom: 12px;
}

.pm-auth-inner .woocommerce input.input-text {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 0.9rem;
    background: #fafafa;
    box-sizing: border-box;
}

.pm-auth-inner .woocommerce button.button {
    background: #1e3a5f;
    color: #fff;
    padding: 9px 20px;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

.pm-auth-inner .woocommerce button.button:hover {
    background: #264e87;
}

.pm-auth-links {
    margin-top: 18px;
    font-size: 0.9rem;
    text-align: center;
}

.pm-auth-links a {
    color: #1e3a5f;
    font-weight: 600;
    text-decoration: underline;
}

.pm-auth-links a:hover {
    color: #264e87;
}

.pm-auth-inner .register-benefits {
    background: #f5f7fb;
    border: 1px solid #dce3f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
}

.pm-auth-inner .register-benefits ul {
    margin: 0;
    padding-left: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ============================================================
   ENCOMENDAS – individuais
============================================================ */
.pmvo {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.pmvo__top-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 4px;
}

.pmvo__back-link,
.pmvo__invoice-link {
    display: inline-flex;
    align-items: center;
    color: #111;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.pmvo__back-link:hover,
.pmvo__back-link:focus,
.pmvo__invoice-link:hover,
.pmvo__invoice-link:focus {
    color: #111;
    text-decoration: underline;
}

.pmvo__summary {
    background: #fff;
    border: 1px solid #e7e7e7;
    border-radius: 14px;
    padding: 20px 24px;
    box-shadow: none;
}

.pmvo__summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}

.pmvo__summary-col {
    min-width: 0;
}

.pmvo__summary-col--status {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.pmvo__summary-col--status .pmvo__status {
    text-align: center;
}

.pmvo__label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    color: #6b6b6b;
    letter-spacing: 0.04em;
}

.pmvo__value {
    display: block;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.3;
    color: #111;
}

.pmvo__summary-col:first-child .pmvo__value,
.pmvo__summary-col:last-child .pmvo__value {
    font-weight: 600;
}

.pmvo__status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    white-space: nowrap;
}

.pmvo__status--processing {
    background: #0d79b7;
}

.pmvo__status--completed {
    background: #2cab17;
}

.pmvo__status--on-hold {
    background: #d38b00;
}

.pmvo__status--pending {
    background: #7a7a7a;
}

.pmvo__status--cancelled,
.pmvo__status--failed,
.pmvo__status--refunded {
    background: #b42318;
}

.pmvo__info-row {
    display: grid;
    grid-template-columns: 0.9fr 0.9fr 1.2fr;
    gap: 20px;
    align-items: start;
}

.pmvo__box {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.pmvo__box--compact {
    padding: 0;
}

.pmvo__title {
    margin: 0 0 14px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.25;
    color: #111;
}

.pmvo__address {
    font-size: 16px;
    line-height: 1.7;
    color: #111;
}

.pmvo__address p {
    margin: 0;
}

.pmvo__actions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pmvo__select,
.pmvo__textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    background: #fff;
    color: #111;
    font-size: 15px;
}

.pmvo__select {
    min-height: 42px;
    padding: 0 12px;
}

.pmvo__textarea {
    min-height: 140px;
    padding: 12px;
    resize: vertical;
}

.pmvo__select:focus,
.pmvo__textarea:focus {
    outline: none;
    border-color: #c8c8c8;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.pmvo__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    padding: 0 20px;
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    background: #f7f7f7;
    color: #222;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    box-shadow: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.pmvo__btn:hover {
    background: #f0f0f0;
    border-color: #d8d8d8;
    color: #111;
    text-decoration: none;
}

.pmvo__btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.pmvo__btn:active {
    background: #ececec;
    transform: scale(0.98);
}

.pmvo__items-block {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.pmvo__items {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pmvo__item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding: 0 0 22px;
    margin: 0 0 22px;
    border-bottom: 1px solid #e9e9e9;
}

.pmvo__item-main {
    min-width: 0;
    flex: 1;
}

.pmvo__item-name {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.3;
    color: #111;
}

.pmvo__item-name a {
    color: inherit;
    text-decoration: none;
}

.pmvo__item-name a:hover,
.pmvo__item-name a:focus {
    color: inherit;
    text-decoration: none;
}

.pmvo__item-meta {
    font-size: 16px;
    line-height: 1.5;
    color: #5f5f5f;
}

.pmvo__item-price {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.3;
    color: #111;
}

.pmvo__totals {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 360px;
    margin-left: auto;
    padding-top: 4px;
}

.pmvo__total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.pmvo__total-label,
.pmvo__total-value {
    font-size: 16px;
    line-height: 1.4;
    color: #111;
    font-weight: 400;
}

.pmvo__total-row--order_total .pmvo__total-label,
.pmvo__total-row--order_total .pmvo__total-value {
    font-size: 18px;
    font-weight: 700;
}

/* ============================================================
   USER MENU MOBILE / TABLET
============================================================ */
.user-mobile-header {
    display: none;
}

.user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 10px 14px;
    border: none;
    border-radius: 6px;
    background: #1e3a5f;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.user-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.user-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 980px) {
    html,
    body {
        overflow-x: hidden;
    }

    .user-dashboard {
        display: block;
        width: 100%;
        max-width: 100%;
        margin: 24px auto;
        padding: 0 14px;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .user-mobile-header {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        margin: 0 0 16px 0;
    }

    .user-menu-toggle {
        margin: 0;
    }

    .user-sidebar {
        position: fixed;
        top: 42%;
        left: 0;
        right: auto;
        transform: translate(-100%, -50%);
        width: min(72vw, 280px);
        max-width: 280px;
        max-height: calc(100vh - 48px);
        z-index: 2000;
        background: #fff;
        overflow-y: auto;
        overflow-x: hidden;
        transition: transform 0.3s ease;
        padding: 20px 16px;
        box-sizing: border-box;
        border: 1px solid #ddd;
        border-left: 0;
        border-radius: 0 14px 14px 0;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    }

    .user-sidebar.active {
        transform: translate(0, -50%);
    }

    .user-sidebar ul {
        margin: 0;
        padding: 0;
    }

    .user-sidebar li {
        margin: 0 0 8px 0;
    }

    .user-sidebar li:last-child {
        margin-bottom: 0;
    }

    .user-sidebar li a {
        padding: 12px 10px;
        font-size: 15px;
    }

    .user-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 20px 16px;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .conta-form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .conta-address-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .conta-address-btn,
    .conta-btn {
        width: 100%;
        text-align: center;
    }

    .pm-order-card {
        width: 100%;
        max-width: 100%;
        padding: 18px;
        box-sizing: border-box;
    }

    .pm-order-row {
        grid-template-columns: 1fr 1fr;
        gap: 18px 16px;
        width: 100%;
        max-width: 100%;
    }

    .pmvo__summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .pmvo__info-row {
        grid-template-columns: 1fr;
    }

    .pmvo__top-link {
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .user-dashboard {
        padding: 0 12px;
    }

    .user-mobile-header {
        margin-bottom: 14px;
    }

    .user-sidebar {
        width: min(78vw, 260px);
        max-width: 260px;
        padding: 18px 14px;
    }

    .user-content {
        padding: 18px 14px;
    }

    .conta-title {
        font-size: 1.55em;
        margin-bottom: 20px;
    }

    .pm-order-card {
        padding: 16px;
    }

    .pm-order-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .pm-items {
        gap: 6px;
    }

    .pmvo__summary {
        padding: 18px 20px;
    }

    .pmvo__summary-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .pmvo__top-link {
        align-items: stretch;
    }

    .pmvo__invoice-link {
        width: 100%;
    }

    .pmvo__item {
        flex-direction: column;
        gap: 10px;
    }

    .pmvo__item-price {
        white-space: normal;
    }

    .pmvo__totals {
        max-width: none;
        margin-left: 0;
    }

    .pmvo__textarea {
        min-height: 120px;
    }

    .user-login.pm-auth {
        min-height: auto;
        padding-top: 40px;
        padding-bottom: 40px;
    }

    .pm-auth-inner .u-column1,
    .pm-auth-inner .u-column2 {
        padding: 20px;
    }
}