/* MyPetStory, Design-System 2.0
   Modern, warm, mobil-first. Hell/Dunkel automatisch (prefers-color-scheme).
   Enthält Alias-Variablen für ältere Inline-Styles der Seiten. */

:root {
    /* Farben */
    --primary-50:  #ecfdf5;
    --primary-100: #d1fae5;
    --primary-200: #a7f3d0;
    --primary-500: #10b981;
    --primary-600: #059669;
    --primary-700: #047857;
    --primary-800: #065f46;
    --secondary-500: #f59e0b;
    --secondary-800: #92400e;
    --accent: #f97316;
    --danger: #e11d48;
    --danger-soft: #ffe4e6;
    --warning-soft: #fef3c7;
    --success-soft: #d1fae5;

    --bg: #f4f7f5;
    --bg-tertiary: #eaf0ec;
    --surface: #ffffff;
    --surface-2: #f8faf9;
    --border: #e3e9e5;
    --border-light: #edf1ee;
    --text-primary: #16211c;
    --text-secondary: #55655d;
    --text-tertiary: #83918a;
    --text-inverse: #ffffff;

    --gradient-forest: linear-gradient(135deg, #059669 0%, #10b981 55%, #34d399 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    --primary-gradient: var(--gradient-forest);

    /* Radien / Schatten / Abstände */
    --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 22px; --radius-full: 999px;
    --shadow-sm: 0 1px 2px rgba(16, 33, 28, .06);
    --shadow-md: 0 4px 14px rgba(16, 33, 28, .08);
    --shadow-lg: 0 12px 30px rgba(16, 33, 28, .12);
    --shadow-2xl: 0 30px 60px rgba(16, 33, 28, .28);
    --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-5: 1.25rem;
    --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem; --space-16: 4rem;
    --space-sm: .5rem; --space-md: 1rem; --space-lg: 1.5rem; --space-xl: 2rem; --space-2xl: 3rem;
    --font-size-sm: .875rem; --font-size-lg: 1.125rem; --font-size-3xl: 1.9rem;
    --font-weight-medium: 500; --font-weight-semibold: 600; --line-height-relaxed: 1.7;
    --transition-all: all .2s ease;
    --z-50: 10000;

    /* Legacy-Aliase */
    --primary-green: var(--primary-600); --dark-green: var(--primary-800);
    --text-color: var(--text-primary); --text-muted: var(--text-tertiary);
    --section-background: var(--surface); --button-hover: var(--primary-700);
    --accent-brown: var(--secondary-800);

    --header-top-height: 3.5rem;
    --navbar-bottom-height: 3.75rem;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e1512; --bg-tertiary: #18221d; --surface: #16201b; --surface-2: #1b2721;
        --border: #263329; --border-light: #1f2b25;
        --text-primary: #ecf3ef; --text-secondary: #a5b5ac; --text-tertiary: #7b8c83;
        --primary-50: #0f2a20; --primary-100: #12382a; --primary-200: #17503a;
        --danger-soft: #3a1620; --warning-soft: #3a2f10; --success-soft: #0f3324;
        --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 4px 14px rgba(0,0,0,.4); --shadow-lg: 0 12px 30px rgba(0,0,0,.5);
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }

body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px; line-height: 1.55;
    color: var(--text-primary);
    background:
        radial-gradient(900px 400px at 100% -10%, color-mix(in srgb, var(--primary-500) 12%, transparent), transparent 60%),
        radial-gradient(700px 380px at -10% 0%, color-mix(in srgb, var(--secondary-500) 10%, transparent), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-600); text-decoration: none; }
a:hover { color: var(--primary-700); }
h1, h2, h3, h4 { margin: 0 0 .6rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
p { margin: 0 0 .75rem; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary-500) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--primary-200); color: var(--text-primary); }

#custom-chatbot { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ===== Header oben ===== */
.header-top {
    position: fixed; inset: 0 0 auto 0; z-index: 9998;
    height: var(--header-top-height);
    padding-top: env(safe-area-inset-top, 0);
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
}
.header-top-logo { font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em;
    background: var(--gradient-forest); -webkit-background-clip: text; background-clip: text; color: transparent; }
.header-top-logo:hover { color: transparent; opacity: .85; }
body.has-top-header, body:has(.header-top) { padding-top: calc(var(--header-top-height) + env(safe-area-inset-top, 0)); }

/* ===== Layout ===== */
.main-content { max-width: 1100px; margin: 0 auto; padding: 1.75rem 1rem calc(var(--navbar-bottom-height) + 2.5rem); }
.container, .dashboard-container, .dailybook-container { max-width: 1100px; margin: 0 auto; }
.section-header { margin-bottom: 1.25rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.section-title { font-size: 1.5rem; margin: 0; }
.greeting { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.section-subtitle { font-size: 1rem; color: var(--text-secondary); margin: 0; flex-basis: 100%; }

.card, .no-pets-message {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 1.4rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-sm);
}
.no-pets-message { text-align: center; padding: 2.5rem 1.5rem; background: var(--surface-2); border-style: dashed; }

/* ===== Bottom-Navigation (Glas) ===== */
.navbar-bottom {
    position: fixed; inset: auto 0 0 0; z-index: 9999; height: var(--navbar-bottom-height);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px);
    border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom, 0);
}
.navbar-bottom-inner { max-width: 1100px; height: 100%; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 .75rem; }
.navbar-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 56px; padding: .35rem .5rem; border: 0; border-radius: var(--radius-md);
    background: transparent; color: var(--text-secondary); font: inherit; font-size: .7rem; font-weight: 600; cursor: pointer; transition: var(--transition-all); }
.navbar-btn i { font-size: 1.1rem; }
.navbar-btn:hover { background: var(--bg-tertiary); color: var(--primary-700); }
.navbar-logo { font-weight: 800; color: var(--text-primary); }
.navbar-logo:hover { color: var(--primary-600); }
.navbar-burger { gap: 4px; justify-content: center; }
.navbar-burger .burger-line { display: block; width: 22px; height: 2.5px; border-radius: 2px; background: var(--text-primary); transition: transform .25s, opacity .25s; }
.navbar-burger.active .burger-line:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.navbar-burger.active .burger-line:nth-child(2) { opacity: 0; }
.navbar-burger.active .burger-line:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.menu-overlay { position: fixed; inset: 0; z-index: 9997; background: rgba(8, 20, 15, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    display: flex; align-items: flex-end; justify-content: center; opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
.menu-overlay.active { opacity: 1; visibility: visible; }
.menu-content { width: min(560px, 100%); margin: 0 auto calc(var(--navbar-bottom-height) + 12px); padding: 1.25rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); transform: translateY(24px); transition: transform .3s cubic-bezier(.2,.9,.3,1.2); max-height: 75vh; overflow: auto; }
.menu-overlay.active .menu-content { transform: none; }
.menu-content h3 { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-tertiary); margin: .85rem 0 .45rem; }
.menu-content h3:first-child { margin-top: 0; }
.menu-content ul { list-style: none; margin: 0 0 .15rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; }
.menu-content a { display: flex; align-items: center; gap: .7rem; padding: .75rem .9rem; border-radius: var(--radius-md); color: var(--text-primary); background: var(--surface-2); font-weight: 600; font-size: .95rem; transition: var(--transition-all); }
.menu-content a:hover { background: var(--primary-50); color: var(--primary-700); transform: translateY(-1px); }
.menu-content a i { width: 1.2rem; text-align: center; color: var(--primary-600); }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .65rem 1.1rem; border-radius: var(--radius-md); border: 1px solid var(--border);
    background: var(--surface); color: var(--text-primary); font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; transition: var(--transition-all); text-decoration: none; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); color: inherit; }
.btn:active { transform: none; }
.btn-sm { padding: .4rem .75rem; font-size: .82rem; border-radius: var(--radius-sm); }
.btn-lg { padding: .85rem 1.4rem; font-size: 1.02rem; }
.btn-primary, .btn-forest { background: var(--gradient-forest); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(5, 150, 105, .28); }
.btn-primary:hover, .btn-forest:hover { color: #fff; box-shadow: 0 10px 22px rgba(5, 150, 105, .35); }
.btn-secondary, .btn-earth { background: var(--surface); }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-danger:hover { color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ===== Formulare ===== */
.form-group { margin-bottom: 1rem; position: relative; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-label { display: block; margin-bottom: .35rem; font-size: .85rem; font-weight: 600; color: var(--text-secondary); }
.form-input, .form-textarea, select, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="tel"], input[type="search"], textarea {
    width: 100%; padding: .7rem .9rem; border-radius: var(--radius-md); border: 1.5px solid var(--border); background: var(--surface); color: var(--text-primary);
    font: inherit; font-size: .97rem; transition: border-color .15s, box-shadow .15s; }
.form-textarea, textarea { min-height: 110px; resize: vertical; }
.form-input:focus, .form-textarea:focus, select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary-500); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-500) 18%, transparent); }
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary-600); width: 1.1rem; height: 1.1rem; }
input[type="file"] { padding: .55rem; }
.form-header { text-align: center; margin-bottom: 1.5rem; }
.form-icon { width: 56px; height: 56px; margin: 0 auto .75rem; border-radius: var(--radius-lg); background: var(--gradient-forest); color: #fff; display: grid; place-items: center; font-size: 1.4rem; box-shadow: 0 8px 20px rgba(5,150,105,.3); }
.form-title { font-size: 1.35rem; }
.form-subtitle { color: var(--text-secondary); margin: 0; }
.file-upload-label { display: block; padding: 1.25rem; border: 2px dashed var(--border); border-radius: var(--radius-lg); text-align: center; cursor: pointer; color: var(--text-secondary); transition: var(--transition-all); }
.file-upload-label:hover { border-color: var(--primary-500); background: var(--primary-50); }
.file-input { max-width: 100%; }
.floating-label .input-icon { position: absolute; left: .9rem; top: 2.35rem; color: var(--text-tertiary); pointer-events: none; }

/* ===== Meldungen ===== */
.message, .error-message, .success-message { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border-radius: var(--radius-md); margin: 0 0 1rem; font-weight: 500; font-size: .95rem; border: 1px solid transparent; }
.message-success, .success-message { background: var(--success-soft); color: var(--primary-800); border-color: var(--primary-200); }
.message-error, .error-message { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.message-warning { background: var(--warning-soft); color: var(--secondary-800); }
body > .error-message, body > .success-message { max-width: 1100px; margin: 1rem auto 0; }
@media (prefers-color-scheme: dark) { .message-success, .success-message { color: #6ee7b7; } .message-error, .error-message { color: #fda4af; } }

/* ===== Haustier-Karten ===== */
.pets-list, .entry-list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.1rem; }
.pet-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-sm); transition: var(--transition-all); display: flex; flex-direction: column; }
.pet-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary-200); }
.pet-image { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.pet-image-placeholder { display: grid; place-items: center; font-size: 3.2rem; background: var(--gradient-forest); }
.pet-details { padding: 1.1rem 1.2rem 1.25rem; display: flex; flex-direction: column; gap: 1rem; flex: 1; justify-content: space-between; }
.pet-name { font-size: 1.25rem; margin: 0 0 .2rem; }
.pet-species { color: var(--text-secondary); margin: 0; font-size: .92rem; }
.pet-age { display: inline-block; margin: .5rem 0 0; padding: .2rem .65rem; border-radius: var(--radius-full); background: var(--primary-50); color: var(--primary-700); font-size: .8rem; font-weight: 600; }
.pet-details .btn { width: 100%; }
.entry-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.1rem; box-shadow: var(--shadow-sm); }
.entry-header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; color: var(--text-secondary); font-size: .85rem; }
.entry-content { color: var(--text-primary); white-space: pre-wrap; }

/* ===== Tabellen, Badges, Utilities ===== */
table { width: 100%; border-collapse: collapse; }
th, td { padding: .65rem .8rem; text-align: left; border-bottom: 1px solid var(--border-light); }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-tertiary); }
.badge { display: inline-block; padding: .15rem .6rem; border-radius: var(--radius-full); background: var(--primary-50); color: var(--primary-700); font-size: .75rem; font-weight: 700; }

/* ===== Register ===== */
.register-container { width: 100%; max-width: 520px; margin: 0 auto; }
.register-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 2rem 1.75rem; box-shadow: var(--shadow-lg); }

/* ===== Animationen ===== */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.fade-in-up, .fade-in { animation: fadeInUp .5s ease both; }
.pets-list .pet-item:nth-child(2) { animation-delay: .06s; } .pets-list .pet-item:nth-child(3) { animation-delay: .12s; } .pets-list .pet-item:nth-child(4) { animation-delay: .18s; }
.loading { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
    .main-content { padding-top: 1.25rem; }
    .card { padding: 1.1rem; }
    .section-title { font-size: 1.3rem; }
}


/* ===== Mobile-first-Feinschliff & Zentrierung ===== */
html, body { overflow-x: hidden; max-width: 100%; }
.header-top { padding-top: env(safe-area-inset-top, 0); height: calc(var(--header-top-height) + env(safe-area-inset-top, 0)); }
.navbar-bottom { height: calc(var(--navbar-bottom-height) + env(safe-area-inset-bottom, 0)); }
body.has-top-header, body:has(.header-top) { padding-top: calc(var(--header-top-height) + env(safe-area-inset-top, 0)); }
.main-content { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); padding-bottom: calc(var(--navbar-bottom-height) + env(safe-area-inset-bottom, 0) + 2rem); }

/* Titel & Kopfbereiche mittig */
.section-header { justify-content: center; text-align: center; }
.section-title, .greeting, .section-subtitle, .form-title, .form-subtitle { text-align: center; }
.section-header > .section-title { flex-basis: 100%; }
.pets-section > .section-header, .add-pet-section > .section-header { flex-direction: column; }
h1.section-title, .section-header h1 { width: 100%; }

/* Touch: min. 44px, 16px-Schrift gegen iOS-Zoom */
.btn, .navbar-btn, .pet-tab, .menu-content a { min-height: 44px; }
.form-input, .form-textarea, select, input, textarea { font-size: 16px; min-height: 48px; }
textarea, .form-textarea { min-height: 110px; }
input[type="checkbox"], input[type="radio"] { min-height: 0; }
button, a, .btn { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

@media (max-width: 640px) {
    .card, .register-card { padding: 1.15rem; border-radius: var(--radius-lg); }
    .btn { width: 100%; }
    .btn-sm, .navbar-btn, .pet-tab, .menu-content a, .header-top .btn { width: auto; }
    .pets-list, .entry-list { grid-template-columns: 1fr; }
    .pet-item { max-width: 480px; margin-inline: auto; width: 100%; }
    .pet-details { text-align: center; }
    .form-row { grid-template-columns: 1fr; }
    .menu-content ul { grid-template-columns: 1fr 1fr; }
    table { display: block; overflow-x: auto; }
}
@media (min-width: 641px) {
    .section-header { justify-content: center; }
}

.register-card form { gap: 0 !important; }
.register-card .form-group { margin-bottom: 1rem; }
.register-card .btn { margin-top: .5rem; }
.register-brand { display: block; text-align: center; margin: 0 0 1rem; color: #ecf3ef; font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.register-brand:hover { color: #fff; }

/* ===== Registrierung (Design 2.0) ===== */
body.register-body { min-height: 100vh; display: block; padding: calc(1rem + env(safe-area-inset-top, 0)) 1rem calc(2rem + env(safe-area-inset-bottom, 0));
    background: radial-gradient(900px 500px at 90% -10%, rgba(52,211,153,.5), transparent 60%), radial-gradient(700px 450px at -10% 100%, rgba(245,158,11,.28), transparent 60%), #0b3d2e; background-attachment: fixed; }
.register-head { text-align: center; margin-bottom: 1.3rem; }
.register-title { font-size: 1.6rem; margin: 0 0 .2rem; }
.register-sub { color: var(--text-secondary); margin: 0; }
.register-foot { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--border-light); text-align: center; }
.register-foot p { color: var(--text-secondary); margin-bottom: .6rem; }
.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1.2rem; }
.type-option { position: relative; cursor: pointer; }
.type-option input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; min-height: 0; cursor: pointer; }
.type-card { display: flex; flex-direction: column; align-items: center; gap: .2rem; text-align: center; padding: .9rem .5rem; border-radius: var(--radius-lg); border: 2px solid var(--border); background: var(--surface-2); transition: var(--transition-all); min-height: 100px; justify-content: center; }
.type-card i { font-size: 1.4rem; color: var(--primary-600); }
.type-card strong { font-size: .95rem; }
.type-card small { color: var(--text-tertiary); font-size: .75rem; }
.type-option input:checked + .type-card { border-color: var(--primary-500); background: var(--primary-50); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-500) 16%, transparent); }
.type-option input:focus-visible + .type-card { outline: 3px solid var(--primary-500); }
.shelter-fields { padding: 1rem; margin-bottom: 1rem; border-radius: var(--radius-lg); background: var(--surface-2); border: 1px dashed var(--primary-200); }
.shelter-fields[hidden] { display: none; }
.check-row { display: flex; gap: .7rem; align-items: flex-start; margin: .4rem 0 1.1rem; font-size: .88rem; color: var(--text-secondary); cursor: pointer; }
.check-row input { margin-top: .2rem; flex: none; }
.legal-links.on-dark { margin-top: 1rem; }
.legal-links.on-dark a { color: rgba(236,243,239,.8); }
.menu-content .legal-links { margin-top: 1rem; padding: .8rem 0 0; border-top: 1px solid var(--border-light); }
.menu-content .legal-links a { background: transparent; padding: 0; min-height: 0; color: var(--text-tertiary); font-size: .8rem; }
