/* =========================================================
   DP My Account Widget v2.2.0
   Breakpoints:
     Desktop  : > 768px  — split sidebar layout
     Tablet   : 481–768px — collapsed icon sidebar + tooltips
     Mobile   : ≤ 480px  — bottom nav bar (app-style)
   digitalpro.cc
   ========================================================= */

/* ── CSS Custom Properties ────────────────────────────────── */
.dp-maw__wrap {
    --dp-sidebar-bg:      #1a1a1a;
    --dp-accent:          #378ADD;
    --dp-accent-light:    #85B7EB;
    --dp-accent-bg:       rgba(55, 138, 221, 0.15);
    --dp-nav-color:       rgba(255, 255, 255, 0.55);
    --dp-nav-color-hover: rgba(255, 255, 255, 0.9);
    --dp-content-bg:      #ffffff;
    --dp-radius-wrap:     12px;
    --dp-bottom-nav-h:    64px;   /* height of mobile bottom bar */
}

/* ═══════════════════════════════════════════════════════════
   DESKTOP (> 768px) — split layout
═══════════════════════════════════════════════════════════ */

/* ── Wrapper ── */
.dp-maw__wrap {
    display: flex;
    align-items: stretch;
    border-radius: var(--dp-radius-wrap);
    overflow: visible; /* visible so tablet tooltips aren't clipped */
    border: 1px solid rgba(0, 0, 0, 0.08);
    min-height: 520px;
    position: relative;
    box-sizing: border-box;
}

/* Clip the border-radius without hiding tooltips on desktop/tablet */
.dp-maw__wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--dp-radius-wrap);
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    z-index: 1;
}

/* ── Sidebar ── */
.dp-maw__sidebar {
    width: 240px;
    flex-shrink: 0;
    background-color: var(--dp-sidebar-bg);
    padding: 2rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    box-sizing: border-box;
    border-radius: var(--dp-radius-wrap) 0 0 var(--dp-radius-wrap);
    position: relative;
    z-index: 2;
    overflow: visible;
}

/* User block */
.dp-maw__user-block {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.dp-maw__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--dp-accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
    letter-spacing: 0.02em;
    line-height: 1;
}

.dp-maw__user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    transition: opacity 0.2s ease;
}

.dp-maw__user-name {
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.dp-maw__user-email {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* ── Navigation ── */
.dp-maw__nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dp-maw__nav ul li {
    position: relative;
}

.dp-maw__nav ul li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px 9px 13px;
    border-radius: 7px;
    font-size: 13.5px;
    color: var(--dp-nav-color);
    text-decoration: none !important;
    border-left: 2px solid transparent;
    transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.dp-maw__nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.18s ease;
}

.dp-maw__nav-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.dp-maw__nav ul li a:hover {
    color: var(--dp-nav-color-hover);
    background-color: rgba(255, 255, 255, 0.06);
    border-left-color: rgba(255, 255, 255, 0.2);
}

.dp-maw__nav ul li a:hover .dp-maw__nav-icon {
    opacity: 1;
}

.dp-maw__nav ul li.is-active > a {
    color: var(--dp-accent-light);
    background-color: var(--dp-accent-bg);
    border-left-color: var(--dp-accent);
}

.dp-maw__nav ul li.is-active > a .dp-maw__nav-icon {
    opacity: 1;
}

/* Tooltip — hidden on desktop */
.dp-maw__nav-tooltip {
    display: none;
}

/* Logout */
.dp-maw__nav-logout {
    margin-top: auto;
    padding-top: 1.5rem;
}

.dp-maw__nav-logout a {
    color: rgba(255, 255, 255, 0.25) !important;
    font-size: 12px !important;
    border-left-color: transparent !important;
    background-color: transparent !important;
}

.dp-maw__nav-logout a:hover {
    color: rgba(255, 255, 255, 0.5) !important;
    background-color: transparent !important;
    border-left-color: transparent !important;
}

/* ── Content area ── */
.dp-maw__content {
    flex: 1;
    background-color: var(--dp-content-bg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
    box-sizing: border-box;
    border-radius: 0 var(--dp-radius-wrap) var(--dp-radius-wrap) 0;
}

/* ── Greeting ── */
.dp-maw__greeting {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.dp-maw__greeting-label {
    font-size: 11px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #999999;
    font-weight: 500;
    display: block;
}

.dp-maw__greeting-name {
    font-size: 22px;
    font-weight: 500;
    color: #111111;
    line-height: 1.2;
    display: block;
}

/* ── Stats ── */
.dp-maw__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.dp-maw__stat {
    background-color: #f7f7f6;
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-sizing: border-box;
}

.dp-maw__stat-number {
    font-size: 22px;
    font-weight: 500;
    color: #111111;
    line-height: 1;
    display: block;
}

.dp-maw__stat-label {
    font-size: 12px;
    color: #888888;
    display: block;
}

/* ── Panel (AJAX content) ── */
.dp-maw__panel {
    flex: 1;
    min-height: 80px;
    transition: opacity 0.2s ease;
}

.dp-maw__panel--loading {
    opacity: 0.45;
    pointer-events: none;
}

.dp-maw__loader {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #aaa;
    font-size: 13px;
    padding: 1rem 0;
}

.dp-maw__loader::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--dp-accent);
    border-radius: 50%;
    animation: dp-maw-spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

.dp-maw__error {
    color: #c0392b;
    font-size: 13px;
    padding: 0.5rem 0;
}

/* ── Bottom nav — hidden on desktop ── */
.dp-maw__bottom-nav {
    display: none;
}

/* ── WooCommerce content overrides ── */
.dp-maw__panel .woocommerce-MyAccount-content > p:first-child {
    margin-top: 0;
}

.dp-maw__panel table.shop_table {
    width: 100%;
    border-collapse: collapse;
    border: none;
    font-size: 14px;
}

.dp-maw__panel table.shop_table thead th {
    background-color: #f7f7f6;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
    font-weight: 600;
    padding: 8px 12px;
    border: none;
    text-align: left;
}

.dp-maw__panel table.shop_table tbody td {
    padding: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    vertical-align: middle;
}

.dp-maw__panel table.shop_table tbody tr:last-child td {
    border-bottom: none;
}

.dp-maw__panel mark.order-status {
    background-color: #f0f7ff;
    color: #185FA5;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 500;
    font-style: normal;
}

/* Forms */
.dp-maw__panel .woocommerce-address-fields,
.dp-maw__panel .woocommerce-EditAccountForm {
    max-width: 480px;
}

.dp-maw__panel .woocommerce-form-row {
    margin-bottom: 1rem;
}

.dp-maw__panel .woocommerce-form-row label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
    font-weight: 500;
}

.dp-maw__panel .woocommerce-form-row input,
.dp-maw__panel .woocommerce-form-row select,
.dp-maw__panel .woocommerce-form-row textarea {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background-color: #fff;
    color: #111;
    appearance: auto;
}

.dp-maw__panel .woocommerce-form-row input:focus,
.dp-maw__panel .woocommerce-form-row select:focus,
.dp-maw__panel .woocommerce-form-row textarea:focus {
    outline: none;
    border-color: var(--dp-accent);
    box-shadow: 0 0 0 3px rgba(55, 138, 221, 0.12);
}

.dp-maw__panel .woocommerce-Button,
.dp-maw__panel button[type="submit"],
.dp-maw__panel input[type="submit"] {
    display: inline-flex;
    align-items: center;
    background-color: var(--dp-accent);
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.1s ease;
    text-decoration: none !important;
    line-height: 1.4;
}

.dp-maw__panel .woocommerce-Button:hover,
.dp-maw__panel button[type="submit"]:hover,
.dp-maw__panel input[type="submit"]:hover {
    background-color: #185FA5;
}

.dp-maw__panel .woocommerce-Button:active,
.dp-maw__panel button[type="submit"]:active,
.dp-maw__panel input[type="submit"]:active {
    transform: scale(0.98);
}

/* Login fallback */
.dp-maw__login-fallback {
    padding: 2rem;
    background: #fff;
    border-radius: var(--dp-radius-wrap);
    border: 1px solid rgba(0, 0, 0, 0.08);
}


/* ═══════════════════════════════════════════════════════════
   TABLET (481px – 768px) — collapsed icon sidebar + tooltips
═══════════════════════════════════════════════════════════ */
@media (min-width: 481px) and (max-width: 768px) {

    .dp-maw__wrap {
        min-height: 480px;
        overflow: visible;
    }

    /* Collapse sidebar to icon rail */
    .dp-maw__sidebar {
        width: 60px !important;
        padding: 1.5rem 0;
        align-items: center;
        overflow: visible;
    }

    /* Shrink avatar, hide name/email */
    .dp-maw__user-block {
        flex-direction: column;
        gap: 0;
        margin-bottom: 1.25rem;
        padding-bottom: 1.25rem;
        justify-content: center;
        overflow: visible;
    }

    .dp-maw__user-info {
        display: none;
    }

    .dp-maw__avatar {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }

    /* Icon-only nav */
    .dp-maw__nav {
        width: 100%;
    }

    .dp-maw__nav ul {
        align-items: center;
        gap: 4px;
        padding: 0 8px;
    }

    .dp-maw__nav ul li {
        width: 100%;
    }

    .dp-maw__nav ul li a {
        padding: 10px;
        border-left: none;
        border-radius: 8px;
        justify-content: center;
        gap: 0;
        overflow: visible;
    }

    /* Active: accent dot below icon instead of left border */
    .dp-maw__nav ul li.is-active > a {
        border-left-color: transparent;
        background-color: var(--dp-accent-bg);
        position: relative;
    }

    .dp-maw__nav ul li.is-active > a::after {
        content: '';
        position: absolute;
        bottom: 4px;
        left: 50%;
        transform: translateX(-50%);
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background-color: var(--dp-accent);
    }

    /* Hide text labels */
    .dp-maw__nav-label {
        display: none;
    }

    /* Tooltip — shown on tablet */
    .dp-maw__nav-tooltip {
        display: block;
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%);
        background-color: rgba(20, 20, 20, 0.92);
        color: #fff;
        font-size: 12px;
        white-space: nowrap;
        padding: 5px 10px;
        border-radius: 5px;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.15s ease, transform 0.15s ease;
        transform: translateY(-50%) translateX(-4px);
        z-index: 100;
        font-weight: 400;
        letter-spacing: 0.01em;
    }

    /* Tooltip arrow */
    .dp-maw__nav-tooltip::before {
        content: '';
        position: absolute;
        right: 100%;
        top: 50%;
        transform: translateY(-50%);
        border: 5px solid transparent;
        border-right-color: rgba(20, 20, 20, 0.92);
    }

    .dp-maw__nav ul li a:hover .dp-maw__nav-tooltip {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }

    /* Logout at bottom — icon only */
    .dp-maw__nav-logout {
        padding-top: 1rem;
        width: 100%;
        display: flex;
        justify-content: center;
    }

    /* Content: reduce padding */
    .dp-maw__content {
        padding: 1.5rem;
        gap: 1.25rem;
    }

    /* Greeting: slightly smaller */
    .dp-maw__greeting-name {
        font-size: 19px;
    }

    /* Stats: 3-col still works on tablet */
    .dp-maw__stats {
        gap: 8px;
    }

    .dp-maw__stat-number {
        font-size: 20px;
    }

    /* Forms: full width */
    .dp-maw__panel .woocommerce-address-fields,
    .dp-maw__panel .woocommerce-EditAccountForm {
        max-width: 100%;
    }

    /* Tables: allow horizontal scroll on small tablets */
    .dp-maw__panel {
        overflow-x: auto;
    }

    .dp-maw__panel table.shop_table {
        min-width: 420px;
    }
}


/* ═══════════════════════════════════════════════════════════
   MOBILE (≤ 480px) — bottom navigation bar
═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

    /* Wrapper becomes single column, no border-radius on bottom
       (bottom nav sits flush against it)                        */
    .dp-maw__wrap {
        flex-direction: column;
        border-radius: 8px 8px 0 0;
        min-height: unset;
        border-bottom: none;
        /* Extra padding so content isn't hidden behind the bottom nav */
        padding-bottom: var(--dp-bottom-nav-h);
    }

    /* Hide desktop sidebar entirely */
    .dp-maw__sidebar {
        display: none !important;
    }

    /* Content takes full width */
    .dp-maw__content {
        padding: 1.125rem 1rem;
        gap: 1rem;
        border-radius: 8px 8px 0 0;
    }

    /* Greeting */
    .dp-maw__greeting {
        padding-bottom: 1rem;
    }

    .dp-maw__greeting-label {
        font-size: 10px;
    }

    .dp-maw__greeting-name {
        font-size: 18px;
    }

    /* Stats: 2 columns on mobile */
    .dp-maw__stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .dp-maw__stat {
        padding: 10px 12px;
    }

    .dp-maw__stat-number {
        font-size: 18px;
    }

    .dp-maw__stat-label {
        font-size: 11px;
    }

    /* Tables: horizontal scroll */
    .dp-maw__panel {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dp-maw__panel table.shop_table {
        min-width: 360px;
        font-size: 13px;
    }

    .dp-maw__panel table.shop_table thead th {
        padding: 6px 8px;
    }

    .dp-maw__panel table.shop_table tbody td {
        padding: 10px 8px;
    }

    /* Forms: full width, larger tap targets */
    .dp-maw__panel .woocommerce-address-fields,
    .dp-maw__panel .woocommerce-EditAccountForm {
        max-width: 100%;
    }

    .dp-maw__panel .woocommerce-form-row input,
    .dp-maw__panel .woocommerce-form-row select,
    .dp-maw__panel .woocommerce-form-row textarea {
        padding: 11px 12px;
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    .dp-maw__panel .woocommerce-Button,
    .dp-maw__panel button[type="submit"],
    .dp-maw__panel input[type="submit"] {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 15px;
    }

    /* ── Bottom Navigation Bar ── */
    .dp-maw__bottom-nav {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--dp-bottom-nav-h);
        background-color: var(--dp-sidebar-bg);
        border-top: 1px solid rgba(255, 255, 255, 0.07);
        z-index: 9999;
        /* Safe area for iPhone home indicator */
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .dp-maw__bottom-nav ul {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        align-items: stretch;
        height: 100%;
    }

    .dp-maw__bottom-nav ul li {
        flex: 1;
        position: relative;
    }

    .dp-maw__bottom-nav ul li a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        height: 100%;
        color: rgba(255, 255, 255, 0.45);
        text-decoration: none !important;
        transition: color 0.15s ease;
        padding: 6px 4px;
        box-sizing: border-box;
    }

    .dp-maw__bottom-nav ul li a:active {
        background-color: rgba(255, 255, 255, 0.05);
    }

    .dp-maw__bottom-nav ul li.is-active > a {
        color: var(--dp-accent-light);
    }

    .dp-maw__bottom-nav-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
    }

    .dp-maw__bottom-nav-icon svg {
        width: 20px;
        height: 20px;
        display: block;
    }

    .dp-maw__bottom-nav-label {
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.02em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        text-align: center;
    }

    /* Active indicator dot above icon */
    .dp-maw__bottom-nav ul li.is-active > a::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 18px;
        height: 2px;
        border-radius: 2px;
        background-color: var(--dp-accent);
    }

    /* "More" overflow drawer */
    .dp-maw__more-menu {
        position: fixed;
        bottom: var(--dp-bottom-nav-h);
        left: 0;
        right: 0;
        background-color: #222222;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 16px 16px 0 0;
        padding: 1rem;
        z-index: 9998;
        transform: translateY(8px);
        opacity: 0;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .dp-maw__more-menu:not([hidden]) {
        transform: translateY(0);
        opacity: 1;
    }

    .dp-maw__more-menu ul {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .dp-maw__more-menu ul li a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 12px;
        border-radius: 8px;
        color: rgba(255, 255, 255, 0.7);
        text-decoration: none !important;
        font-size: 14px;
        transition: background-color 0.15s ease, color 0.15s ease;
    }

    .dp-maw__more-menu ul li a:hover,
    .dp-maw__more-menu ul li a:active {
        background-color: rgba(255, 255, 255, 0.07);
        color: #fff;
    }

    .dp-maw__more-menu .dp-maw__nav-icon {
        opacity: 0.7;
    }

    /* Backdrop for "More" menu */
    .dp-maw__more-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 9997;
    }

    .dp-maw__more-backdrop.is-visible {
        display: block;
    }
}
