@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --bg: #F7F4EA;
    --panel: #FFFDF7;
    --border: #E6DEC7;
    --text: #2B3A26;
    --text-dim: #75816B;

    --leaf: #4F9153;
    --leaf-dark: #3B7A40;
    --leaf-light: #E7F2E2;

    --sun: #F2B705;
    --sun-light: #FDF1CC;

    --soil: #8B5E34;
    --soil-light: #F0E3D2;

    --danger: #D14F3E;
    --danger-light: #FBE4E0;

    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 14px rgba(139, 111, 52, 0.10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

h1, h2, .growth-step-label, .btn-primary, .experiment-title-input {
    font-family: 'Baloo 2', sans-serif;
}

button, input, select, textarea, label { font-family: inherit; }

*:focus-visible {
    outline: 3px solid var(--leaf);
    outline-offset: 2px;
}

/* ============ HEADER ============ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 24px;
    background: var(--panel);
    border-bottom: 3px solid var(--leaf-light);
}

.header-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.header-left h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}
.header-left h1 span { color: var(--leaf-dark); }

.badge-free {
    font-size: 12px;
    font-weight: 700;
    color: var(--leaf-dark);
    background: var(--leaf-light);
    padding: 5px 12px;
    border-radius: 999px;
}

.header-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ============ FORM ELEMENTS ============ */
select, input[type="text"], textarea {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
}
select:focus, input[type="text"]:focus, textarea:focus {
    border-color: var(--leaf);
}

.btn {
    background: var(--panel);
    border: 2px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.btn-primary:hover { background: var(--leaf-dark); }

.btn-success { background: var(--sun); border-color: var(--sun); color: #4A3600; }

.btn-outline-danger { background: var(--danger-light); border-color: var(--danger-light); color: var(--danger); }
.btn-outline-danger:hover { background: #f6d3cd; }

.btn-print {
    background: var(--soil);
    border-color: var(--soil);
    color: #fff;
    margin-left: auto;
}
.btn-print:hover { background: #734b29; }

/* ============ ADD EXPERIMENT FORM ============ */
.add-experiment-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 24px;
    background: var(--sun-light);
    border-bottom: 2px solid var(--border);
}
.add-experiment-form input { flex: 1; min-width: 220px; }

/* ============ MAIN ============ */
main { max-width: 820px; margin: 0 auto; padding: 24px 20px 40px; }

.empty-state {
    text-align: center;
    color: var(--text-dim);
    background: var(--panel);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 50px 24px;
    font-size: 16px;
}
.empty-state p:first-child { font-size: 20px; margin-bottom: 8px; }

.experiment-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.experiment-title-input {
    font-size: 20px;
    font-weight: 700;
    flex: 1;
    min-width: 220px;
    border: none;
    background: transparent;
    padding: 4px 0;
}
.experiment-title-input:focus { border-bottom: 2px solid var(--leaf); }
.experiment-plant-input { min-width: 170px; }
.experiment-start {
    font-size: 13px;
    color: var(--text-dim);
    white-space: nowrap;
    background: var(--soil-light);
    padding: 5px 12px;
    border-radius: 999px;
}

/* ============ WACHSTUMSPFAD (das Herzstück) ============ */
.growth-path {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 24px;
    padding: 20px 8px 4px;
}
.growth-path::before {
    content: '';
    position: absolute;
    top: 38px;
    left: 12%;
    right: 12%;
    height: 4px;
    background: repeating-linear-gradient(to right, var(--border) 0, var(--border) 8px, transparent 8px, transparent 14px);
    z-index: 0;
}
.growth-step {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.growth-step-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--panel);
    border: 3px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    position: relative;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.growth-step:hover .growth-step-icon { transform: scale(1.05); }
.growth-step.active .growth-step-icon {
    border-color: var(--sun);
    background: var(--sun-light);
    box-shadow: 0 0 0 4px rgba(242, 183, 5, 0.25);
}
.growth-step-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    text-align: center;
}
.growth-step.active .growth-step-label { color: var(--text); }
.growth-step-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--leaf);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ============ ENTRY FORM ============ */
.entry-form {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}
.entry-form textarea {
    width: 100%;
    resize: vertical;
    margin-bottom: 12px;
    min-height: 56px;
}
.entry-form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.photo-btn {
    background: var(--leaf-light);
    border: 2px solid var(--leaf-light);
    color: var(--leaf-dark);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.photo-btn:hover { background: #d9ecd2; }
.photo-preview {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
}

/* ============ ENTRIES LIST ============ */
.entries-list { display: flex; flex-direction: column; gap: 12px; }
.entry-card {
    display: flex;
    gap: 14px;
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    position: relative;
    box-shadow: var(--shadow);
}
.entry-photo {
    width: 68px;
    height: 68px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    border: 2px solid var(--border);
}
.entry-body { flex: 1; }
.entry-date {
    font-size: 11px;
    font-weight: 700;
    color: var(--leaf-dark);
    margin-bottom: 4px;
}
.entry-note { font-size: 14px; }
.entry-delete {
    position: absolute;
    top: 8px;
    right: 10px;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 18px;
    background: none;
    border: none;
    line-height: 1;
}
.entry-delete:hover { color: var(--danger); }
.no-entries-hint {
    color: var(--text-dim);
    font-size: 13px;
    text-align: center;
    padding: 20px 0;
}

/* ============ KAMERA-MODAL ============ */
.camera-modal {
    position: fixed;
    inset: 0;
    background: rgba(43, 58, 38, 0.75);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.camera-modal-inner {
    background: var(--panel);
    border-radius: var(--radius-lg);
    padding: 16px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}
.camera-modal-inner video {
    width: 100%;
    border-radius: var(--radius-md);
    background: #000;
    display: block;
}
.camera-modal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
}

/* ============ FOOTER ============ */
.footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 24px;
    border-top: 2px solid var(--border);
    color: var(--text-dim);
    font-size: 12px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 560px) {
    .header { padding: 14px 16px; }
    main { padding: 18px 14px 32px; }
    .growth-path::before { left: 8%; right: 8%; }
    .growth-step-icon { width: 46px; height: 46px; font-size: 20px; }
    .growth-step-label { font-size: 10.5px; }
}

/* ============ PRINT REPORT ============ */

.print-only {
    display: none;
}

@media print {

    /* ---------- Grundlayout ---------- */

    html,
    body {
        background: #fff !important;
        color: #1a1a1a !important;
        margin: 0;
        padding: 0;
        font-family: 'Nunito', sans-serif;
    }

    .no-print {
        display: none !important;
    }

    .print-only {
        display: block !important;
        width: 100%;
        max-width: none;
        padding: 0;
        margin: 0;
    }

    /* ---------- Kopf ---------- */

    .print-header {
        text-align: center;
        margin-bottom: 16px;
    }

    .print-header h1 {
        font-family: 'Baloo 2', sans-serif;
        margin: 0 0 4px 0;
        font-size: 24pt;
        color: #3B7A40 !important;
    }

    .print-sub {
        font-size: 11pt;
        color: #555 !important;
    }

    .fill-line {
        display: inline-block;
        min-width: 180px;
        border-bottom: 1px solid #333;
        margin: 0 4px;
    }

    .fill-line.short {
        min-width: 100px;
    }

    /* ---------- Experiment-Information ---------- */

    .print-meta {
        border: 2px solid #d8cfae;
        border-radius: 10px;
        padding: 10px 16px;
        margin-bottom: 18px;
        font-size: 11pt;
        background: #FAF7EE !important;
    }

    .print-meta p {
        margin: 3px 0;
    }

    /* ---------- Phasen ---------- */

    .print-phase {
        margin-bottom: 22px;
        page-break-inside: auto;
        break-inside: auto;
    }

    .print-phase h2 {
        font-family: 'Baloo 2', sans-serif;
        font-size: 14pt;
        color: #3B7A40 !important;
        border-bottom: 2px solid #4F9153;
        padding-bottom: 3px;
        margin: 0 0 10px 0;

        /* Überschrift nicht allein am Seitenende */
        page-break-after: avoid;
        break-after: avoid;
    }

    /* ---------- Eintrag ---------- */

    .print-entry {
        display: flex;
        align-items: flex-start;
        gap: 12px;

        width: 100%;
        margin-bottom: 12px;

        /*
         * Ein einzelner Eintrag soll möglichst
         * nicht auf zwei Seiten verteilt werden.
         */
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* ---------- Foto ---------- */

    .print-photo-wrapper {
        width: 100px;
        height: 100px;

        flex: 0 0 100px;

        display: flex;
        align-items: center;
        justify-content: center;

        overflow: hidden;
    }

    .print-entry img {
        display: block;

        width: 100px;
        height: 100px;

        max-width: 100%;
        max-height: 100%;

        object-fit: cover;

        border-radius: 8px;
        border: 1px solid #ccc;

        /*
         * Wichtig für den Druck:
         * Browser soll das Bild nicht ausblenden.
         */
        visibility: visible !important;
        opacity: 1 !important;

        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* ---------- Text zum Foto ---------- */

    .print-entry-body {
        flex: 1;
        min-width: 0;

        font-size: 10.5pt;
        line-height: 1.45;
    }

    .print-entry-date {
        color: #555 !important;
        font-size: 9pt;
        font-weight: 700;
        margin-bottom: 4px;
    }

    .print-entry-note {
        white-space: pre-wrap;
        overflow-wrap: anywhere;
    }

    /* ---------- Keine Einträge ---------- */

    .print-no-entries {
        color: #888 !important;
        font-size: 10pt;
        font-style: italic;
        margin: 6px 0 12px 0;
    }

    /* ---------- Footer ---------- */

    .print-footer {
        margin-top: 28px;
        text-align: center;
        border-top: 3px dashed #C9A063;
        padding-top: 14px;

        page-break-inside: avoid;
        break-inside: avoid;
    }

    .print-signature {
        margin-top: 10px;
        font-size: 10.5pt;
    }

    .print-brand {
        margin-top: 10px;
        font-size: 9pt;
        color: #888 !important;
    }

    /* ---------- Druckseite ---------- */

    @page {
        size: auto;
        margin: 15mm;
    }

    /*
     * Hintergrundfarben und Bilder dürfen im Druck
     * erhalten bleiben, sofern der Browser dies unterstützt.
     */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

}