/* =========================================================
   WQB — Mi Cuenta Dashboard
   Cargado SOLO en la página de cuenta (enqueue condicional).
   Por eso podemos usar .wqb-main directamente sin body class.
   ========================================================= */

/* ── Forzar ancho completo en este page ──────────────────── */
.wqb-main {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}
.wqb-main > *,
.wqb-main .wp-block-group,
.wqb-main .wp-block-group__inner-container,
.wqb-main .is-layout-constrained,
.wqb-main .is-layout-flow,
.wqb-main .entry-content,
.wqb-main .wp-block-freeform {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
}

/* ── Wrapper exterior (fondo blanco, ocupa 100%) ────────── */
.wqb-account-wrap {
    width: 100%;
    background: #fff;
    min-height: 100vh;
    padding: 32px 0 64px;
    box-sizing: border-box;
}

/* ── Dashboard centrado ──────────────────────────────────── */
.wqb-dash {
    max-width: 1360px;
    margin: 0 auto;
    padding: 0 40px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Hero ────────────────────────────────────────────────── */
.wqb-dash__hero {
    background: linear-gradient(135deg, #e53935 0%, #b71c1c 100%);
    border-radius: 14px;
    margin-bottom: 24px;
    color: #fff;
    padding: 28px 28px 24px;
}
.wqb-dash__hero-inner { display: flex; align-items: center; gap: 18px; }
.wqb-dash__avatar {
    width: 72px; height: 72px; border-radius: 50%;
    background: rgba(255,255,255,.25);
    border: 3px solid rgba(255,255,255,.5);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 800; flex-shrink: 0; letter-spacing: -1px;
    color: #fff;
}
.wqb-dash__hero-info { flex: 1; min-width: 0; }
.wqb-dash__name  { margin: 0 0 2px; font-size: 20px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wqb-dash__email { margin: 0 0 2px; font-size: 13px; color: rgba(255,255,255,.85); }
.wqb-dash__since { margin: 0; font-size: 12px; color: rgba(255,255,255,.7); }
.wqb-dash__logout {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px;
    background: rgba(255,255,255,.18); color: #fff; font-size: 13px; font-weight: 600;
    text-decoration: none; transition: background .2s; white-space: nowrap; flex-shrink: 0;
}
.wqb-dash__logout:hover { background: rgba(255,255,255,.3); color: #fff; }

/* ── Notices ─────────────────────────────────────────────── */
.wqb-dash__notice { padding: 12px 18px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; font-weight: 500; }
.wqb-dash__notice--ok  { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #43a047; }
.wqb-dash__notice--err { background: #fce4ec; color: #b71c1c; border-left: 4px solid #e53935; }

/* ── Body: sidebar + panel ───────────────────────────────── */
.wqb-dash__body {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    align-items: start;
}

/* ── Sidebar nav ─────────────────────────────────────────── */
.wqb-dash__nav {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    position: sticky;
    top: 80px;
}
.wqb-dash__nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 18px; font-size: 14px; font-weight: 500;
    color: #495057; text-decoration: none;
    border-bottom: 1px solid #f0f2f5; transition: .15s;
}
.wqb-dash__nav-item:last-child { border-bottom: none; }
.wqb-dash__nav-item .dashicons { font-size: 18px; width: 18px; height: 18px; color: #868e96; flex-shrink: 0; }
.wqb-dash__nav-item:hover { background: #f8f9fa; color: #e53935; }
.wqb-dash__nav-item:hover .dashicons { color: #e53935; }
.wqb-dash__nav-item.is-active { background: #fff5f5; color: #e53935; font-weight: 700; border-left: 3px solid #e53935; }
.wqb-dash__nav-item.is-active .dashicons { color: #e53935; }
.wqb-dash__nav-badge {
    margin-left: auto; background: #e53935; color: #fff;
    font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 20px;
}

/* ── Panel ───────────────────────────────────────────────── */
.wqb-dash__panel { min-width: 0; }
.wqb-dash__section-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; color: #1d2327; }

/* ── Stats ───────────────────────────────────────────────── */
.wqb-dash__stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 20px; }
.wqb-dash__stat {
    background: #fff; border: 1px solid #e9ecef; border-radius: 12px;
    padding: 20px 16px; text-align: center; transition: .2s;
}
.wqb-dash__stat:hover { border-color: #e53935; }
.wqb-dash__stat-num { display: block; font-size: 32px; font-weight: 800; color: #e53935; line-height: 1; }
.wqb-dash__stat-lbl { display: block; font-size: 12px; color: #868e96; margin-top: 6px; font-weight: 500; }

/* ── Quick actions ───────────────────────────────────────── */
.wqb-dash__quick-actions { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 20px; }
.wqb-dash__quick {
    background: #fff; border: 1px solid #e9ecef; border-radius: 10px;
    padding: 14px 10px; display: flex; flex-direction: column; align-items: center;
    gap: 8px; text-decoration: none; color: #495057; font-size: 12px; font-weight: 600;
    transition: .2s; text-align: center;
}
.wqb-dash__quick:hover { border-color: #e53935; color: #e53935; background: #fff5f5; }
.wqb-dash__quick .dashicons { font-size: 22px; width: 22px; height: 22px; }

/* ── Card ────────────────────────────────────────────────── */
.wqb-dash__card { background: #fff; border: 1px solid #e9ecef; border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.wqb-dash__card-hdr {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid #f0f2f5;
}
.wqb-dash__card-hdr strong { font-size: 14px; }
.wqb-dash__card-hdr a { font-size: 13px; color: #e53935; text-decoration: none; }

/* ── Order rows ──────────────────────────────────────────── */
.wqb-dash__order-row {
    display: flex; align-items: center; gap: 10px; padding: 10px 0;
    border-bottom: 1px solid #f8f9fa; font-size: 13px;
}
.wqb-dash__order-row:last-child { border-bottom: none; padding-bottom: 0; }
.wqb-dash__order-id    { font-weight: 700; flex-shrink: 0; }
.wqb-dash__order-date  { color: #868e96; flex-shrink: 0; }
.wqb-dash__order-total { margin-left: auto; font-weight: 700; color: #e53935; flex-shrink: 0; }

.wqb-dash__order-full { padding: 16px 20px; border-bottom: 1px solid #f0f2f5; }
.wqb-dash__order-full:last-child { border-bottom: none; }
.wqb-dash__order-full-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-bottom: 6px; }
.wqb-dash__order-items { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.wqb-dash__order-item  { font-size: 12px; background: #f0f2f5; padding: 3px 10px; border-radius: 20px; color: #495057; }
.wqb-dash__order-addr  { font-size: 12px; color: #868e96; display: flex; align-items: center; gap: 4px; }

/* ── Badge ───────────────────────────────────────────────── */
.wqb-dash__badge {
    padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; flex-shrink: 0;
    background: color-mix(in srgb, var(--badge-color) 15%, transparent);
    color: var(--badge-color);
}

/* ── Forms ───────────────────────────────────────────────── */
.wqb-dash__form { display: flex; flex-direction: column; gap: 14px; }
.wqb-dash__form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wqb-dash__form-group { display: flex; flex-direction: column; gap: 5px; }
.wqb-dash__form-group label { font-size: 13px; font-weight: 600; color: #495057; }
.wqb-dash__input {
    width: 100%; padding: 10px 14px;
    border: 1px solid #dee2e6; border-radius: 8px;
    font-size: 14px; color: #1d2327; background: #fff;
    transition: border-color .2s, box-shadow .2s;
    font-family: inherit; box-sizing: border-box;
}
.wqb-dash__input:focus { outline: none; border-color: #e53935; box-shadow: 0 0 0 3px rgba(229,57,53,.12); }
.wqb-dash__form-footer { display: flex; align-items: center; padding-top: 4px; }

/* ── Info rows (seguridad) ───────────────────────────────── */
.wqb-dash__info-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #f5f5f5; font-size: 13px; color: #646970; }
.wqb-dash__info-row:last-child { border-bottom: none; }

/* ── Empty state ─────────────────────────────────────────── */
.wqb-dash__empty { text-align: center; padding: 48px 20px; color: #868e96; }
.wqb-dash__empty svg { opacity: .35; margin-bottom: 14px; display: block; margin-left: auto; margin-right: auto; }
.wqb-dash__empty p { font-size: 14px; margin-bottom: 16px; }

/* ── Tickets ─────────────────────────────────────────────── */
.wqb-dash__ticket-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-bottom: 1px solid #f0f2f5;
    text-decoration: none; color: inherit; transition: background .15s; gap: 12px;
}
.wqb-dash__ticket-row:last-child { border-bottom: none; }
.wqb-dash__ticket-row:hover { background: #fafafa; }
.wqb-dash__ticket-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.wqb-dash__ticket-id { font-size: 12px; color: #868e96; flex-shrink: 0; font-weight: 600; }
.wqb-dash__ticket-subject { font-size: 14px; font-weight: 600; color: #1d2327; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wqb-dash__ticket-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.wqb-dash__ticket-date { font-size: 12px; color: #868e96; }
.wqb-dash__ticket-msgs { font-size: 11px; color: #868e96; background: #f0f2f5; padding: 2px 8px; border-radius: 20px; }
.wqb-dash__ticket-hdr { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid #f0f2f5; background: #fafafa; flex-wrap: wrap; }
.wqb-dash__ticket-hdr strong { flex: 1; font-size: 14px; min-width: 0; }
.wqb-dash__back { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #646970; text-decoration: none; white-space: nowrap; }
.wqb-dash__back:hover { color: #e53935; }

/* ── Chat mensajes ───────────────────────────────────────── */
.wqb-dash__messages { max-height: 380px; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.wqb-dash__msg { max-width: 85%; }
.wqb-dash__msg--user  { align-self: flex-end; }
.wqb-dash__msg--admin { align-self: flex-start; }
.wqb-dash__msg-meta { font-size: 11px; color: #adb5bd; margin-bottom: 4px; }
.wqb-dash__msg--user .wqb-dash__msg-meta { text-align: right; }
.wqb-dash__msg-bubble { padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.wqb-dash__msg--user  .wqb-dash__msg-bubble { background: #e53935; color: #fff; border-radius: 12px 12px 2px 12px; }
.wqb-dash__msg--admin .wqb-dash__msg-bubble { background: #f0f2f5; color: #1d2327; border-radius: 12px 12px 12px 2px; }
.wqb-dash__reply-box { padding: 14px 20px; border-top: 1px solid #f0f2f5; background: #fafafa; }

/* ── Responsive ≤768px ───────────────────────────────────── */
@media (max-width: 768px) {
    .wqb-account-wrap { padding: 16px 12px 48px; }
    .wqb-dash__body { grid-template-columns: 1fr; }
    .wqb-dash__nav {
        position: static; display: flex; flex-wrap: nowrap;
        overflow-x: auto; -webkit-overflow-scrolling: touch;
        border-radius: 10px; gap: 0; scrollbar-width: none;
    }
    .wqb-dash__nav::-webkit-scrollbar { display: none; }
    .wqb-dash__nav-item {
        flex-direction: column; align-items: center; gap: 4px;
        padding: 10px 14px; font-size: 11px; white-space: nowrap;
        border-bottom: none; border-right: 1px solid #f0f2f5; min-width: 70px;
        text-align: center;
    }
    .wqb-dash__nav-item:last-child { border-right: none; }
    .wqb-dash__nav-item.is-active { border-left: none; border-bottom: 3px solid #e53935; }
    .wqb-dash__quick-actions { grid-template-columns: repeat(2,1fr); }
    .wqb-dash__form-row { grid-template-columns: 1fr; }
    .wqb-dash__hero { padding: 20px 16px; }
    .wqb-dash__hero-inner { gap: 12px; }
    .wqb-dash__avatar { width: 54px; height: 54px; font-size: 20px; }
    .wqb-dash__name { font-size: 17px; }
    .wqb-dash__logout { padding: 7px 12px; font-size: 12px; }
    .wqb-dash__messages { max-height: 280px; }
}
@media (max-width: 480px) {
    .wqb-dash__stats { gap: 8px; }
    .wqb-dash__stat { padding: 14px 8px; }
    .wqb-dash__stat-num { font-size: 24px; }
    .wqb-dash__ticket-date { display: none; }
    .wqb-dash__msg { max-width: 92%; }
}

/* =========================================================
   Mobile polish — Mi Cuenta
   Mejora visual para usuarios logueados en celular
   ========================================================= */
@media (max-width: 768px) {
    .wqb-account-wrap {
        background: #f6f7f9;
        padding: 12px 10px 40px;
    }

    .wqb-dash {
        padding: 0;
        width: 100%;
    }

    .wqb-dash__hero {
        border-radius: 18px;
        margin: 0 0 14px;
        padding: 18px;
        box-shadow: 0 12px 30px rgba(183,28,28,.20);
    }

    .wqb-dash__hero-inner {
        display: grid;
        grid-template-columns: 56px 1fr auto;
        gap: 12px;
        align-items: center;
    }

    .wqb-dash__avatar {
        width: 56px;
        height: 56px;
        font-size: 20px;
        box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
    }

    .wqb-dash__name {
        font-size: 18px;
        line-height: 1.15;
        margin-bottom: 4px;
    }

    .wqb-dash__email {
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .wqb-dash__since {
        font-size: 11px;
    }

    .wqb-dash__logout {
        width: 40px;
        height: 40px;
        padding: 0;
        justify-content: center;
        border-radius: 12px;
        background: rgba(255,255,255,.20);
    }

    .wqb-dash__logout svg {
        width: 18px;
        height: 18px;
    }

    .wqb-dash__logout {
        font-size: 0;
    }

    .wqb-dash__body {
        gap: 14px;
    }

    .wqb-dash__nav {
        background: transparent;
        border: 0;
        border-radius: 0;
        padding: 0 2px 4px;
        gap: 8px;
    }

    .wqb-dash__nav-item {
        min-width: 84px;
        border: 1px solid #e8eaee;
        border-radius: 14px;
        background: #fff;
        padding: 11px 10px;
        box-shadow: 0 4px 14px rgba(20,24,31,.05);
    }

    .wqb-dash__nav-item.is-active {
        border: 1px solid rgba(229,57,53,.25);
        border-bottom: 1px solid rgba(229,57,53,.25);
        background: #fff5f5;
        box-shadow: 0 8px 20px rgba(229,57,53,.12);
    }

    .wqb-dash__nav-badge {
        position: absolute;
        top: 5px;
        right: 7px;
    }

    .wqb-dash__panel {
        min-width: 0;
    }

    .wqb-dash__section-title {
        font-size: 19px;
        margin: 4px 2px 12px;
    }

    .wqb-dash__stats {
        grid-template-columns: repeat(3, minmax(0,1fr));
        gap: 8px;
        margin-bottom: 12px;
    }

    .wqb-dash__stat {
        border: 0;
        border-radius: 16px;
        padding: 15px 8px;
        box-shadow: 0 6px 18px rgba(20,24,31,.06);
    }

    .wqb-dash__stat-num {
        font-size: 25px;
    }

    .wqb-dash__stat-lbl {
        font-size: 11px;
        line-height: 1.2;
    }

    .wqb-dash__quick-actions {
        grid-template-columns: repeat(2, minmax(0,1fr));
        gap: 10px;
        margin-bottom: 14px;
    }

    .wqb-dash__quick,
    .wqb-dash__card {
        border: 0;
        border-radius: 18px;
        box-shadow: 0 6px 18px rgba(20,24,31,.06);
    }

    .wqb-dash__quick {
        min-height: 82px;
        justify-content: center;
        font-size: 13px;
    }

    .wqb-dash__card {
        padding: 16px;
        margin-bottom: 14px;
    }

    .wqb-dash__card-hdr {
        margin-bottom: 10px;
        padding-bottom: 10px;
    }

    .wqb-dash__order-row,
    .wqb-dash__order-full-top {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 6px 10px;
        align-items: center;
    }

    .wqb-dash__order-date {
        order: 3;
        font-size: 12px;
    }

    .wqb-dash__badge {
        justify-self: end;
    }

    .wqb-dash__order-total {
        margin-left: 0;
        justify-self: end;
        font-size: 14px;
    }

    .wqb-dash__order-full {
        padding: 16px;
        background: #fff;
    }

    .wqb-dash__order-items {
        margin-top: 10px;
    }

    .wqb-dash__order-addr {
        align-items: flex-start;
        line-height: 1.35;
    }

    .wqb-dash__form {
        gap: 13px;
    }

    .wqb-dash__form-group label {
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: .03em;
        color: #6b7280;
    }

    .wqb-dash__input {
        min-height: 46px;
        border-radius: 12px;
        font-size: 16px;
        background: #fbfbfc;
    }

    .wqb-dash__form-footer,
    .wqb-dash__reply-box .wqb-dash__form {
        flex-direction: column;
        align-items: stretch;
    }

    .wqb-dash__form-footer .wqb-btn,
    .wqb-dash__reply-box .wqb-btn {
        width: 100%;
        justify-content: center;
        min-height: 46px;
    }

    .wqb-dash__ticket-row {
        display: grid;
        grid-template-columns: 1fr;
        align-items: start;
        gap: 8px;
        padding: 15px 16px;
    }

    .wqb-dash__ticket-main {
        align-items: flex-start;
    }

    .wqb-dash__ticket-subject {
        white-space: normal;
        line-height: 1.35;
    }

    .wqb-dash__ticket-meta {
        justify-content: space-between;
        width: 100%;
        gap: 8px;
    }

    .wqb-dash__messages {
        padding: 14px;
        max-height: 340px;
    }

    .wqb-dash__msg {
        max-width: 94%;
    }

    .wqb-dash__msg-bubble {
        font-size: 13px;
        padding: 11px 13px;
    }

    .wqb-dash__info-row {
        align-items: flex-start;
        gap: 10px;
    }

    .wqb-dash__info-row strong {
        text-align: right;
        word-break: break-word;
    }
}

@media (max-width: 390px) {
    .wqb-dash__hero-inner {
        grid-template-columns: 48px 1fr auto;
    }

    .wqb-dash__avatar {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    .wqb-dash__name {
        font-size: 16px;
    }

    .wqb-dash__nav-item {
        min-width: 78px;
        font-size: 10px;
    }

    .wqb-dash__quick-actions {
        grid-template-columns: 1fr 1fr;
    }
}

/* =========================================================
   Mobile account menu fit — evita que el menú salga de pantalla
   ========================================================= */
@media (max-width: 768px) {
    .wqb-dash__nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        overflow: visible;
        padding: 0;
        width: 100%;
    }

    .wqb-dash__nav-item {
        min-width: 0;
        width: 100%;
        border-right: 0;
        padding: 10px 6px;
        gap: 5px;
        white-space: normal;
        line-height: 1.15;
        word-break: normal;
        overflow-wrap: anywhere;
        position: relative;
    }

    .wqb-dash__nav-item .dashicons {
        font-size: 19px;
        width: 19px;
        height: 19px;
    }

    .wqb-dash__nav-item.is-active {
        border-bottom: 1px solid rgba(229,57,53,.25);
    }
}

@media (max-width: 390px) {
    .wqb-dash__nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .wqb-dash__nav-item {
        min-width: 0;
        font-size: 11px;
        padding: 10px 6px;
    }
}
