/*
 * IDMP Tenant_Admin_Console — shell styles.
 *
 * Kept in an external file (no inline styles) so the strict CSP added in task
 * 19.4 applies without 'unsafe-inline'. This is the shell's baseline layout;
 * the responsive/WCAG hardening is completed in tasks 19.4/19.5.
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f5f7fa;
    --fg: #1a1a2e;
    --accent: #4361ee;
    --accent-fg: #ffffff;
    --danger: #dc3545;
    --muted: #6c757d;
    --panel-bg: #ffffff;
    --border: #dee2e6;
}

html, body { width: 100%; max-width: 100%; overflow-x: hidden; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
}

/*
 * No-horizontal-scroll guarantee (Req 17.4, 320px-2560px):
 * every replaced/embedded element is fluid and never wider than its container,
 * and long unbroken tokens (ids, tokens, emails) wrap instead of forcing scroll.
 */
img, svg, video, canvas, iframe, table { max-width: 100%; height: auto; }
input, textarea, select, button { max-width: 100%; }
pre, code { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }

.alert-region {
    /* Empty until task 19.3 populates it; kept in the layout as a live region. */
    padding: 0 1rem;
}
.alert-region:empty { padding: 0; }

/* ── Buttons ── */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--fg); }

/* ── Login view ── */
.login-view {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.login-card {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2rem;
    max-width: 28rem;
    width: 100%;
    text-align: center;
}
.login-card h1 { font-size: 1.4rem; margin-bottom: 0.5rem; }
.login-sub { color: var(--muted); margin-bottom: 1.5rem; }

/* ── Invitation acceptance (accept.html) ──
   Form fields live only on this page. Left-aligned inside the centred card,
   because a label above a left-aligned input is what a form reads like; the
   card's own `text-align: center` would otherwise centre the labels too. */
.login-card .field {
    text-align: left;
    margin-bottom: 1.25rem;
}
.login-card .field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
}
.login-card .field input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.7rem;
    font: inherit;
    color: var(--fg);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.login-card .field input:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 1px;
}
.field-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
}
.accept-identity {
    margin-bottom: 1.5rem;
    overflow-wrap: anywhere;
}
/* The portal link is an anchor styled as a button, so it needs the padding and
   centring that `.btn` assumes on a <button>. */
a.btn { display: inline-block; text-decoration: none; }

/* ── App view ── */
.app-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--border);
}
.app-title { font-size: 1.2rem; }
.operator {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
}
.operator-identity { font-weight: 600; color: var(--fg); }

.app-nav {
    padding: 0.5rem 1.5rem;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--border);
}
.app-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.app-nav a { color: var(--accent); text-decoration: none; font-weight: 600; }
.app-nav a:hover, .app-nav a:focus-visible { text-decoration: underline; }

.app-main {
    padding: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    gap: 1rem;
}
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
}
.panel h2 { font-size: 1.05rem; margin-bottom: 0.75rem; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* Long operator identifiers (emails, tenant ids) wrap rather than overflow. */
.operator-identity, .operator-tenant { overflow-wrap: anywhere; word-break: break-word; }

/*
 * Responsive: never introduce horizontal scroll at any width from 320px up.
 * Content is fluid via max-width/grid above; these breakpoints tighten spacing
 * and let the header, nav and actions stack on small screens.
 */
@media (max-width: 640px) {
    .app-header, .app-nav, .app-main { padding-left: 1rem; padding-right: 1rem; }
    .app-nav ul { gap: 0.75rem; }
}

@media (max-width: 400px) {
    /* Stack the header and its actions so nothing is forced off-screen at 320px. */
    .app-header { flex-direction: column; align-items: flex-start; }
    .operator { width: 100%; }
    .app-nav ul { flex-direction: column; gap: 0.5rem; }
    .panel-actions { flex-direction: column; align-items: stretch; }
    .panel-actions .btn { width: 100%; }
}
