/* =============================================================================
 * app-shell.css — the P2 shell: sign-in gate additions, projects landing,
 * toasts, and the upgrade wall. Loaded LAST so it settles the header-height
 * conflict between style.css (48px token) and academy.css (56px).
 * ========================================================================== */

/* Header — style.css sizes it from --app-header-h; academy.css re-declares the
   same selector at 56px and loads later, which pushed it over the studio. */
.app-header {
    height: var(--app-header-h, 48px);
    padding: 0 20px;
    z-index: 36000;
}

.ah-title { color: var(--text-high, #E6EDF3); font-weight: 600; font-size: 15px; }
#ah-plan { display: inline-flex; align-items: center; gap: 10px; margin-right: 12px; }
.ah-upgrade-btn {
    border: none; cursor: pointer; border-radius: var(--radius-md, 8px); padding: 7px 13px;
    font-size: 12px; font-weight: 600; color: #fff;
    background: var(--gradient-brand, linear-gradient(135deg, #1A5FB4, #2B7CE9));
}
.ah-upgrade-btn:hover { filter: brightness(1.1); }

/* =============================================================================
 * SIGN-IN GATE — additions on top of the .access-gate-* rules in style.css
 * ========================================================================== */

/* Google's rendered button lands here. Reserve the height so the card does not
   jump when GIS finishes painting. */
.gate-google { display: flex; justify-content: center; min-height: 44px; margin-top: 14px; }

.gate-divider {
    display: flex; align-items: center; gap: 10px;
    margin: 16px 0 4px; color: var(--text-disable, #484F58); font-size: 11.5px;
}
.gate-divider::before, .gate-divider::after {
    content: ""; flex: 1; height: 1px; background: var(--border-color, #30363D);
}

.access-gate-trust {
    margin-top: 14px; margin-bottom: 0;
    color: var(--text-medium, #8B949E); font-size: 11.5px; text-align: center;
}

/* Public product/legal links under the sign-in card. A visitor — or a payment
   provider reviewing the checkout domain — can reach the product, pricing and
   legal pages without an account. */
.access-gate-links {
    margin-top: 18px; padding-top: 14px;
    border-top: 1px solid var(--border-color, #30363D);
    color: var(--text-disable, #6b7684);
    font-size: 11.5px; text-align: center; line-height: 1.9;
}
.access-gate-links a { color: var(--text-medium, #8B949E); text-decoration: none; }
.access-gate-links a:hover { color: var(--primary-light, #62A0EA); text-decoration: underline; }

/* =============================================================================
 * PROJECTS LANDING
 * ========================================================================== */

/* Absolutely positioned under the fixed header: body is overflow:hidden, so the
   landing must own its own scroll or the grid is clipped past the second row. */
#projects-view {
    position: absolute;
    inset: var(--app-header-h, 48px) 0 0 0;
    overflow-y: auto;
    background:
        radial-gradient(1100px 520px at 50% -160px, rgba(43, 124, 233, 0.16), transparent 70%),
        var(--color-00, #0F1419);
    padding: 0 0 96px;
}
.pm-wrap { max-width: 1160px; margin: 0 auto; padding: 0 32px; }

.pm-hero { text-align: center; padding: 56px 24px 36px; }
.pm-hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; border-radius: var(--radius-full, 9999px);
    background: rgba(43, 124, 233, 0.10); border: 1px solid rgba(43, 124, 233, 0.30);
    color: var(--primary-light, #62A0EA); font-size: 12px; font-weight: 600;
    letter-spacing: .02em; margin-bottom: 18px;
}
.pm-hero h1 {
    margin: 0 0 12px; font-size: 40px; line-height: 1.1; font-weight: 700;
    background: linear-gradient(135deg, #E6EDF3 10%, #62A0EA 90%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.pm-hero p {
    margin: 0 auto; max-width: 620px;
    color: var(--text-medium, #8B949E); font-size: 15px; line-height: 1.6;
}

.pm-section-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin: 8px 0 18px;
}
.pm-section-head h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-high, #E6EDF3); }
.pm-count { color: var(--text-medium, #8B949E); font-weight: 400; font-size: 13px; margin-left: 8px; }
.pm-new-btn {
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    border: 1px solid rgba(43, 124, 233, 0.35); background: rgba(43, 124, 233, 0.12);
    color: var(--primary-light, #62A0EA); font-weight: 600; font-size: 13px;
    padding: 8px 14px; border-radius: var(--radius-md, 8px);
    transition: background .15s ease, border-color .15s ease;
}
.pm-new-btn:hover { background: rgba(43, 124, 233, 0.22); border-color: var(--primary, #2B7CE9); }
.pm-new-btn:disabled { opacity: .5; cursor: not-allowed; }

.pm-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); }
.pm-card {
    position: relative; cursor: pointer; border-radius: var(--radius-lg, 12px);
    padding: 20px; min-height: 150px;
    background: linear-gradient(180deg, rgba(28, 33, 40, 0.92), rgba(15, 20, 25, 0.92));
    border: 1px solid var(--color-05, #30363D);
    display: flex; flex-direction: column; gap: 12px;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
    overflow: hidden;
}
.pm-card::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
    background: var(--gradient-brand, linear-gradient(135deg, #1A5FB4, #2B7CE9));
    opacity: 0; transition: opacity .2s ease;
}
.pm-card:hover { transform: translateY(-3px); border-color: rgba(43, 124, 233, 0.55); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45); }
.pm-card:hover::before { opacity: 1; }
.pm-card:focus-visible { outline: 2px solid var(--primary, #2B7CE9); outline-offset: 2px; }
.pm-icon {
    width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
    background: var(--gradient-brand, linear-gradient(135deg, #1A5FB4, #2B7CE9));
    color: #fff; flex-shrink: 0;
}
.pm-card .pm-name { font-size: 15.5px; font-weight: 600; color: var(--text-high, #E6EDF3); word-break: break-word; }
.pm-card .pm-meta { font-size: 12px; color: var(--text-medium, #8B949E); margin-top: 2px; }
.pm-card .pm-open { margin-top: auto; font-size: 13px; color: var(--primary-light, #62A0EA); font-weight: 600; }
.pm-del {
    position: absolute; top: 10px; right: 10px; border: none; background: transparent;
    color: var(--text-disable, #484F58); font-size: 18px; cursor: pointer; line-height: 1;
    padding: 4px 8px; border-radius: 8px; transition: background .15s ease, color .15s ease;
}
.pm-del:hover { background: rgba(248, 81, 73, 0.16); color: #F85149; }

.pm-card-new {
    border-style: dashed; border-color: var(--color-05, #30363D);
    align-items: center; justify-content: center; text-align: center; gap: 8px;
    color: var(--text-medium, #8B949E); background: rgba(28, 33, 40, 0.4);
}
.pm-card-new:hover { color: var(--primary-light, #62A0EA); }
.pm-card-new .pm-plus {
    width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
    font-size: 24px; border: 1px dashed var(--color-05, #30363D);
}

/* Welcoming empty state — first run has no cards to look at */
.pm-onboard {
    grid-column: 1 / -1;
    border: 1px solid var(--color-05, #30363D); border-radius: var(--radius-lg, 12px);
    background: linear-gradient(180deg, rgba(28, 33, 40, 0.75), rgba(15, 20, 25, 0.75));
    padding: 34px 28px; text-align: center;
}
.pm-onboard h3 { margin: 0 0 8px; font-size: 18px; font-weight: 600; color: var(--text-high, #E6EDF3); }
.pm-onboard p { margin: 0 auto 20px; max-width: 520px; color: var(--text-medium, #8B949E); font-size: 14px; line-height: 1.65; }
.pm-onboard-steps {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 22px;
}
.pm-step {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 13px; border-radius: var(--radius-full, 9999px);
    background: rgba(43, 124, 233, 0.08); border: 1px solid rgba(43, 124, 233, 0.22);
    color: var(--text-medium, #8B949E); font-size: 12.5px;
}
.pm-step b {
    display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
    background: var(--primary, #2B7CE9); color: #fff; font-size: 11px; font-weight: 700;
}
.pm-onboard .pm-new-btn { font-size: 14px; padding: 10px 18px; }

.pm-empty { color: var(--text-medium, #8B949E); font-size: 14px; padding: 8px 0 18px; }
.pm-error {
    grid-column: 1 / -1; padding: 14px 16px; border-radius: var(--radius-md, 8px);
    background: rgba(207, 34, 46, 0.10); border: 1px solid rgba(207, 34, 46, 0.35);
    color: #ff9d95; font-size: 13.5px;
}

/* Skeletons while the project list is in flight */
.pm-skel {
    min-height: 150px; border-radius: var(--radius-lg, 12px);
    border: 1px solid var(--color-04, #30363D);
    background: linear-gradient(100deg,
        rgba(28, 33, 40, 0.85) 30%, rgba(48, 54, 61, 0.65) 50%, rgba(28, 33, 40, 0.85) 70%);
    background-size: 220% 100%;
    animation: pm-shimmer 1.3s ease-in-out infinite;
}
@keyframes pm-shimmer { from { background-position: 140% 0; } to { background-position: -40% 0; } }
@media (prefers-reduced-motion: reduce) { .pm-skel { animation: none; } }

/* =============================================================================
 * TOASTS — readable failures instead of a raw alert()
 * ========================================================================== */
.toast-stack {
    position: fixed; right: 18px; bottom: 18px; z-index: 60000;
    display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 36px));
}
.toast {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: var(--radius-md, 8px);
    background: var(--color-02, #1C2128); border: 1px solid var(--color-05, #30363D);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    color: var(--text-high, #E6EDF3); font-size: 13.5px; line-height: 1.5;
    opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease;
}
.toast.is-visible { opacity: 1; transform: none; }
.toast-icon { flex: 0 0 auto; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; display: block; margin-bottom: 2px; }
.toast-close {
    flex: 0 0 auto; border: none; background: transparent; cursor: pointer;
    color: var(--text-disable, #484F58); font-size: 16px; line-height: 1; padding: 0 2px;
}
.toast-close:hover { color: var(--text-high, #E6EDF3); }
.toast.error { border-color: rgba(207, 34, 46, 0.5); }
.toast.error .toast-icon { color: #F85149; }
.toast.success { border-color: rgba(45, 164, 78, 0.5); }
.toast.success .toast-icon { color: #56D364; }
.toast.info .toast-icon { color: var(--primary-light, #62A0EA); }

/* =============================================================================
 * UPGRADE WALL — what a Free user sees instead of a raw 402
 * ========================================================================== */
.qw-overlay {
    position: fixed; inset: 0; z-index: 55000;
    background: rgba(6, 9, 12, 0.72); backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.qw-card {
    width: min(460px, 100%);
    background: var(--color-01, #161B22); border: 1px solid var(--color-05, #30363D);
    border-radius: var(--radius-lg, 12px); padding: 28px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6); text-align: center;
}
.qw-badge {
    display: inline-flex; align-items: center; gap: 7px; margin-bottom: 14px;
    padding: 5px 12px; border-radius: var(--radius-full, 9999px);
    background: rgba(124, 58, 237, 0.14); border: 1px solid rgba(124, 58, 237, 0.4);
    color: #c4b5fd; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.qw-card h3 { margin: 0 0 10px; font-size: 19px; font-weight: 600; color: var(--text-high, #E6EDF3); }
.qw-card p { margin: 0 0 18px; color: var(--text-medium, #8B949E); font-size: 14px; line-height: 1.6; }
.qw-meter { margin: 0 0 20px; }
.qw-meter-bar { height: 6px; border-radius: 999px; background: var(--color-03, #252B33); overflow: hidden; }
.qw-meter-fill { height: 100%; background: var(--gradient-brand, linear-gradient(135deg, #1A5FB4, #2B7CE9)); }
.qw-meter-label { margin-top: 7px; font-size: 12px; color: var(--text-medium, #8B949E); }
.qw-actions { display: flex; flex-direction: column; gap: 9px; }
.qw-btn {
    border: none; cursor: pointer; border-radius: var(--radius-md, 8px);
    padding: 11px 16px; font-size: 14px; font-weight: 600; color: #fff;
    background: var(--gradient-brand, linear-gradient(135deg, #1A5FB4, #2B7CE9));
}
.qw-btn:hover { filter: brightness(1.1); }
.qw-btn.secondary {
    background: transparent; border: 1px solid var(--color-05, #30363D);
    color: var(--text-medium, #8B949E); font-weight: 500;
}
.qw-btn.secondary:hover { color: var(--text-high, #E6EDF3); border-color: var(--color-05, #484F58); }
.qw-note { margin: 14px 0 0; font-size: 11.5px; color: var(--text-disable, #6b7684); }
.qw-note a { color: var(--text-medium, #8B949E); }

/* Upgrade menu offers both billing periods */
.auth-menu-upgrade-annual { font-size: 12px; opacity: .85; }

/* Method names now read "Plain wording (Textbook name)", which does not fit the
   width inherited from P1 — it truncated mid-word. */
.reg-studio-header .reg-method-select {
    min-width: 300px;
    max-width: 340px;          /* P1 capped this at 188px, sized for "Rigid Registration" */
    text-overflow: ellipsis;
}
@media (max-width: 1240px) {
    .reg-studio-header .reg-method-select { min-width: 190px; max-width: 220px; }
}

@media (max-width: 640px) {
    .pm-hero h1 { font-size: 30px; }
    .pm-hero { padding: 40px 16px 28px; }
    .pm-wrap { padding: 0 18px; }
    .pm-section-head { flex-direction: column; align-items: flex-start; }
}
