*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green-dark:   #2d6a4f;
    --green-mid:    #40916c;
    --green-light:  #74c69d;
    --green-pale:   #d8f3dc;
    --cream:        #f8f9f4;
    --white:        #ffffff;
    --text:         #1b2a22;
    --text-muted:   #6b7c72;
    --border:       #d0e4d8;
    --shadow:       0 2px 12px rgba(45,106,79,.10);
    --shadow-hover: 0 6px 24px rgba(45,106,79,.18);
    --radius:       14px;
    --radius-sm:    8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--cream);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* ── Header ─────────────────────────────── */
.site-header {
    background: var(--green-dark);
    color: var(--white);
    padding: .9rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.site-header h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .01em;
    display: flex;
    align-items: center;
    gap: .45rem;
}

.site-header h1 .emoji { font-size: 1.3rem; }

.back-link {
    color: var(--white);
    text-decoration: none;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: .3rem;
    opacity: .85;
}
.back-link:hover { opacity: 1; }

/* ── Buttons ─────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.97); }

.btn-primary {
    background: var(--green-mid);
    color: var(--white);
}
.btn-primary:hover { background: var(--green-dark); }

.btn-secondary {
    background: var(--green-pale);
    color: var(--green-dark);
}
.btn-secondary:hover { background: var(--green-light); color: var(--white); }

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
}
.btn-danger:hover { background: #fca5a5; }

.btn-sm { padding: .35rem .75rem; font-size: .8rem; }

.btn-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--green-mid);
    color: var(--white);
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(64,145,108,.45);
    text-decoration: none;
    transition: background .15s, transform .1s, box-shadow .15s;
}
.btn-fab:hover {
    background: var(--green-dark);
    box-shadow: 0 6px 20px rgba(45,106,79,.5);
}
.btn-fab:active { transform: scale(.93); }

/* ── Main content ────────────────────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

/* ── Plant grid ──────────────────────────── */
.plants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.1rem;
}

.plant-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: box-shadow .2s, transform .15s;
}
.plant-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

.card-photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: var(--green-pale);
    display: block;
}
/* ── Card Carousel ───────────────────────── */
.card-carousel {
    position: relative;
    overflow: hidden;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,.35);
    border: none;
    color: #fff;
    font-size: 1rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s, background .15s;
    z-index: 2;
}
.card-carousel:hover .carousel-btn { opacity: 1; }
.carousel-prev { left: .4rem; }
.carousel-next { right: .4rem; }
.carousel-btn:hover { background: rgba(0,0,0,.6); }

.carousel-dots {
    position: absolute;
    bottom: .45rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: .3rem;
    align-items: center;
    z-index: 2;
}
.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,.5);
    transition: background .2s, transform .2s;
}
.carousel-dot.active {
    background: #fff;
    transform: scale(1.3);
}
.carousel-counter {
    font-size: .72rem;
    font-weight: 600;
    color: #fff;
    background: rgba(0,0,0,.4);
    padding: .1rem .45rem;
    border-radius: 20px;
}

.card-photo-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--green-pale);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.card-body {
    padding: .85rem 1rem;
}
.card-name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: .3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-meta {
    font-size: .82rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.card-day {
    font-size: .88rem;
    font-weight: 600;
    color: var(--green-mid);
}
.card-last-entry {
    font-weight: 400;
    color: var(--green-mid);
}

/* ── Page header (within content) ───────── */
.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
}
.page-title > span { flex: 1; }

.entry-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--green-mid);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    padding: 0 .4rem;
    border-radius: 20px;
    margin-left: .45rem;
    vertical-align: middle;
}

/* ── Plant info banner ───────────────────── */
.plant-banner {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: .6rem 1.5rem;
    align-items: flex-start;
}
.plant-banner-name {
    font-size: 1.35rem;
    font-weight: 700;
    width: 100%;
}
.plant-banner-stat {
    font-size: .88rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: .3rem;
}
.plant-banner-stat strong {
    color: var(--text);
    font-weight: 600;
}
.plant-banner-day {
    font-size: 1rem;
    font-weight: 700;
    color: var(--green-dark);
    background: var(--green-pale);
    padding: .25rem .7rem;
    border-radius: 20px;
    align-self: flex-start;
}

/* ── Timeline ────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 1.1rem; }

.entry-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (min-width: 600px) {
    .entry-card { flex-direction: row; }
    .entry-photo-wrap { width: 220px; flex-shrink: 0; }
}

.entry-photo-wrap {
    aspect-ratio: 1 / 1;
    background: var(--green-pale);
    overflow: hidden;
}
.entry-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.entry-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.entry-body {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    flex: 1;
}
.entry-date-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}
.entry-date {
    font-size: .82rem;
    color: var(--text-muted);
}
.entry-time {
    font-size: .78rem;
    color: var(--text-muted);
    opacity: .75;
}
.entry-day-badge {
    font-size: .78rem;
    font-weight: 700;
    color: var(--green-dark);
    background: var(--green-pale);
    padding: .15rem .55rem;
    border-radius: 20px;
}
.entry-note {
    font-size: .9rem;
    color: var(--text);
    white-space: pre-wrap;
    flex: 1;
}
.entry-actions {
    margin-top: auto;
    padding-top: .6rem;
    display: flex;
    gap: .5rem;
}

/* ── Forms ───────────────────────────────── */
.form-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem 1.25rem;
    max-width: 520px;
}

.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: .4rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: .65rem .85rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--cream);
    transition: border-color .15s;
    outline: none;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--green-mid); background: var(--white); }
.form-group textarea { resize: vertical; min-height: 90px; }

.form-group input[type="file"] {
    padding: .5rem .85rem;
    background: var(--cream);
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: 1.4rem;
}

/* ── FAB fixed ───────────────────────────── */
.fab-wrap {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 200;
}

/* ── Empty state ─────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 3.5rem; margin-bottom: .75rem; }
.empty-state p { font-size: 1rem; margin-bottom: 1.25rem; }

/* ── Flash messages ──────────────────────── */
.flash {
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: .9rem;
    font-weight: 500;
}
.flash-success { background: var(--green-pale); color: var(--green-dark); }
.flash-error   { background: #fee2e2; color: #b91c1c; }

/* ── Wachstumskurve ──────────────────────── */
.chart-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem 1rem;
    margin-bottom: 1.5rem;
}
.chart-title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: .75rem;
}
.chart-wrap {
    position: relative;
    height: 220px;
}
.chart-wrap canvas { height: 220px !important; }
.chart-card + .page-title { margin-top: 2rem; }

/* ── Checkbox ────────────────────────────── */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .88rem;
    color: var(--text-muted);
    cursor: pointer;
}
.checkbox-label input { cursor: pointer; }

/* ── Form row (zwei Felder nebeneinander) ── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}
@media (max-width: 400px) { .form-row { grid-template-columns: 1fr; } }

/* ── Feuchtigkeit Radio-Buttons ──────────── */
.moisture-group {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
}
.moisture-option {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0;
}
.moisture-option input[type="radio"] { display: none; }
.moisture-option span {
    padding: .5rem 1.1rem;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    font-size: .88rem;
    font-weight: 500;
    background: var(--cream);
    color: var(--text-muted);
    transition: all .15s;
    user-select: none;
}
.moisture-option input:checked + span,
.moisture-option.selected span {
    background: var(--green-pale);
    border-color: var(--green-mid);
    color: var(--green-dark);
    font-weight: 700;
}
.moisture-option:hover span {
    border-color: var(--green-light);
    color: var(--text);
}

/* ── Entry stats ─────────────────────────── */
.entry-stats {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .8rem;
    margin: .1rem 0 .3rem;
}
.entry-stat {
    font-size: .82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: .2rem;
}

/* ── Lightbox ────────────────────────────── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .75rem;
    padding: 1rem;
}
.lightbox.active { display: flex; }

.lightbox-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 40px rgba(0,0,0,.5);
}

.lightbox-caption {
    color: rgba(255,255,255,.75);
    font-size: .88rem;
    text-align: center;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: fixed;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    border-radius: 50%;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255,255,255,.28); }

.lightbox-close {
    top: 1rem;
    right: 1.1rem;
    font-size: 1.2rem;
    width: 38px;
    height: 38px;
}
.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    width: 46px;
    height: 46px;
}
.lightbox-prev { left: .75rem; }
.lightbox-next { right: .75rem; }

.lightbox-trigger {
    cursor: zoom-in;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 480px) {
    .plants-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
    .container { padding: 1rem .75rem 5rem; }
    .form-card { padding: 1.1rem .9rem; }
}
