/* app.css — Lixapps-Hub. Eigenständiges, kleines Stylesheet (bewusst kein
   gemeinsamer Code mit der Fitness-App), optisch an dieselbe iOS-artige
   Formensprache angelehnt, damit sich die Apps als eine Familie lesen. */

:root {
    --bg: #F2F2F7;
    --card: #FFFFFF;
    --accent: #007AFF;
    --accent-dark: #0062CC;
    --text: #000000;
    --text-2: #8E8E93;
    --sep-light: #E5E5EA;
    --red: #FF3B30;
    --red-bg: #FFEDED;
    --green-bg: #E9FBEF;
    --radius: 10px;
    --radius-lg: 16px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* --- Login --------------------------------------------------------------- */
.login-body { background: var(--bg); }
.login-wrap {
    max-width: 360px;
    margin: 0 auto;
    padding: calc(var(--safe-top) + 64px) 20px 40px;
    text-align: center;
}
.login-logo { font-size: 44px; margin-bottom: 8px; }
.login-title { font-size: 26px; font-weight: 700; margin: 0; }
.login-subtitle { font-size: 14px; color: var(--text-2); margin-top: 4px; margin-bottom: 24px; }
.login-form { text-align: left; }
.login-form label { display: block; font-size: 13px; color: var(--text-2); margin: 14px 0 6px; font-weight: 500; }
.login-form input {
    width: 100%;
    font-size: 16px;
    padding: 13px 14px;
    border: 1.5px solid var(--sep-light);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
}
.login-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15); }
.login-form .btn { margin-top: 22px; }
.login-invite-link { display: block; margin-top: 14px; font-size: 12px; color: var(--text-2); }
.login-invite-link:hover { color: var(--accent); text-decoration: underline; }

/* --- Buttons --------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-dark); }
.btn-secondary { background: rgba(0, 122, 255, 0.1); color: var(--accent); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-plain { background: none; color: var(--accent); padding: 0 8px; min-height: 36px; font-weight: 500; }

/* --- Flash-Meldungen --------------------------------------------------------- */
.flash {
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
    text-align: left;
}
.flash-error { background: var(--red-bg); color: var(--red); }
.flash-success { background: var(--green-bg); color: #248A3D; }
.flash-info { background: rgba(0, 122, 255, 0.1); color: var(--accent-dark); }

/* --- Hub-Header (Kachel-Übersicht) --------------------------------------- */
.hub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--safe-top) + 14px) 16px 14px;
    border-bottom: 1px solid var(--sep-light);
    background: var(--card);
}
.hub-header-title { font-size: 17px; font-weight: 700; }
.hub-header-right { display: flex; align-items: center; gap: 10px; }
.hub-header-user { font-size: 13px; color: var(--text-2); font-weight: 500; }
.hub-main { max-width: 480px; margin: 0 auto; padding: 20px 16px calc(24px + var(--safe-bottom)); }
.hub-intro { font-size: 14px; color: var(--text-2); margin: 0 0 14px; }
.hub-section-title { font-size: 15px; font-weight: 700; margin: 20px 0 10px; }
.hub-section-title:first-of-type { margin-top: 0; }

/* --- Impressum ------------------------------------------------------------- */
.legal-text p { font-size: 14px; line-height: 1.5; color: var(--text-2); margin: 0 0 10px; }
.legal-text p:last-child { margin-bottom: 0; }
.legal-text strong { color: var(--text); font-weight: 600; }
.legal-text a { color: var(--accent); }

.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}
.card label { display: block; font-size: 13px; color: var(--text-2); margin: 0 0 6px; font-weight: 500; }
.card input[type="text"],
.card select,
.card textarea {
    width: 100%;
    font-size: 16px;
    padding: 13px 14px;
    border: 1.5px solid var(--sep-light);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}
.card textarea { resize: vertical; min-height: 90px; }
.card input[type="text"]:focus,
.card select:focus,
.card textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15); }
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    padding: 6px 0;
    color: var(--text);
}
.invite-link-box {
    width: 100%;
    font-size: 13px;
    padding: 10px;
    border: 1px solid var(--sep-light);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
}

/* --- Kacheln --------------------------------------------------------------- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
    gap: 14px;
}
/* Die App-Kacheln sind <button> in einem <form> (POST statt GET, s. open.php),
   die Nutzerverwaltungs-Kachel bleibt ein <a>. Beide sollen identisch aussehen,
   daher hier zusätzlich der Button-Reset. */
.tile-form { display: contents; }
.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    border: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 30px 14px;
    text-align: center;
}
.tile:active { background: var(--sep-light); }
.tile-icon { width: 44px; height: 44px; color: var(--accent); }
.tile-icon svg { width: 100%; height: 100%; }
.tile-name { font-size: 15px; font-weight: 600; }
.tile-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    background: rgba(0, 122, 255, 0.1);
    padding: 3px 7px;
    border-radius: 999px;
}
.tile-note { font-size: 12px; font-weight: 400; color: var(--text-2); }

/* --- Listen (Zentrale Nutzerverwaltung) ------------------------------------ */
.list { background: var(--card); border-radius: var(--radius-lg); overflow: hidden; }
.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--sep-light);
}
.list-row:last-child { border-bottom: none; }
.list-row-main { flex: 1; min-width: 0; }
.list-row-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.list-row-subtitle { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.list-row-actions { display: flex; gap: 8px; flex-shrink: 0; }
.list-empty { padding: 32px 16px; text-align: center; color: var(--text-2); font-size: 14px; }

.btn-icon { width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 8px; }

.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}
.badge-app { background: var(--sep-light); color: var(--text-2); }
.badge-admin { background: rgba(0, 122, 255, 0.1); color: var(--accent); }
.badge-pending { background: rgba(255, 149, 0, 0.15); color: #FF9500; }
.badge-success { background: var(--green-bg); color: #248A3D; }

/* --- Suche + App-Filter (Zentrale Nutzerverwaltung) ------------------------ */
.list-search-input {
    display: block;
    width: 100%;
    font-size: 15px;
    padding: 11px 14px;
    border: 1.5px solid var(--sep-light);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    margin-bottom: 10px;
}
.list-search-input:focus { outline: none; border-color: var(--accent); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filter-chip {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border: none;
    border-radius: 999px;
    background: var(--card);
    color: var(--text-2);
    cursor: pointer;
}
.filter-chip.is-active { background: var(--accent); color: #fff; }

/* --- Modal-Overlay (Mail-Vorschau, s. pages/mails.php) --------------------
   Kleine, eigene Kopie des gleichnamigen Musters aus der Fitness-App
   (kein gemeinsamer Code über die apps/-Grenze hinweg, s. README) — hier auf
   das Nötigste für eine Vorschau reduziert (kein Kalender-Grid o.ä.). */
.calendar-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 39;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.calendar-modal-overlay.is-open { opacity: 1; pointer-events: auto; }
.calendar-modal {
    background: var(--card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transform: scale(0.96);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.calendar-modal-overlay.is-open .calendar-modal { transform: scale(1); opacity: 1; }
