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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #a7f3d0 0%, #86efac 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #a7f3d0 0%, #86efac 100%);
    color: #1f2937;
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
}

.controls {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(34, 197, 94, 0.2);
    color: #1f2937;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.btn:hover {
    background: rgba(34, 197, 94, 0.3);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-danger {
    background: rgba(255, 77, 77, 0.8);
}

.btn-danger:hover {
    background: rgba(255, 77, 77, 1);
}

.btn-active {
    background: rgba(34, 197, 94, 0.4);
    font-weight: 600;
}

.edit-controls {
    display: flex;
    gap: 12px;
}

.view-mode .edit-controls {
    display: none;
}

.main-content {
    padding: 32px;
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.map-section {
    flex: 1;
    min-width: 300px;
}

.legend-section {
    flex: 0 0 300px;
    min-width: 250px;
}

.image-container {
    position: relative;
    display: inline-block;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.garden-image {
    display: block;
    max-width: 100%;
    height: auto;
    cursor: crosshair;
}

.view-mode .garden-image {
    cursor: default;
}

.label {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #22c55e;
    border-radius: 11px;
    padding: 4px 6px;
    cursor: move;
    font-size: 11px;
    font-weight: 600;
    color: #333;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    min-width: 22px;
    min-height: 22px;
    text-align: center;
    user-select: none;
    transition: all 0.2s;
    z-index: 10;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.label:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: scale(1.1);
    z-index: 20;
}

.label.dragging {
    opacity: 0.8;
    z-index: 1000;
    cursor: grabbing;
}

.view-mode .label {
    cursor: pointer;
}

.view-mode .label:hover {
    cursor: pointer;
}

.label-input {
    background: transparent;
    border: none;
    outline: none;
    font-size: 11px;
    font-weight: 600;
    color: #333;
    width: 100%;
    padding: 0;
    text-align: center;
}

.description-popup {
    position: fixed;
    background: white;
    border: 2px solid #22c55e;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    min-width: 250px;
    max-width: 400px;
    display: none;
}

.description-popup.show {
    display: block;
}

.description-popup h4 {
    margin: 0 0 8px 0;
    color: #22c55e;
    font-size: 16px;
}

.description-popup p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre;
}

.description-popup .close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ff4d4d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.legend-panel {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e0e0e0;
    overflow-y: auto;
}

.legend-panel h3 {
    color: #22c55e;
    margin: 0 0 16px 0;
    font-size: 18px;
    border-bottom: 2px solid #22c55e;
    padding-bottom: 8px;
}

.legend-item {
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #22c55e;
    transition: all 0.2s;
}

.legend-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.legend-item-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 4px;
}

.legend-item-description {
    color: #666;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre;
}

.legend-item-empty {
    color: #999;
    font-style: italic;
    font-size: 12px;
}

.legend-item.editing {
    border-color: #22c55e;
    background: #f0fdf4;
}

.legend-edit-input {
    width: 100%;
    border: 1px solid #22c55e;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.legend-edit-textarea {
    width: 100%;
    border: 1px solid #22c55e;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.legend-position-fields {
    margin-top: 8px;
    margin-bottom: 8px;
}

.legend-position-fields label {
    display: block;
    font-size: 11px;
    color: #666;
    margin-top: 6px;
    margin-bottom: 2px;
}

.legend-position-fields label:first-child {
    margin-top: 0;
}

.legend-position-fields .position-input {
    width: 100%;
    margin-bottom: 4px;
}

.legend-add-btn {
    width: 100%;
    padding: 12px;
    background: #22c55e;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.legend-add-btn:hover {
    background: #16a34a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.legend-add-btn:active {
    transform: translateY(0);
}

.legend-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.legend-action-btn {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid #22c55e;
    border-radius: 4px;
    background: white;
    color: #22c55e;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.legend-action-btn:hover {
    background: #22c55e;
    color: white;
}

.legend-action-btn.danger {
    border-color: #ff4d4d;
    color: #ff4d4d;
}

.legend-action-btn.danger:hover {
    background: #ff4d4d;
    color: white;
}

.instructions {
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #22c55e;
}

.instructions h3 {
    color: #22c55e;
    margin-bottom: 8px;
    font-size: 16px;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: 4px 0;
    color: #666;
    font-size: 14px;
}

.instructions li:before {
    content: "• ";
    color: #22c55e;
    font-weight: bold;
    margin-right: 8px;
}
