:root {
    --primary: #2e7d32;
    --primary-dark: #1b5e20;
    --secondary: #558b2f;
    --danger: #c62828;
    --bg: #f5f5f5;
    --text: #212121;
    --text-light: #757575;
    --border: #e0e0e0;
    --white: #ffffff;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    
    --tree-obst: #ff6b6b;
    --tree-kirsche: #ee5a6f;
    --tree-walnuss: #8b4513;
    --tree-birne: #ffd93d;
    --tree-sorbus: #4ecdc4;
    --tree-speierling: #95e1d3;
    --tree-elsbeere: #a8dadc;
    --tree-default: #666666;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding-bottom: 2rem;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    padding: 2rem 1rem;
    margin: -1rem -1rem 2rem;
    text-align: center;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

.status-bar {
    background: var(--white);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

#savedCount {
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    font-weight: 500;
}

#savedCount:hover {
    color: var(--primary);
    transform: translateX(2px);
}

.online {
    color: #4caf50;
    font-size: 1.2rem;
}

.offline {
    color: #f44336;
    font-size: 1.2rem;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 150px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: var(--white);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #fafafa;
    border-color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    margin-top: 1rem;
}

.btn-danger:hover {
    background: #b71c1c;
}

.form-section {
    background: var(--white);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.form-section h2 {
    color: var(--primary);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    /* Firefox Android: touch-action: manipulation verhindert Doppel-Tap-Zoom-Verzögerung
       und verbessert die Tastatur-Stabilität bei Eingabefeldern */
    touch-action: manipulation;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.checkbox-group label:hover {
    background: #f5f5f5;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.mt-1 {
    margin-top: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.form-actions .btn {
    flex: 1;
}

.location-info {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #e8f5e9;
    border-radius: 6px;
    font-size: 0.9rem;
    display: none;
    border-left: 4px solid #4caf50;
}

.location-info.active {
    display: block;
}

.location-info.error {
    background: #ffebee;
    border-left-color: #f44336;
    color: #c62828;
    font-weight: 500;
}

.photo-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.photo-preview img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.photo-info-box {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 0.5rem;
}

.photo-info-box p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.photo-info-box p:first-child {
    margin-top: 0;
}

.photo-info-box strong {
    color: var(--primary);
}

.photo-info-box em {
    color: var(--text-light);
    font-size: 0.9rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal.active {
    display: block;
}

.modal-content {
    background: var(--white);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: var(--text);
}

/* Data Screen */
.data-screen {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.data-screen h2 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.data-actions {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

#dataList {
    margin: 1.5rem 0;
}

.data-group {
    margin-bottom: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
}

.data-group-header {
    background: var(--primary);
    color: var(--white);
    padding: 0.75rem 1rem;
    margin: 0;
    font-size: 1.1rem;
}

.duplicate-group .data-group-header {
    background: #f44336;
}

.data-group-items {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: #fafafa;
}

.data-item {
    background: #ffffff;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    flex: 1;
    min-width: 300px;
}

.duplicate-item {
    border-left-color: #f44336;
}

.data-item h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.data-item p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.data-item-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.data-item-actions button {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    flex: 1;
    min-width: 100px;
}

@media (max-width: 600px) {
    .container {
        padding: 0.5rem;
    }
    
    header {
        margin: -0.5rem -0.5rem 1rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        min-width: auto;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 1.5rem;
    }
    
    .data-screen {
        padding: 1rem;
    }
    
    .data-screen h2 {
        font-size: 1.3rem;
    }
}

input:invalid {
    border-color: #ff9800;
}

input[type="file"] {
    padding: 0.5rem;
}

.help-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 2px 6px rgba(46, 125, 50, 0.3);
    animation: pulse-help 2s ease-in-out infinite;
}

.help-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.5);
    animation: none;
}

.help-btn::after {
    content: "Hilfe";
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--white);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: normal;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.help-btn:hover::after {
    opacity: 1;
}

@keyframes pulse-help {
    0%, 100% {
        box-shadow: 0 2px 6px rgba(46, 125, 50, 0.3);
    }
    50% {
        box-shadow: 0 2px 6px rgba(46, 125, 50, 0.3), 0 0 0 4px rgba(46, 125, 50, 0.2);
    }
}

.help-modal-content {
    max-width: 600px;
}

.help-modal-content h3 {
    color: var(--primary);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.help-modal-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.help-modal-content img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.help-modal-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.help-modal-content ol li {
    margin-bottom: 0.5rem;
}

@media print {
    .action-buttons,
    .form-actions,
    header,
    .status-bar {
        display: none;
    }
    
    .form-section {
        break-inside: avoid;
    }
}
/* Tree Map Visualization */
.tree-map-container {
    background: var(--white);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.tree-map-container h3 {
    margin-bottom: 1rem;
    color: var(--text);
}

#treeMapCanvas {
    width: 100%;
    height: 400px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: #fafafa;
    cursor: grab;
    touch-action: none;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #333;
}

.legend-count {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Welcome Screen */
.welcome-screen {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.welcome-content h2 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.project-info {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary);
}

.project-info h2 {
    color: var(--primary);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    text-align: left;
}

.project-info p {
    color: var(--text);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.project-info p:last-child {
    margin-bottom: 0;
}

.project-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    background: var(--white);
    border-radius: 6px;
    border: 2px solid var(--primary);
    transition: all 0.3s ease;
}

.project-link:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(46, 125, 50, 0.2);
}

.install-section {
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary);
}

.install-section h3 {
    color: var(--text);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.install-section ol {
    margin-left: 1.5rem;
    line-height: 1.8;
}

.install-section ol li {
    margin-bottom: 0.5rem;
    color: var(--text);
}

.install-note {
    background: #e8f5e9;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #4caf50;
}

.install-note p {
    margin: 0;
    color: var(--text);
    font-weight: 500;
}

.btn-large {
    font-size: 1.1rem;
    padding: 1rem 2rem;
    width: 100%;
    margin-top: 0.5rem;
}

@media (max-width: 600px) {
    .welcome-screen {
        padding: 1.5rem;
    }
    
    .welcome-content h2 {
        font-size: 1.3rem;
    }
    
    .install-section {
        padding: 1rem;
    }
    
    .install-section h3 {
        font-size: 1.1rem;
    }
}