/* ======================================================================
   PepStore Theme — Off-Canvas Drawers CSS
   ====================================================================== */

/* ─── Drawer Base Components ─── */
.pepstore-drawer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    justify-content: flex-end;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.3s, opacity 0.3s ease;
}

.pepstore-drawer.is-open {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s 0s, opacity 0.3s ease;
}

.pepstore-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.pepstore-drawer__panel {
    position: relative;
    /* User requested 1/5 of the screen, we'll use 20% but with a reasonable min/max width for usability */
    width: 20%;
    min-width: 320px;
    max-width: 450px;
    height: 100vh;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .pepstore-drawer__panel {
        width: 100%;
        max-width: 100%;
    }
}

.pepstore-drawer.is-open .pepstore-drawer__panel {
    transform: translateX(0);
}

.pepstore-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.pepstore-drawer__title {
    font-size: var(--text-lg);
    font-family: var(--font-primary);
    font-weight: var(--fw-bold);
    margin: 0;
}

.pepstore-drawer__close {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--space-2);
    margin: calc(var(--space-2) * -1);
    transition: color var(--transition-fast);
}

.pepstore-drawer__close:hover {
    color: var(--color-primary);
}

.pepstore-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
}

/* ─── Cart Drawer Specifics ─── */
.widget_shopping_cart_content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.widget_shopping_cart_content.has-optimistic-cart-items .woocommerce-mini-cart__empty-message {
    display: none;
}

.pepstore-mini-cart-pending {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.pepstore-mini-cart-pending__label {
    margin: 0;
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.pepstore-mini-cart-pending__items {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.pepstore-mini-cart-pending__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.pepstore-mini-cart-pending__thumb {
    position: relative;
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    overflow: hidden;
    background: #dfe3ea;
}

.pepstore-mini-cart-pending__thumb::after,
.pepstore-mini-cart-pending__title::after,
.pepstore-mini-cart-pending__meta::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transform: translateX(-100%);
    animation: pepstore-cart-pending-shimmer 1.1s ease-in-out infinite;
}

.pepstore-mini-cart-pending__content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.pepstore-mini-cart-pending__title,
.pepstore-mini-cart-pending__meta {
    position: relative;
    display: block;
    overflow: hidden;
    color: transparent;
    background: #d3d9e3;
}

.pepstore-mini-cart-pending__title {
    width: min(100%, 16rem);
    height: 0.95rem;
}

.pepstore-mini-cart-pending__meta {
    width: min(70%, 9rem);
    height: 0.75rem;
    background: #dbe0e8;
}

@keyframes pepstore-cart-pending-shimmer {
    100% {
        transform: translateX(100%);
    }
}

.pepstore-drawer .woocommerce-mini-cart {
    flex: 1;
    padding: 0;
    margin: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.pepstore-drawer .woocommerce-mini-cart__empty-message {
    margin: auto;
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.pepstore-drawer .woocommerce-mini-cart-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    position: relative;
}

.pepstore-drawer .woocommerce-mini-cart-item img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 0;
}

.pepstore-drawer .mini_cart_item_details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.pepstore-drawer .woocommerce-mini-cart-item a:not(.remove_from_cart_button) {
    font-family: var(--font-primary);
    font-weight: var(--fw-medium);
    font-size: var(--text-sm);
    color: var(--color-text);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pepstore-drawer .woocommerce-mini-cart-item a:hover:not(.remove_from_cart_button) {
    color: var(--color-primary);
}

.pepstore-drawer .quantity {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    font-weight: var(--fw-bold);
}

.pepstore-drawer .quantity .amount {
    color: var(--color-primary);
}

.pepstore-drawer .remove_from_cart_button {
    position: absolute;
    top: 0;
    right: 0;
    color: var(--color-text-muted) !important;
    font-size: var(--text-xl);
    line-height: 1;
    text-decoration: none !important;
    transition: color var(--transition-fast);
}

.pepstore-drawer .remove_from_cart_button:hover {
    color: var(--color-sale) !important;
    background: transparent !important;
}

.pepstore-drawer .woocommerce-mini-cart__total {
    margin-top: auto;
    padding-top: var(--space-6);
    border-top: 1.5px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--fw-bold);
    color: var(--color-text);
}

.pepstore-drawer .woocommerce-mini-cart__total .amount {
    font-size: var(--text-xl);
    color: var(--color-primary);
}

.pepstore-drawer .woocommerce-mini-cart__buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-5);
    padding: 0;
}

.pepstore-drawer .woocommerce-mini-cart__buttons .button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    padding: var(--space-3) var(--space-4) !important;
    font-family: var(--font-primary) !important;
    font-size: var(--text-sm) !important;
    font-weight: var(--fw-bold) !important;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1;
    border-radius: var(--radius-full) !important;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast) !important;
}

.pepstore-drawer .woocommerce-mini-cart__buttons .button:not(.checkout) {
    background: transparent !important;
    color: var(--color-text) !important;
    border: 1px solid var(--color-border) !important;
}

.pepstore-drawer .woocommerce-mini-cart__buttons .button:not(.checkout):hover {
    border-color: var(--color-primary) !important;
    color: var(--color-primary) !important;
}

.pepstore-drawer .woocommerce-mini-cart__buttons .checkout {
    background: var(--color-primary) !important;
    color: #fff !important;
    border: 1px solid var(--color-primary) !important;
}

.pepstore-drawer .woocommerce-mini-cart__buttons .checkout:hover {
    background: var(--color-primary-dark) !important;
    border-color: var(--color-primary-dark) !important;
}

/* ─── Account Drawer Auth (Login / Register flip) ─── */

/* Remove top margin from .pepstore-auth-card__title inside the drawer */
.pepstore-drawer__body--account .pepstore-auth-card__title {
    margin-top: var(--space-2);
}

/* Ensure inputs inside the drawer use the full width */
.pepstore-drawer__body--account .pepstore-input {
    background: var(--color-surface, #fff);
}

/* Compact the form a little — fields are already labelled */
.pepstore-drawer__body--account .pepstore-form-group {
    margin-bottom: var(--space-3);
}

/* The Log in / Register button inside the drawer */
.pepstore-drawer-auth__notices {
    margin-bottom: var(--space-4);
}

.pepstore-drawer-auth__notices .woocommerce-error,
.pepstore-drawer-auth__notices .woocommerce-message,
.pepstore-drawer-auth__notices .woocommerce-info,
.pepstore-drawer-auth__notices .woocommerce-NoticeGroup {
    margin: 0;
    padding: 1rem 1.125rem;
    border: 1px solid rgba(153, 27, 27, 0.14);
    border-left: 4px solid #b91c1c;
    border-radius: calc(var(--radius-lg) + 2px);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(254, 242, 242, 0.98)),
        #fff5f5;
    box-shadow: 0 16px 34px rgba(127, 29, 29, 0.08);
}

.pepstore-drawer-auth__notices .woocommerce-error {
    color: #7f1d1d;
}

.pepstore-drawer-auth__notices .woocommerce-error::before,
.pepstore-drawer-auth__notices .woocommerce-message::before,
.pepstore-drawer-auth__notices .woocommerce-info::before {
    display: none;
}

.pepstore-drawer-auth__notices ul,
.pepstore-drawer-auth__notices ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pepstore-drawer-auth__notices li {
    margin: 0;
    padding: 0;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.pepstore-drawer-auth__notices li strong:first-child {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #991b1b;
}

.pepstore-drawer-auth__notices a {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.8rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(185, 28, 28, 0.08);
    color: #991b1b;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.pepstore-drawer-auth__notices a:hover {
    background: rgba(185, 28, 28, 0.14);
    color: #7f1d1d;
}

.pepstore-drawer__body--account .pepstore-btn--primary {
    margin-top: var(--space-1);
}

/* ─── Logged-in Account Panel ─────────────────────────────────────────── */

/* Greeting */
.pepstore-account-panel__greeting {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) 0 var(--space-5);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-4);
}

.pepstore-account-panel__avatar-img {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--color-primary);
}

.pepstore-account-panel__hello {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 0 0 2px;
}

.pepstore-account-panel__name {
    font-family: var(--font-primary);
    font-weight: var(--fw-bold);
    font-size: var(--text-lg);
    color: var(--color-text);
    margin: 0 0 2px;
}

.pepstore-account-panel__email {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin: 0;
    word-break: break-all;
}

/* Quick stat */
.pepstore-account-panel__stats {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.pepstore-account-panel__stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    text-align: center;
}

.pepstore-account-panel__stat-num {
    font-family: var(--font-primary);
    font-weight: var(--fw-bold);
    font-size: var(--text-2xl, 1.5rem);
    color: var(--color-primary);
    line-height: 1.1;
}

.pepstore-account-panel__stat-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-top: 2px;
}

/* Nav links */
.pepstore-account-panel__nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pepstore-account-panel__nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.pepstore-account-panel__nav-item svg:first-child {
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.pepstore-account-panel__nav-item:hover {
    background: var(--color-surface);
    color: var(--color-primary);
}

.pepstore-account-panel__nav-item:hover svg:first-child {
    color: var(--color-primary);
}

.pepstore-account-panel__nav-item span {
    flex: 1;
}

.pepstore-account-panel__chevron {
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.pepstore-account-panel__nav-item:hover .pepstore-account-panel__chevron {
    transform: translateX(3px);
    color: var(--color-primary);
}

/* Logout */
.pepstore-account-panel__footer {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.pepstore-account-panel__logout {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--color-text-muted);
    transition: color var(--transition-fast), background var(--transition-fast);
    width: fit-content;
}

.pepstore-account-panel__logout:hover {
    color: var(--color-sale, #e53e3e);
    background: rgba(229, 62, 62, 0.07);
}
