/* ─── Strip GP content constraints on our pages ─────────────────────────── */
.as-page-dashboard .site-content,
.as-page-dashboard .content-area,
.as-page-dashboard .entry-content,
.as-page-dashboard .inside-article,
.as-page-home .site-content,
.as-page-home .content-area,
.as-page-home .entry-content,
.as-page-home .inside-article,
.as-page-view-all .site-content,
.as-page-view-all .content-area,
.as-page-view-all .entry-content,
.as-page-view-all .inside-article {
    padding: 0 !important;
    max-width: 100% !important;
}

/* ─── Full-width blocks: break out of any container constraint ───────────
   Applies when a block is rendered inside a constrained content area.
   The home page uses standard GP layout, so these blocks need to escape it. */
.wp-block-astrostyle-login-hero,
.wp-block-astrostyle-astrotwins-section {
    width: 100vw;
    max-width: 100vw;
    /* Negative margin trick to escape parent padding/max-width */
    margin-left:  calc( -50vw + 50% );
    margin-right: calc( -50vw + 50% );
}

/* ─── View-all page wrapper ──────────────────────────────────────────────── */
.as-page-view-all .as-block-section {
    margin: 2rem auto;
}
.as-page-view-all .wp-block-astrostyle-order-history,
.as-page-view-all .wp-block-astrostyle-downloads,
.as-page-view-all .wp-block-astrostyle-courses {
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Back link styling on view-all pages */
.as-page-view-all .entry-content > div:first-child {
    padding: 1.5rem 0 0;
    margin: 0 auto;
}

/* ─── Block spacing on dashboard ─────────────────────────────────────────── */
.as-page-dashboard .entry-content .as-block-section,
.as-page-dashboard .entry-content .as-block-loader,
.as-page-dashboard .entry-content .as-dashboard-header {
    margin-bottom: 28px;
}

/* ─── Consistent block style overrides ───────────────────────────────────── */

/* Force square corners everywhere */
.as-block-section,
.as-login-box,
.as-card,
.as-course-card,
.as-download-item,
.as-download-item__icon,
.as-sidebar-nav,
.as-natal-chip,
.as-badge,
.as-status-pill,
.as-btn,
.as-sk-card {
    border-radius: 0 !important;
}

/* Status pills keep a tiny bit of visual distinction without radius */
.as-status-pill {
    padding: 0.2rem 0.5rem;
    font-size: 0.65rem;
}

/* Profile form inputs */
.as-form-group input,
.as-form-group select,
.as-form-group textarea {
    border-radius: 0;
}

/* ─── Profile form styles ─────────────────────────────────────────────────── */
.as-profile-form .as-block-section__body { padding: 2rem; }

.as-profile-section {
    padding: 1.5rem 0;
    border-top: 1px solid var(--as-border);
}
.as-profile-section:first-of-type { border-top: none; padding-top: 0; }
.as-profile-section__title {
    font-family: var(--as-font-sans);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--as-text-mid);
    margin: 0 0 1.25rem;
}

.as-form-group--full { grid-column: 1 / -1; }

.as-form-hint {
    font-size: 0.72rem;
    color: var(--as-text-light);
    margin: 0.3rem 0 0;
}

.as-profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--as-border);
}
.as-profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--as-border);
    flex-shrink: 0;
    background: var(--as-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}
.as-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.as-profile-avatar-status { font-size: 0.78rem; color: var(--as-text-light); margin-top: 0.4rem; display: block; }

.as-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 600px) { .as-form-grid { grid-template-columns: 1fr; } }

.as-form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.as-form-group label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--as-text-mid);
}
.as-form-group input,
.as-form-group select {
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--as-border);
    font-family: var(--as-font-sans);
    font-size: 0.92rem;
    color: var(--as-dark);
    background: var(--as-cream);
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}
.as-form-group input:focus { border-color: var(--as-teal); background: var(--as-white); }

.as-password-accordion {
    margin-bottom: 1.5rem;
    border: 1px solid var(--as-border);
}
.as-password-accordion summary {
    padding: 0.75rem 1rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    background: var(--as-cream);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.as-password-accordion summary::after { content: '+'; font-size: 1rem; }
.as-password-accordion[open] summary::after { content: '−'; }
.as-password-accordion .as-form-grid { padding: 1.25rem; margin-bottom: 0; }

.as-form-actions { display: flex; align-items: center; gap: 1.5rem; }
.as-form-message { font-size: 0.82rem; }
.as-form-message--ok    { color: #2e7d32; }
.as-form-message--error { color: #c62828; }

/* ─── Order table row — clickable with eye icon ─────────────────────────── */
.as-order-row { cursor: pointer; transition: background 0.15s; }
.as-order-row:hover,
.as-order-row:focus-within { background: var(--as-cream); outline: none; }
.as-order-row:focus { outline: 2px solid var(--as-teal); outline-offset: -2px; }

.as-order-num {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
.as-order-eye {
    opacity: 0;
    transition: opacity 0.15s;
    color: var(--as-teal-dark);
    flex-shrink: 0;
    /* sits before the # */
    order: -1;
}
.as-order-row:hover .as-order-eye,
.as-order-row:focus .as-order-eye { opacity: 1; }

.as-order-items { color: var(--as-text-mid); font-size: 0.85rem; }

/* ─── Order detail modal ─────────────────────────────────────────────────── */
.as-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.as-modal[hidden] { display: none; }

.as-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(61, 31, 53, 0.45);
    backdrop-filter: blur(2px);
}

.as-modal__box {
    position: relative;
    z-index: 1;
    background: var(--as-white);
    width: 100%;
    max-width: 960px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(61, 31, 53, 0.2);
}

.as-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--as-border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: var(--as-white);
    z-index: 2;
}
.as-modal__title {
    font-family: var(--as-font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.as-modal__status { margin-left: 0.25rem; }
.as-btn--invoice {
    border: 2px solid var(--as-border);
}
.as-btn--invoice:hover {
    border-color: var(--as-dark);
}
.as-modal__close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--as-text-light);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.15s;
}
.as-modal__close:hover { color: var(--as-dark); }

.as-modal__body {
    overflow-y: auto;
    padding: 0 1.5rem 1.5rem;
    flex: 1;
}

.as-modal__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--as-border);
    font-size: 0.8rem;
    color: var(--as-text-mid);
}
.as-modal__note {
    font-style: italic;
    width: 100%;
    color: var(--as-text-light);
}

.as-modal__section { padding: 1.25rem 0; border-bottom: 1px solid var(--as-border); }
.as-modal__section:last-child { border-bottom: none; }
.as-modal__section-title {
    font-family: var(--as-font-sans);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--as-text-mid);
    margin: 0 0 0.85rem;
}

/* Items table */
.as-modal__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}
.as-modal__table thead th {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--as-text-light);
    padding: 0 0 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--as-border);
}
.as-modal__table tbody td {
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--as-border);
    vertical-align: top;
    color: var(--as-text);
}
.as-modal__table tbody tr:last-child td { border-bottom: none; }
.as-modal__item-thumb { width: 52px; padding-right: 0.75rem !important; vertical-align: middle; }
.as-modal__item-thumb img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    display: block;
    border: 1px solid var(--as-border);
}
.as-modal__product-link {
    color: inherit;
    text-decoration: none;
}
.as-modal__product-link:hover {
    color: var(--as-teal-dark);
}
.as-modal__item-thumb--empty { width: 52px; }

.as-modal__item-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--as-text-light);
    margin-top: 0.2rem;
}
.as-ta-r { text-align: right !important; }

/* Totals */
.as-modal__totals { border-top: 1px solid var(--as-border); }
.as-modal__total-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.87rem;
    padding: 0.35rem 0;
    color: var(--as-text-mid);
}
.as-modal__total-row:last-child {
    color: var(--as-dark);
    font-size: 0.95rem;
    padding-top: 0.65rem;
    margin-top: 0.3rem;
    border-top: 1px solid var(--as-border);
}

/* Downloads */
.as-modal__dl-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.as-modal__dl-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--as-cream);
    border: 1px solid var(--as-border);
}
.as-modal__dl-name { display: block; font-size: 0.87rem; font-weight: 600; color: var(--as-dark); }
.as-modal__dl-meta { display: block; font-size: 0.75rem; color: var(--as-text-light); margin-top: 0.15rem; }

/* Addresses */
.as-modal__addresses {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 2rem;
}
address { font-style: normal; font-size: 0.87rem; line-height: 1.7; color: var(--as-text-mid); }

/* Loading skeleton inside modal */
.as-modal__loading { padding: 2rem 0; }
.as-sk-line--loading-main { width: 60%; margin: 0 auto 0.75rem; }
.as-sk-line--loading-sub  { width: 40%; margin: 0 auto; }

@media ( max-width: 600px ) {
    .as-modal__addresses { grid-template-columns: 1fr; }
    .as-modal__box { max-height: 92vh; }
}

/* ─── Block footer (View all row) ───────────────────────────────────────── */
.as-block-footer {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--as-border);
}

/* ─── Error empty state ──────────────────────────────────────────────────── */
.as-empty-state--error .as-empty-state__icon,
.as-empty-state--error h3 { color: #c62828; }

.as-inline-feedback {
    margin-left: 0.6rem;
    font-size: 0.75rem;
}
.as-inline-feedback--error { color: #c62828; }

/* ─── Async block loader ─────────────────────────────────────────────────── */

/* Loader wrapper inherits display from its child skeleton card */
.as-block-loader { display: block; }

/* Skeleton shimmer keyframe */
@keyframes as-shimmer {
    0%   { background-position: -800px 0; }
    100% { background-position:  800px 0; }
}

.as-block-section--loading .as-block-section__body,
.as-sk-body {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.as-sk-body--retry { padding: 2rem; }

/* Generic shimmer mixin */
.as-sk-line,
.as-sk-cell,
.as-sk-icon,
.as-sk-thumb,
.as-sk-line--btn {
    background: linear-gradient(
        90deg,
        #f3ede6 25%,
        #e8e2d9 50%,
        #f3ede6 75%
    );
    background-size: 800px 100%;
    animation: as-shimmer 1.6s ease-in-out infinite;
    border-radius: 4px;
}

.as-sk-line            { height: 13px; width: 100%; }
.as-sk-line--short     { width: 55%; }
.as-sk-line--btn       { height: 28px; width: 80px; border-radius: 999px; }

/* Table skeleton */
.as-sk-row {
    display: grid;
    grid-template-columns: 80px 1fr 90px 70px 80px;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--as-border, #e8e2d9);
}
.as-sk-cell { height: 13px; border-radius: 4px; }

/* List skeleton */
.as-sk-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--as-border, #e8e2d9);
}
.as-sk-icon { width: 40px; height: 40px; border-radius: 6px; flex-shrink: 0; }
.as-sk-item > div:last-child { flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }

/* Grid skeleton */
.as-sk-grid {
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax(160px, 1fr) );
    gap: 1rem;
    padding: 0.25rem 0;
}
.as-sk-card { border: 1px solid var(--as-border, #e8e2d9); border-radius: 10px; overflow: hidden; }
.as-sk-thumb { height: 100px; border-radius: 0; }
.as-sk-card > .as-sk-line,
.as-sk-card > .as-sk-line--short { margin: 0.6rem 0.75rem 0; }

/* Header skeleton button placeholder */
.as-block-section--loading .as-block-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
