/*
 * App-mode shell styles (v3.7.0).
 *
 * Used by templates/app-mode/page-app.php when Settings → Branding →
 * "App mode (no theme chrome)" is enabled. Renders the customer pages
 * without the active theme's header/footer/menu.
 *
 * High specificity (.swgef-app-mode prefix) ensures these styles win over
 * any theme styles that still load via wp_head() — we don't dequeue theme
 * CSS because that would be fragile across themes.
 *
 * Light theme only per agency rule. All colors via brand tokens.
 */

/* Reset theme background + scroll containment ----------------------------- */
html.swgef-app-mode,
html.swgef-app-mode body.swgef-app-mode-body {
    margin: 0;
    padding: 0;
    background: var(--swg-surface, #f7f9fa);
}

html.swgef-app-mode body.swgef-app-mode-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--swg-text, #1d2327);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
}

/* Shell container --------------------------------------------------------- */
.swgef-app-mode .swgef-app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--swg-surface, #f7f9fa);
}

/* Branded top bar --------------------------------------------------------- */
.swgef-app-mode .swgef-app-header {
    background: var(--swg-bg, #ffffff);
    border-bottom: 1px solid var(--swg-line, #e1e5ea);
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(29, 35, 39, 0.04);
}

.swgef-app-mode .swgef-app-header-inner {
    max-width: 1280px; /* v3.25.0 — wider full-width SaaS shell */
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.swgef-app-mode .swgef-app-brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--swg-text, #1d2327);
}

.swgef-app-mode .swgef-app-brand img {
    /* v3.63.0 — the portal logo rendered 40px tall (Basecamp #518803827, Kyle's
       third nudge). The PDR logo PNG carries ~45% baked-in transparent padding,
       so a 40px box showed a ~22px mark. Sized generously (the standing logo
       rule): 110px box + negative margins pull the empty padding out, so the
       visible artwork is ~60px while the header bar barely grows. */
    height: 110px;
    max-height: none;
    max-width: 320px;
    display: block;
    width: auto;
    margin: -24px 0;
}


.swgef-app-mode .swgef-app-brand strong {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.swgef-app-mode .swgef-app-brand:hover {
    text-decoration: none;
    opacity: 0.85;
}

/* Header action group ----------------------------------------------------- */
.swgef-app-mode .swgef-app-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.swgef-app-mode .swgef-app-user {
    color: var(--swg-muted, #6b7280);
    font-size: 14px;
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.swgef-app-mode .swgef-app-action {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 4px;
    color: var(--swg-accent-dark, #1d6588);
    background: transparent;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.swgef-app-mode .swgef-app-action:hover,
.swgef-app-mode .swgef-app-action:focus {
    background: var(--swg-surface-hover, #eef2f5);
    text-decoration: none;
    outline: none;
}

.swgef-app-mode .swgef-app-action:focus-visible {
    outline: 2px solid var(--swg-accent, #38A8D8);
    outline-offset: 2px;
}

.swgef-app-mode .swgef-app-action-primary {
    background: var(--swg-accent); /* v3.25.0 — cobalt SaaS primary */
    color: #ffffff;
}

.swgef-app-mode .swgef-app-action-primary:hover,
.swgef-app-mode .swgef-app-action-primary:focus {
    background: var(--swg-accent-dark); /* v3.25.0 — was hardcoded #155068 */
    color: #ffffff;
}

/* Main content area ------------------------------------------------------- */
.swgef-app-mode .swgef-app-main {
    flex: 1;
    width: 100%;
    max-width: 1280px; /* v3.25.0 — wider full-width SaaS shell */
    margin: 0 auto;
    padding: 32px 24px;
}

/* Reset any theme padding on direct children of the main */
.swgef-app-mode .swgef-app-main > * {
    max-width: none;
}

/* Footer ------------------------------------------------------------------ */
.swgef-app-mode .swgef-app-footer {
    background: var(--swg-bg, #ffffff);
    border-top: 1px solid var(--swg-line, #e1e5ea);
    padding: 16px 24px;
    color: var(--swg-muted, #6b7280);
    font-size: 13px;
}

.swgef-app-mode .swgef-app-footer-inner {
    max-width: 1280px; /* v3.25.0 — wider full-width SaaS shell */
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.swgef-app-mode .swgef-app-footer-link {
    color: var(--swg-accent-dark, #1d6588);
    text-decoration: none;
}

.swgef-app-mode .swgef-app-footer-link:hover {
    text-decoration: underline;
}

/* Mobile ------------------------------------------------------------------ */
@media (max-width: 600px) {
    .swgef-app-mode .swgef-app-brand img {
        height: 84px;
        margin: -18px 0;
    }
    .swgef-app-mode .swgef-app-header {
        padding: 10px 12px;
    }
    .swgef-app-mode .swgef-app-header-inner {
        gap: 8px;
    }
    .swgef-app-mode .swgef-app-user {
        display: none; /* free up space — the Log out button is enough */
    }
    .swgef-app-mode .swgef-app-brand img {
        /* v3.67.4 — max-height REMOVED. This rule predates v3.63.0 and sits LATER
           in the file at equal specificity, so its max-height:32px was clamping
           the 84px height set above and the mobile logo has been rendering at
           32px (~17px of visible mark after the PNG's baked padding) ever since
           v3.63.0 "fixed" it. That fix was verified on desktop only, which is
           exactly how it survived — the client's complaint was about the phone.
           max-width is kept: it is a genuine narrow-screen guard and never
           conflicted. */
        max-width: 180px;
    }
    .swgef-app-mode .swgef-app-brand strong {
        font-size: 16px;
    }
    .swgef-app-mode .swgef-app-action {
        padding: 6px 10px;
        font-size: 13px;
    }
    .swgef-app-mode .swgef-app-main {
        padding: 16px 12px;
    }
    .swgef-app-mode .swgef-app-footer {
        padding: 12px 16px;
    }
    .swgef-app-mode .swgef-app-footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 4px;
    }
}

/* Print ------------------------------------------------------------------- */
@media print {
    .swgef-app-mode .swgef-app-header,
    .swgef-app-mode .swgef-app-footer {
        display: none;
    }
    .swgef-app-mode .swgef-app-main {
        padding: 0;
        max-width: 100%;
    }
}

/* Reduced motion ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .swgef-app-mode .swgef-app-action {
        transition: none;
    }
}
