/* ============================================================================
 * base.css — page-level baseline only.
 *
 * Tokens live in tokens.css. Component definitions (buttons, nav, modal,
 * dropdowns) live in components.css. This file keeps only:
 *   - global resets
 *   - the layout container
 *   - footer / messages (page-frame chrome)
 *   - the alert animation (theme-agnostic)
 *   - the responsive overrides specific to non-component elements
 * ========================================================================= */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    /* Font + colours are set in components.css so the cascade order picks
     * up theme changes; we just keep the reset here. */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
main.container { flex: 1; }

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* ----------------------------------------------------------------------------
 * Footer
 * --------------------------------------------------------------------------*/
.footer {
    background: var(--surface-2);
    padding: var(--space-6) 0;
    margin-top: var(--space-7);
    border-top: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}
.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
}
.footer-links {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}
.footer-links a { color: var(--text-secondary); text-decoration: none; }
.footer-links a:hover { color: var(--accent-primary); text-decoration: underline; }

/* ----------------------------------------------------------------------------
 * Messages — fixed toast container in the top-right corner.
 * --------------------------------------------------------------------------*/
.messages {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-width: 400px;
}
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
    border: 1px solid transparent;
}
.alert-error    { background: var(--status-crit-bg); color: var(--status-crit-fg); border-color: var(--status-crit-border); }
.alert-success  { background: var(--status-ok-bg);   color: var(--status-ok-fg);   border-color: var(--status-ok-border); }
.alert-info     { background: var(--status-info-bg); color: var(--status-info-fg); border-color: var(--status-info-border); }
.alert-warning  { background: var(--status-warn-bg); color: var(--status-warn-fg); border-color: var(--status-warn-border); }

@keyframes slideIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* Utility — used in nav dropdowns and elsewhere. */
.text-muted { color: var(--text-tertiary); }

/* ----------------------------------------------------------------------------
 * Responsive page-frame overrides. Component responsiveness lives next to
 * each component in components.css.
 * --------------------------------------------------------------------------*/
@media (max-width: 768px) {
    .footer .container {
        flex-direction: column;
        gap: var(--space-3);
        text-align: center;
    }
    .messages {
        left: var(--space-3);
        right: var(--space-3);
        max-width: none;
    }
    .modal {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .modal-body { max-height: calc(100vh - 8rem); }
}
