/* ============================================================
   app-shell.css — Design NUR fuer die Eventify-App (MAUI-WebView)

   Jede Regel haengt an body.app-mode. Diese Klasse setzt
   Eventify/Components/App.razor ausschliesslich dann, wenn der Request
   aus der App kommt (User-Agent "EventifyApp" oder App-Cookie).
   Im normalen Browser ist diese Datei damit wirkungslos —
   das Web-Design bleibt unveraendert.
   ============================================================ */

/* Dunkle Flaeche wie auf der Website — die bestehenden Seiten (Kontakt,
   Angebote, Downloads …) sind fuer dunklen Hintergrund gestaltet und
   behalten so ihren Kontrast. */
body.app-mode {
    --eapp-bg: #14181d;
    --eapp-surface: #1c2229;
    --eapp-ink: #f2f4f7;
    --eapp-muted: #9aa4b2;
    --eapp-line: rgba(255, 255, 255, .10);
    --eapp-bar: #101418;
    --eapp-accent: #38bdff;
    --eapp-topbar-h: 56px;
    --eapp-tabbar-h: 62px;
    --eapp-safe-top: env(safe-area-inset-top, 0px);
    --eapp-safe-bottom: env(safe-area-inset-bottom, 0px);
    --eapp-safe-left: env(safe-area-inset-left, 0px);
    --eapp-safe-right: env(safe-area-inset-right, 0px);

    background: var(--eapp-bg);
    color: var(--eapp-ink);
    /* Kein Overscroll-Gummiband — fuehlt sich nativer an */
    overscroll-behavior-y: none;
    /* Kein 300ms-Doppeltipp-Zoom-Delay — fuehlt sich nativer an */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ---------------- Native Touch-Anmutung (nur App) ----------------
   Lange Taps sollen kein Kontextmenue/Textauswahl-Popup oeffnen — das ist die
   deutlichste "Website im WebView"-Verraeterin. Eingaben bleiben bewusst
   markierbar, damit Nutzer z.B. Text kopieren koennen. */
body.app-mode {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body.app-mode input,
body.app-mode textarea,
body.app-mode select,
body.app-mode [contenteditable="true"] {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    user-select: text;
}

/* Web-Hintergrundslideshow in der App abschalten */
body.app-mode .page-background {
    display: none;
}

body.app-mode .eapp-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ---------------- Kopfzeile ---------------- */
body.app-mode .eapp-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: calc(var(--eapp-topbar-h) + var(--eapp-safe-top));
    padding: var(--eapp-safe-top) calc(12px + var(--eapp-safe-right)) 0 calc(12px + var(--eapp-safe-left));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--eapp-bar);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}

body.app-mode .eapp-brand {
    display: flex;
    align-items: center;
    min-height: 44px;
}

body.app-mode .eapp-brand img {
    height: 34px;
    width: auto;
    display: block;
}

body.app-mode .eapp-topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

body.app-mode .eapp-iconbtn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

body.app-mode .eapp-iconbtn:active {
    background: rgba(255, 255, 255, .12);
}

body.app-mode .eapp-badge {
    position: absolute;
    top: 4px;
    right: 3px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 9.5px;
    background: var(--eapp-accent);
    color: #06232f;
    font-size: 12px;
    font-weight: 700;
    line-height: 19px;
    text-align: center;
}

/* ---------------- Inhalt ---------------- */
body.app-mode .eapp-content {
    /* Web-Regel .main-content nutzt --header-height (Top-Bar + Header) */
    margin-top: calc(var(--eapp-topbar-h) + var(--eapp-safe-top));
    min-height: 0;
    flex: 1;
    padding-bottom: calc(var(--eapp-tabbar-h) + var(--eapp-safe-bottom));
    padding-left: var(--eapp-safe-left);
    padding-right: var(--eapp-safe-right);
    /* iOS-Momentum-Scrolling statt hartem Stopp */
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
}

body.app-mode .eapp-content > .content-wrapper {
    max-width: 100%;
    min-height: 0;
    padding: 14px 14px 20px 14px;
}

/* ---------------- Tab-Leiste ---------------- */
body.app-mode .eapp-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    display: flex;
    align-items: stretch;
    height: calc(var(--eapp-tabbar-h) + var(--eapp-safe-bottom));
    padding-bottom: var(--eapp-safe-bottom);
    padding-left: var(--eapp-safe-left);
    padding-right: var(--eapp-safe-right);
    background: var(--eapp-bar);
    box-shadow: 0 -1px 0 rgba(255, 255, 255, .06);
}

body.app-mode .eapp-tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 1px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, .62);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.2px;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* 5 Tabs bei 12px Text auf 360px-Screens: Label darf schmal umbrechen,
   damit lange Beschriftungen (z.B. "Merkzettel") nicht abgeschnitten werden. */
body.app-mode .eapp-tab span:last-child {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 360px) {
    body.app-mode .eapp-tab span:last-child {
        white-space: normal;
        word-break: break-word;
        line-height: 1.05;
        text-align: center;
    }
}

body.app-mode .eapp-tab.active,
body.app-mode .eapp-tab:active {
    color: #ffffff;
}

/* NavLink setzt bei aktiver Route die Klasse "active" */
body.app-mode .eapp-tab.active svg {
    color: var(--eapp-accent);
}

body.app-mode .eapp-tab-iconwrap {
    position: relative;
    display: inline-flex;
}

body.app-mode .eapp-tab .eapp-badge {
    top: -4px;
    right: -8px;
}

/* ---------------- "Mehr"-Sheet ---------------- */
body.app-mode .eapp-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1002;
    background: rgba(0, 0, 0, .45);
}

body.app-mode .eapp-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--eapp-tabbar-h) + var(--eapp-safe-bottom));
    z-index: 1003;
    background: var(--eapp-surface);
    border-radius: 18px 18px 0 0;
    padding: 8px 14px 10px 14px;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .22);
    animation: eappSheetUp .18s ease-out;
}

@keyframes eappSheetUp {
    from { transform: translateY(16px); opacity: .4; }
    to { transform: translateY(0); opacity: 1; }
}

body.app-mode .eapp-sheet-handle {
    width: 38px;
    height: 4px;
    margin: 4px auto 10px auto;
    border-radius: 2px;
    background: var(--eapp-line);
}

body.app-mode .eapp-sheet-link {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 4px;
    color: var(--eapp-ink);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid var(--eapp-line);
}

body.app-mode .eapp-sheet-link:last-child {
    border-bottom: none;
}

/* ============================================================
   App-Startseite (Elemente/AppStartseite.razor)
   ============================================================ */

body.app-mode .eapp-home {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

body.app-mode .eapp-hero {
    background: linear-gradient(140deg, #1d2733 0%, #2b3a4d 100%);
    border-radius: 18px;
    padding: 18px 16px;
    color: #ffffff;
}

body.app-mode .eapp-hero-kicker {
    margin: 0 0 2px 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--eapp-accent);
}

body.app-mode .eapp-hero-title {
    margin: 0 0 14px 0;
    font-size: 21px;
    line-height: 1.25;
    font-weight: 700;
}

body.app-mode .eapp-hero-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    background: #ffffff;
    color: #101418;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

body.app-mode .eapp-section-title {
    margin: 0 0 8px 2px;
    font-size: 14px;
    font-weight: 700;
    color: var(--eapp-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

body.app-mode .eapp-cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

body.app-mode .eapp-cat {
    display: flex;
    flex-direction: column;
    background: var(--eapp-surface);
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: var(--eapp-ink);
    border: 1px solid var(--eapp-line);
}

/* Die Kategoriebilder sind teils freigestellte Grafiken — contain statt cover,
   damit nichts angeschnitten wird oder aus der Kachel laeuft. */
body.app-mode .eapp-cat img {
    width: 100%;
    max-width: 100%;
    height: 72px;
    object-fit: contain;
    padding: 10px 8px 4px 8px;
    background: rgba(255, 255, 255, .04);
    display: block;
}

body.app-mode .eapp-cat span {
    padding: 8px 6px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

body.app-mode .eapp-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

body.app-mode .eapp-quick {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 0 14px;
    border-radius: 14px;
    background: var(--eapp-surface);
    color: var(--eapp-ink);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--eapp-line);
}

body.app-mode .eapp-quick svg {
    color: var(--eapp-accent);
    flex: none;
}

body.app-mode .eapp-staff-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 10px 14px;
    border-radius: 14px;
    background: var(--eapp-surface);
    border: 1px solid rgba(56, 189, 255, .35);
    color: var(--eapp-ink);
    text-decoration: none;
}

body.app-mode .eapp-staff-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 12px;
    background: rgba(56, 189, 255, .18);
    color: var(--eapp-accent);
}

body.app-mode .eapp-staff-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

body.app-mode .eapp-staff-text strong {
    font-size: 15px;
}

body.app-mode .eapp-staff-text span {
    font-size: 12.5px;
    color: rgba(255, 255, 255, .68);
}

body.app-mode .eapp-staff-chevron {
    margin-left: auto;
    color: rgba(255, 255, 255, .5);
    flex: none;
}

body.app-mode .eapp-home-footer {
    margin: 4px 0 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--eapp-muted);
}

/* Tablet/grosse Screens: Inhalt zentriert, damit die App auch auf
   iPads/grossen Handys nicht auseinanderlaeuft */
@media (min-width: 700px) {
    body.app-mode .eapp-content > .content-wrapper,
    body.app-mode .eapp-sheet {
        max-width: 680px;
        margin-left: auto;
        margin-right: auto;
    }

    body.app-mode .eapp-quick-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Tablets (ab 768px): Inhalt bekommt eine lesbare, zentrierte Spalte;
   Tab- und Kopfzeile werden breiter statt auf eine Seitenleiste umzustellen
   (kleinere, sichere Aenderung, Handy-Layout bleibt unberuehrt). */
@media (min-width: 768px) {
    body.app-mode .eapp-content > .content-wrapper {
        max-width: 820px;
        padding: 20px 24px 28px 24px;
    }

    body.app-mode .eapp-sheet {
        max-width: 820px;
    }

    body.app-mode .eapp-tabbar {
        justify-content: center;
    }

    body.app-mode .eapp-tab {
        flex: 0 1 164px;
        font-size: 13px;
    }

    body.app-mode .eapp-tab svg {
        width: 24px;
        height: 24px;
    }
}
