/* =====================================================================
   schatzwoerter.at - Haupt-Stylesheet
   Kindgerechtes Design: warme Farben, große Touch-Ziele, Nunito-Font
   ===================================================================== */

/* ---------------------------------------------------------------------
   Design-Tokens (Custom Properties)
   --------------------------------------------------------------------- */
:root {
    /* Hauptfarben - warm und freundlich */
    --c-sun: #FAC775;
    --c-sun-dark: #BA7517;
    --c-grass: #1D9E75;
    --c-grass-dark: #0F6E56;
    --c-grass-light: #E1F5EE;
    --c-sky: #378ADD;
    --c-sky-dark: #185FA5;
    --c-sky-light: #E6F1FB;
    --c-rose: #D4537E;
    --c-rose-light: #FBEAF0;
    --c-coral: #F0997B;
    --c-coral-light: #FAECE7;
    --c-purple: #7F77DD;

    /* Neutrale */
    --c-text: #2C2C2A;
    --c-text-soft: #5F5E5A;
    --c-bg: #FFFBF3;
    --c-card: #FFFFFF;
    --c-border: #E8E5DC;
    --c-border-strong: #888780;

    /* Schatten */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

    /* Abstände */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    /* Schrift */
    --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-letters: 'ABeeZee', 'Andika', 'Nunito', sans-serif;
}

/* ---------------------------------------------------------------------
   Reset & Basis
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.5;
    color: var(--c-text);
    background: var(--c-bg);
    background-image:
        radial-gradient(circle at 12% 20%, rgba(250, 199, 117, 0.10) 0%, transparent 40%),
        radial-gradient(circle at 88% 80%, rgba(29, 158, 117, 0.08) 0%, transparent 40%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
    margin: 0 0 0.5em 0;
    font-weight: 800;
    line-height: 1.2;
    color: var(--c-text);
}
h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em 0; }

a { color: var(--c-sky-dark); }

/* ---------------------------------------------------------------------
   Layout
   --------------------------------------------------------------------- */
.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 4rem;
    min-height: 100vh;
}

.brand {
    text-align: center;
    margin: 0.5rem 0 2rem;
}
.brand-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--c-sun-dark);
    margin: 0;
    letter-spacing: -0.02em;
}
.brand-title .icon { display: inline-block; transform: translateY(2px); }
.brand-sub {
    color: var(--c-text-soft);
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
}

/* ---------------------------------------------------------------------
   Karten / Boxen
   --------------------------------------------------------------------- */
.card {
    background: var(--c-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--c-border);
    margin-bottom: 1.25rem;
}
.card-soft {
    background: var(--c-grass-light);
    border-color: var(--c-grass);
}
.card-warning {
    background: var(--c-coral-light);
    border-color: var(--c-coral);
}

/* ---------------------------------------------------------------------
   Formulare
   --------------------------------------------------------------------- */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
    color: var(--c-text);
}

.form-help {
    font-size: 0.85rem;
    color: var(--c-text-soft);
    margin-top: 0.3rem;
}

.form-control {
    width: 100%;
    font-family: inherit;
    font-size: 1.05rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-card);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--c-sky);
    box-shadow: 0 0 0 4px var(--c-sky-light);
}

/* PIN-Eingabe größer und mittig */
.form-pin {
    text-align: center;
    letter-spacing: 0.4em;
    font-size: 1.4rem;
    font-weight: 700;
}

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 52px;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.18s,
                background 0.15s,
                filter 0.18s;
    box-shadow: var(--shadow-sm);
    -webkit-tap-highlight-color: transparent;
}
/* Sanftes Heben mit weichem Glow auf Hover */
.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    filter: brightness(1.05);
}
/* Federnder Drück-Effekt */
.btn:active {
    transform: translateY(1px) scale(0.97);
    transition-duration: 0.08s;
}

.btn-primary {
    background: var(--c-grass);
    color: white;
}
.btn-primary:hover {
    background: var(--c-grass-dark);
    box-shadow: 0 4px 14px rgba(29, 158, 117, 0.35);
}

.btn-secondary {
    background: var(--c-card);
    color: var(--c-text);
    border: 2px solid var(--c-border);
}
.btn-secondary:hover {
    border-color: var(--c-border-strong);
    box-shadow: 0 4px 12px rgba(99, 56, 6, 0.12);
}

.btn-sun {
    background: var(--c-sun);
    color: var(--c-sun-dark);
}
.btn-sun:hover {
    background: #f7be63;
    box-shadow: 0 4px 14px rgba(250, 199, 117, 0.5);
}

/* "Weiter"-Button im Erfolgs-Feedback pulsiert sanft, um Aufmerksamkeit zu lenken */
.feedback-success .btn-primary,
.feedback-content .btn-primary {
    animation: gentle-pulse 1.6s ease-in-out infinite;
}
@keyframes gentle-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 14px rgba(29, 158, 117, 0.35); }
    50%      { transform: scale(1.03); box-shadow: 0 6px 18px rgba(29, 158, 117, 0.5); }
}
.feedback-content .btn-primary:hover {
    animation: none;
}

.btn-block { width: 100%; }

.btn-large {
    min-height: 64px;
    font-size: 1.2rem;
    padding: 1rem 2rem;
}

.btn-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.btn-row .btn { flex: 1 1 auto; }

/* ---------------------------------------------------------------------
   Alerts / Fehler
   --------------------------------------------------------------------- */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-weight: 600;
    border: 2px solid;
}
.alert-error {
    background: #FDE9E7;
    border-color: #E24B4A;
    color: #8A1A19;
}
.alert-success {
    background: var(--c-grass-light);
    border-color: var(--c-grass);
    color: var(--c-grass-dark);
}
.alert-info {
    background: var(--c-sky-light);
    border-color: var(--c-sky);
    color: var(--c-sky-dark);
}

/* ---------------------------------------------------------------------
   Avatar-Auswahl
   --------------------------------------------------------------------- */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.avatar-option {
    position: relative;
    cursor: pointer;
    border-radius: var(--radius-md);
    padding: 0.5rem;
    background: var(--c-card);
    border: 2px solid var(--c-border);
    text-align: center;
    transition: all 0.15s;
}
.avatar-option:hover { border-color: var(--c-sky); }
.avatar-option input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-option:has(input:checked) {
    border-color: var(--c-grass);
    background: var(--c-grass-light);
    box-shadow: 0 0 0 4px rgba(29, 158, 117, 0.15);
}
.avatar-option svg { width: 56px; height: 56px; margin: 0 auto; display: block; }
.avatar-option .avatar-name {
    font-size: 0.8rem;
    margin-top: 0.2rem;
    color: var(--c-text-soft);
    font-weight: 600;
}

/* ---------------------------------------------------------------------
   Links / Sekundär-Aktionen
   --------------------------------------------------------------------- */
.text-center { text-align: center; }
.muted { color: var(--c-text-soft); font-size: 0.92rem; }
.small { font-size: 0.85rem; }

.divider {
    text-align: center;
    margin: 1.5rem 0;
    color: var(--c-text-soft);
    font-size: 0.9rem;
    position: relative;
}
.divider::before, .divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: var(--c-border);
}
.divider::before { left: 0; }
.divider::after { right: 0; }

/* ---------------------------------------------------------------------
   Utilities
   --------------------------------------------------------------------- */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* ---------------------------------------------------------------------
   Hover-Effekte nur auf Geräten mit echtem Hover (Maus)
   Auf Touch-Geräten würde sonst der Hover-State "hängenbleiben"
   --------------------------------------------------------------------- */
@media (hover: none) {
    .btn:hover {
        transform: none;
        filter: none;
    }
}

/* Bewegung reduzieren respektieren */
@media (prefers-reduced-motion: reduce) {
    .btn { transition-duration: 0.05s; }
    .feedback-content .btn-primary { animation: none; }
}
