/* =====================================================================
   Wäsche-App — Design-System "iOS Native Light"
   Reines CSS, keine Frameworks. Mobile-first, Desktop nachrangig.
   Design-Tokens/Grundkomponenten 1:1 aus der Fitness-App übernommen, damit
   sich alle lixapps-Apps optisch vertraut anfühlen (kein gemeinsamer Code
   über die apps/-Grenze hinweg — jede App hat ihre eigene Kopie).
   ===================================================================== */

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

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: contain;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, p { margin: 0; }

#editTypeCard, #typeManagementList, #editUserCard, #editInviteCard, #userManagementList {
    scroll-margin-top: calc(var(--header-h) + var(--safe-top) + 12px);
}

/* --- App-Header (kein Burger-Menü) --------------------------------------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
    height: calc(var(--header-h) + var(--safe-top));
    padding: var(--safe-top) 12px 0;
    background: rgba(242, 242, 247, 0.92);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--sep-light);
}
.app-header-title { flex: 1; font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-header-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.app-header-user { font-size: 13px; color: var(--text-2); margin-right: 4px; }

/* --- Main / Layout --------------------------------------------------------- */
.app-main { padding: 16px 16px calc(24px + var(--safe-bottom)); max-width: 640px; margin: 0 auto; }

/* --- Section-Header --------------------------------------------------------- */
.section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 20px 0 10px; }
.section-header:first-child { margin-top: 4px; }
.section-title { font-size: 20px; font-weight: 700; }
.section-subtitle { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* --- Karten --------------------------------------------------------------- */
.card { background: var(--card); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 12px; }

/* --- Listen --------------------------------------------------------------- */
.list { background: var(--card); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 12px; }
.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 16px;
    min-height: 44px;
    border-bottom: 1px solid var(--sep-light);
}
.list-row:last-child { border-bottom: none; }
.list-row-title { font-size: 16px; font-weight: 500; }
.list-row-subtitle { font-size: 13px; color: var(--text-2); margin-top: 1px; }
.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; }

.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 100px;
    vertical-align: middle;
}
.badge-success { background: var(--green-bg); color: #248A3D; }
.badge-pending { background: rgba(255, 149, 0, 0.15); color: var(--orange); }
.badge-admin { background: rgba(0, 122, 255, 0.12); color: var(--accent); }

/* --- Mengen-Auswahl (Startseite) ------------------------------------------ */
.qty-stepper { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--sep-light);
    color: var(--accent);
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.qty-btn:active { background: var(--sep); }
.qty-input {
    width: 40px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--sep);
    border-radius: 8px;
    padding: 6px 2px;
    background: var(--card);
    color: var(--text);
    appearance: none;
    -webkit-appearance: none;
}
.qty-input:focus { outline: none; border-color: var(--accent); }

/* --- Ladungs-Ergebniskarten ------------------------------------------------ */
.load-card-title { font-size: 17px; font-weight: 700; }
.load-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--sep-light);
}
.load-spec-label { display: block; font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.03em; }
.load-spec-value { display: block; font-size: 15px; font-weight: 600; margin-top: 2px; }

/* --- Buttons --------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 20px;
    border-radius: var(--radius);
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}
.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-secondary:active { background: rgba(0, 122, 255, 0.2); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:active { background: #FFDADA; }
.btn-plain { background: none; color: var(--accent); padding: 0 8px; min-height: 36px; font-weight: 500; }
.btn-icon { width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 8px; }
.btn:disabled { opacity: 0.4; }

/* --- Formulare --------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field input[type="email"],
.field select {
    width: 100%;
    font-size: 16px;
    padding: 12px 14px;
    border: 1px solid var(--sep);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    appearance: none;
    -webkit-appearance: none;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15); }
.field-hint { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

/* --- Flash / Toast --------------------------------------------------------- */
.flash { padding: 12px 14px; border-radius: var(--radius); font-size: 14px; margin-bottom: 14px; }
.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); }

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + var(--safe-bottom));
    transform: translate(-50%, 20px);
    background: rgba(28, 28, 30, 0.92);
    color: #fff;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 50;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* --- Login-Formular ------------------------------------------------------ */
.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; }
.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: 1px solid var(--sep); border-radius: var(--radius); background: var(--card); }
.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); text-align: center; text-decoration: none; }
.login-invite-link:hover { color: var(--accent); text-decoration: underline; }

.select-on-click { cursor: pointer; }

/* --- Utility --------------------------------------------------------------- */
.text-secondary { color: var(--text-2); }
.text-center { text-align: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* --- Desktop (nachrangig, aber vorhanden) --------------------------------- */
@media (min-width: 768px) {
    .app-main { padding: 24px 16px 40px; }
    .card, .list { margin-bottom: 16px; }
}
