/*-----------------------------------------------------------------------------
 * Project : ai4good - CFP Arts
 * File    : frontend/css/app-shell.css
 * Stylesheet : app shell
 * Author  : Johann Sievering
 * AI Support : Claude AI
 * Date    : 2026-06-11 (start of the project)
 * Rev     : 2026-07-03 Full code review: bug fixes, hardening, cartridge headers (Claude AI)
 * Version : 0.9.0
 *-----------------------------------------------------------------------------
 * Fixed header, bottom tab bar, content shell and their responsive rules.
 *---------------------------------------------------------------------------*/

/* =====================================================================
 * app-shell.css — sticky header + footer + scrollable content area.
 *
 * Required after variables.css. Adapted from ISAI's app-shell with our
 * brand palette and our 5-section footer (Home / Scan / Assemble /
 * Analyse / About).
 *
 *   ┌─────────────────────────────────────┐ ← .app-header (fixed top)
 *   │  AI4Good · Atelier      FR EN DE IT │
 *   ├─────────────────────────────────────┤
 *   │                                     │
 *   │           .app-content              │ ← scrollable
 *   │                                     │
 *   ├─────────────────────────────────────┤
 *   │ 🏠   📷   🧩   ✨   ℹ️             │ ← .app-footer (fixed bottom)
 *   └─────────────────────────────────────┘
 * ===================================================================== */

/* ── Body reset ─────────────────────────────────────────────────────── */
body.app {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    color: var(--text);
    background: var(--bg);
    line-height: var(--line-height);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;

    opacity: 0;                           /* FOUC prevention until JS init */
}
body.app.ready {
    opacity: 1;
    transition: opacity 0.15s ease-in;
}

/* ── Header ────────────────────────────────────────────────────────── */
.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    z-index: var(--z-header);

    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-md);

    background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue) 100%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.app-header__brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: #fff;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity var(--transition-fast);
}
.app-header__brand:hover { opacity: 0.85; }

.app-header__brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.app-header__title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.app-header__subtitle {
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.8);
}

/* ── Language pills (inside the header) ──────────────────────────── */
.app-header__langs {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-pill);
    padding: 2px;
    backdrop-filter: blur(4px);
}

.lang-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    min-width: 36px;
    min-height: 36px;
    border: none;
    border-radius: var(--radius-pill);
    background: transparent;
    color: rgba(255,255,255,0.75);
    font: inherit;
    font-size: var(--font-size-xs);
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    transition: background var(--transition-fast), color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}
.lang-pill:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}
.lang-pill--active,
.lang-pill--active:hover {
    background: rgba(255,255,255,0.92);
    color: var(--blue-900);
}

/* ── Content area ─────────────────────────────────────────────────── */
.app-content {
    min-height: 100vh;
    max-width: 760px;
    margin: 0 auto;
    box-sizing: border-box;
    padding-top:    calc(var(--header-height) + var(--space-md));
    padding-bottom: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px) + var(--space-md));
    padding-left:   var(--space-md);
    padding-right:  var(--space-md);
}

/* ── Footer navigation ────────────────────────────────────────────── */
.app-footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: var(--z-footer);

    display: flex;
    align-items: center;
    justify-content: space-around;

    background: var(--bg-card);
    box-shadow: 0 -1px 4px rgba(0,0,0,0.08);
}

.app-footer__item {
    flex: 1;
    height: 100%;
    padding: var(--space-xs) 0;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;

    text-decoration: none;
    color: var(--text-light);
    font-size: var(--font-size-xs);
    font-weight: 500;
    transition: color var(--transition-fast);

    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    cursor: pointer;
}
.app-footer__item:hover { color: var(--primary); }

.app-footer__icon {
    font-size: 1.35rem;
    line-height: 1;
}
.app-footer__label {
    font-size: 0.7rem;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
    text-align: center;
}

.app-footer__item--active {
    color: var(--primary);
    font-weight: 700;
}
.app-footer__item--active .app-footer__icon { transform: scale(1.1); }

/* Section-specific active colors (one accent per tab).
   data-section values are set by AppFooter.js — keep both in sync. */
.app-footer__item--active[data-section="accueil"] { color: var(--section-accueil); }
.app-footer__item--active[data-section="compose"] { color: var(--section-compose); }
.app-footer__item--active[data-section="create"]  { color: var(--section-create);  }
.app-footer__item--active[data-section="learn"]   { color: var(--section-learn);   }
.app-footer__item--active[data-section="contact"] { color: var(--section-contact); }
.app-footer__item--active[data-section="more"]    { color: var(--section-more);    }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 599px) {
    .app-header        { padding: 0 var(--space-sm); }
    .app-header__title { font-size: 1rem; }
    .app-content       { padding-left: var(--space-sm); padding-right: var(--space-sm); }
    .app-footer__icon  { font-size: 1.15rem; }
    .app-footer__label { font-size: 0.6rem; max-width: 56px; }
}

@media (min-width: 1024px) {
    .app-header        { padding: 0 var(--space-xl); }
    .app-header__title { font-size: var(--font-size-xl); }
    .app-header__subtitle { font-size: 0.7rem; }
    .app-content       { padding-left: var(--space-xl); padding-right: var(--space-xl); }
    .app-footer__icon  { font-size: 1.5rem; }
}
