/* App shell and shared components. Mobile-first: the student mostly uses his phone.
   Tokens come from style.css. Tap targets are at least 44px. */

:root {
    --tabbar-height: 60px;
    --color-surface: #ffffff;
    --color-info: #2f6fb0;
}

.shq-app {
    min-height: 100vh;
    padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
}

.shq-app--signed-out { padding-bottom: 0; }

.shq-offscreen {
    position: absolute;
    left: -9999px;
    top: 0;
}

.shq-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Top bar ---------- */
.shq-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.shq-topbar__content {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.shq-topbar__user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: 0;
}

.shq-topbar__name {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.shq-topbar__signout {
    min-height: 44px;
    padding: 0 var(--space-sm);
    background: none;
    border: none;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary-dark);
    cursor: pointer;
}

/* ---------- Bottom tab bar (becomes a top strip on wide screens) ---------- */
.shq-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.shq-tabbar__tab {
    flex: 1;
    min-height: var(--tabbar-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.shq-tabbar__tab--active { color: var(--color-accent-orange); }

.shq-tabbar__icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.shq-main {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-md);
}

@media (min-width: 900px) {
    .shq-app { padding-bottom: 0; }
    .shq-tabbar {
        position: static;
        max-width: 900px;
        margin: 0 auto;
        border-top: none;
        border-bottom: 1px solid var(--color-border);
    }
    .shq-tabbar__tab {
        flex: 0 0 auto;
        flex-direction: row;
        gap: var(--space-sm);
        min-height: 48px;
        padding: 0 var(--space-md);
        font-size: 14px;
    }
    .shq-main { padding: var(--space-lg) var(--space-md); }
}

/* ---------- Page headings ---------- */
.shq-page-title {
    font-size: 24px;
    margin-bottom: var(--space-xs);
}

.shq-page-subtitle {
    color: var(--color-text-secondary);
    font-size: 15px;
    margin-bottom: var(--space-md);
}

.shq-heading {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
    margin: var(--space-lg) 0 var(--space-sm);
}

/* ---------- Panels ---------- */
.shq-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.shq-panel__title {
    font-size: 16px;
    margin-bottom: var(--space-sm);
}

.shq-empty {
    padding: var(--space-lg) var(--space-md);
    text-align: center;
    color: var(--color-text-secondary);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
}

/* ---------- Badges ---------- */
.shq-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    background: var(--color-bg-tertiary);
    color: var(--color-primary-dark);
    white-space: nowrap;
}

.shq-badge--success { background: #e2f3e8; color: #1f7443; }
.shq-badge--warning { background: #fdf1d3; color: #8a5d00; }
.shq-badge--danger  { background: #fbe3e3; color: #a51b1b; }
.shq-badge--info    { background: #e1edf8; color: #1f5288; }
.shq-badge--muted   { background: var(--color-bg-subtle); color: var(--color-text-secondary); }

/* ---------- Buttons (additions to style.css) ---------- */
.shq-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.shq-btn--block { width: 100%; }

.shq-btn--sm {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 14px;
}

.shq-btn--danger {
    background: transparent;
    color: var(--color-danger);
    border: 1px solid #f0c9c9;
}

.shq-link-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--color-primary-dark);
    text-decoration: underline;
    cursor: pointer;
    min-height: 44px;
}

/* ---------- Forms ---------- */
.shq-field { margin-bottom: var(--space-md); }

.shq-field-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

@media (min-width: 600px) {
    .shq-field-row { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

.shq-input,
.shq-select,
.shq-textarea { min-height: 44px; }

.shq-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: 44px;
    font-size: 15px;
}

.shq-check input {
    width: 20px;
    height: 20px;
    accent-color: var(--color-dark-btn);
}

.shq-hidden { display: none !important; }

/* ---------- Toast ---------- */
.shq-toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tabbar-height) + 16px + env(safe-area-inset-bottom, 0px));
    transform: translate(-50%, 20px);
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
    border-radius: var(--radius-lg);
    background: var(--color-dark-btn);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 200;
}

.shq-toast--visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.shq-toast--error { background: var(--color-danger); }

@media (prefers-reduced-motion: reduce) {
    .shq-toast { transition: none; }
}
